bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Jos Backus
Subject: [patch #6612] tail -F should attempt to read from old file until EOF is encountered
Date: Sat, 16 Aug 2008 07:53:10 +0000
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.0.1) Gecko/2008071720 Firefox/3.0.1

URL:
  <http://savannah.gnu.org/patch/?6612>

                 Summary: tail -F should attempt to read from old file until
EOF is encountered
                 Project: GNU Core Utilities
            Submitted by: josb
            Submitted on: Saturday 08/16/2008 at 07:53
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Saturday 08/16/2008 at 07:53  Name: tail-dump_remainder.patch  Size:
321B   By: josb
Patch implementing this feature
<http://savannah.gnu.org/patch/download.php?file_id=16298>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?6612>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]