[Cyrus-CVS] src/cyrus/lib by murch
murch at andrew.cmu.edu
murch at andrew.cmu.edu
Fri Sep 26 08:15:30 EDT 2008
Update of /afs/andrew/system/cvs/src/cyrus/lib
In directory unix24.andrew.cmu.edu:/var/tmp/cvs-serv7252
Modified Files:
cyrusdb_skiplist.c
Log Message:
skiplist locking refactor
>From Bron Gondwana <brong at fastmail.fm>:
John Capo discovered a bug whereby foreach wasn't updating the transaction
pointer before calling the handler function, so any updates during the foreach
would fail if (and only if) it was the first database function to use that
transaction.
He posted a trivial patch to the mailing list which fixed the bug but left
unreachable code.
I decided that what was actually needed was a refactor of the 4 subtly
different sets of locking on the access functions: fetch, foreach, store and
delete into a single locking function.
The attached match creates a new function lock_or_update(), and also always
uses malloc and makes newtxn a "creation is initialisation" function for the
transaction. It's a much neater way to handle transactions, and significantly
clearer to read.
--- links to diffs follow ---
http://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/cyrus/lib/cyrusdb_skiplist.c.diff?r1=1.62&r2=1.63
More information about the Cyrus-cvs
mailing list