On Sat, 2007-04-07 at 22:30 +0300, Timo Sirainen wrote: > I just figured out that O_APPEND is pretty great. If the operating > system updates seek position after writing to a file opened with > O_APPEND, writes to Dovecot's transaction log file can be made > lockless.
Well, almost. Log rotation isn't possible without some sort of locking. But the locks could still be reduced: - Normally keep the .log file read-locked all the time (multiple processes can have it read-locked) - Write to it with O_APPEND - If you notice that the log is going to be rotated soon, drop the read lock and acquire it only for the duration of appends - When the log is wanted to be rotated, try to get a write-lock. If it fails, try again later. If it succeeds, it's safe to rotate the log.
signature.asc
Description: This is a digitally signed message part