[Melbourne-pm] An intermittent problem with open for append

Scott Penrose scottp at dd.com.au
Wed May 28 04:36:03 PDT 2008


There has been comment on is append safe or not.

NFS - Absolutely not. You will need to consider locking (which also  
has issues)

UNIX - Yes no problem BUT you must be under the internal buffer on the  
system, and it is line bound. So multi line insert will not be in  
order, but single lines will. This means you are totally safe doing an  
append with single line log files, locally. Using the Sync and Buffer  
changes Paul suggested won't improve the situation or make it any  
safer. This is because you may have your two scripts hit the file the  
same time - even if exactly the same time, the OS will put both lines  
in without garbaling it - UNLESS you go over the buffer size (not sure  
what that is, but 512 bytes would probably be safe guess).

Windows - Anyone know?

Scott


More information about the Melbourne-pm mailing list