in reply to open for append

As I understand it, the main thing to watch out for is not going over a single block in a write, i.e. if block size on your system is 4K, writing more than 4K may break this.

Replies are listed 'Best First'.
Re^2: open for append
by samtregar (Abbot) on Aug 25, 2005 at 17:38 UTC
    You're right. Modifying the test script to write lines containing 5k of data causes errors.

    -sam

      Yes, increasing the line size to just over 4.1k causes errors in the line length discrepancies test, indicating data interleave problems between different processes. I didn't get interleaving problems with the line sizes any smaller than that. I'm running on reiserfs, which I understand has some sort of variable block size. I never see discrepancies with the total byte count, which seems to match the open(2) documentation on my system.

      Anyway, the take home is that you may as well be safe and perform exclusive locking, when you have many processes writing to the same file (which is opened for append).

      I haven't done any benchmarking to see if there is significant savings from not doing lock. It is conceivable that someone might wish to consider this possibility, if they could be assured that each "record" written to the file were smaller than their block size.

      -Colin.

      WHITEPAGES.COM | INC