CouchDB
  1. CouchDB
  2. COUCHDB-1380

logrotate doesn't work correctly with couchdb 1.2.x

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2, 1.3
    • Component/s: None
    • Labels:
    • Environment:

      CentOS 5.6 x64, couchdb 1.2.x (13th Jan 2012 - 1.2.0a-08d8f89-git), logrotate 3.7.4

      Description

      Running logrotate -f with couchdb 1.2.x leaves null data at the start of the couch.log file, I'm guessing equal to the size of data that should have been removed and rotated into the log.1 (eg "head -c 1000000000 couch.log" is blank)

      This does not happen on couchdb 1.1.1, 1.0.2 or 1.0.3

      The log files then stay large, and when trying to grep or less them, they are reported as binary.

      This seems to have happened to another user, but no details of OS or version were reported: http://comments.gmane.org/gmane.comp.db.couchdb.user/16049

      The logrotate config used is very similar to the one installed with couchdb -
      /var/log/couchdb/*.log

      { size=150M rotate 5 copytruncate compress delaycompress notifempty missingok }

      Has there been any changes to the interaction with log files/file handles since 1.1.1? Does couchdb need to receive a SIGHUP? Or can anyone reproduce this?

        Issue Links

          Activity

          Robert Newson made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.2 [ 12315198 ]
          Fix Version/s 1.3 [ 12318350 ]
          Resolution Fixed [ 1 ]
          Hide
          Robert Newson added a comment -

          Introduction of disk_log reverted due to inability to rotate.

          Show
          Robert Newson added a comment - Introduction of disk_log reverted due to inability to rotate.
          Robert Newson made changes -
          Assignee Robert Newson [ rnewson ]
          Hide
          Filipe Manana added a comment -

          Agree with Robert's analys. Indeed it seems disk_log does pwrites and fseeks (file:position/2) in a few places. This partly explains why disk_log offers log rotating features.
          Other then reverting the commit which added disk_log to couch_log, I don't see a better short term solution.

          Show
          Filipe Manana added a comment - Agree with Robert's analys. Indeed it seems disk_log does pwrites and fseeks ( file:position/2 ) in a few places. This partly explains why disk_log offers log rotating features. Other then reverting the commit which added disk_log to couch_log, I don't see a better short term solution.
          Robert Newson made changes -
          Priority Minor [ 4 ] Blocker [ 1 ]
          Hide
          Robert Newson added a comment -

          Possibly disk_log is keeping an internal track of its write position and doing a positioned write (file:pwrite) call. After truncation by logrotate, this would cause a file hole on filesystems that support it and would actually fill in all that space with zeroes on filesystems that do not.

          In any case, this should be fixed before the 1.2. release. Thanks for reporting it!

          Show
          Robert Newson added a comment - Possibly disk_log is keeping an internal track of its write position and doing a positioned write ( file:pwrite ) call. After truncation by logrotate, this would cause a file hole on filesystems that support it and would actually fill in all that space with zeroes on filesystems that do not. In any case, this should be fixed before the 1.2. release. Thanks for reporting it!
          Hide
          Robert Newson added a comment -

          If the introduction of disk_log has made the log file unrotatable (I don't see how, though) then this is a release blocking issue.

          Show
          Robert Newson added a comment - If the introduction of disk_log has made the log file unrotatable (I don't see how, though) then this is a release blocking issue.
          Robert Newson made changes -
          Field Original Value New Value
          Link This issue is related to COUCHDB-1218 [ COUCHDB-1218 ]
          Alex Markham created issue -

            People

            • Assignee:
              Robert Newson
              Reporter:
              Alex Markham
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development