patchGNU Core Utilities - Patches: patch #6612, tail -F should attempt to read...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

patch #6612: tail -F should attempt to read from old file until EOF is encountered

Submitted by:  Jos Backus <josb>
Submitted on:  Sat 16 Aug 2008 07:53:08 AM UTC  
Votes:  1  
 
Category: NonePriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open

Sat 16 Aug 2008 07:53:08 AM UTC, original submission:

Currently when `tail -F filename' sees that `filename' was moved (by noticing the dev/ino combo changing), it immediately switches to reading from the new filename without making a last attempt to read from the old file. When tailing log files this will cause tail to miss data in the usual scenario where the old file is closed, moved and the new file opened with the same name. The moment the new file appears, writing will have stopped to the old file, as close() has mostly likely been called and any remaining data will have been flushed to disk. So there is a good chance that reading until EOF from the old file will yield the file's remainder.

This patch was stress-tested against coreutils-6.4 and daemontools' multilog on CentOS 4, in a setup that forced multilog to rotate files rapidly and that checked for gaps in the logging stream from tail using a sequence number. In all but the most extreme scenarios (where the file was being rotated multiple times per second), this patch virtually eliminated data loss.

A similar patch was committed to FreeBSD; see http://www.freebsd.org/cgi/query-pr.cgi?pr=101979&cat=bin for details and a description of the test setup.

Jos Backus <josb>

 

Attached Files
file #16298:  tail-dump_remainder.patch added by josb (321B - application/octet-stream - Patch implementing this feature)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by josb (Voted in favor of this item)
  • -unavailable- added by josb (Submitted the item)
  • -unavailable- added by josb
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 1 encouragement so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 31 Aug 2008 06:00:58 PM UTCjosbCarbon-Copy-=>Added josb
    Sat 16 Aug 2008 07:53:08 AM UTCjosbAttached File-=>Added tail-dump_remainder.patch, #16298
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup