[Cyrus-CVS] src/cyrus/lib by murch

murch at andrew.cmu.edu murch at andrew.cmu.edu
Mon Jan 7 11:27:48 EST 2008


Update of /afs/andrew/system/cvs/src/cyrus/lib
In directory unix21.andrew.cmu.edu:/var/tmp/cvs-serv6142

Modified Files:
	cyrusdb_skiplist.c 
Log Message:
Skiplist transaction safety (courtesy of Fastmail.fm)

The skiplist code checks SAFE_TO_APPEND when starting a new
transaction and doing a write operation.  Unfortunately, when
starting a transaction with a read operation, it would get
the write_lock, but not call SAFE_TO_APPEND, meaning when
the first read operation came around, the database would
be writable but not safety checked.

This patch moves the SAFE_TO_APPEND check into newtxn, so
it is called whenever a transaction is created, regardless
of the calling function.

While we're here, it also fixes a couple of bugs in 
SAFE_TO_APPEND and file locking regarding the position
of logstart and what to expect at the end of the file
if we're not at logstart, making sure that the header
values in the 'db' struct are always the ones currently
on disk!


--- links to diffs follow ---
http://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/cyrus/lib/cyrusdb_skiplist.c.diff?r1=1.56&r2=1.57


More information about the Cyrus-cvs mailing list