Author: tridge Date: 2005-09-22 13:12:46 +0000 (Thu, 22 Sep 2005) New Revision: 10421
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10421 Log: following on discussions with simo, I have worked out a way of allowing searches to proceed while another process is in a transaction, then only upgrading the transaction lock to a write lock on commit. The solution is: - split tdb_traverse() into two calls, called tdb_traverse() and tdb_traverse_read(). The _read() version only gets read locks, and will fail any write operations made in the callback from the traverse. - the normal tdb_traverse() call allows for read or write operations in the callback, but gets the transaction lock, preventing transastions from starting inside the traverse In addition we enforce the following rule that you may not start a transaction within a traverse callback, although you can start a traverse within a transaction With these rules in place I believe all the deadlock possibilities are removed, and we can now allow for searches to happen in parallel with transactions Modified: branches/SAMBA_4_0/source/lib/tdb/common/error.c branches/SAMBA_4_0/source/lib/tdb/common/io.c branches/SAMBA_4_0/source/lib/tdb/common/lock.c branches/SAMBA_4_0/source/lib/tdb/common/tdb.c branches/SAMBA_4_0/source/lib/tdb/common/tdb_private.h branches/SAMBA_4_0/source/lib/tdb/common/transaction.c branches/SAMBA_4_0/source/lib/tdb/common/traverse.c branches/SAMBA_4_0/source/lib/tdb/docs/README branches/SAMBA_4_0/source/lib/tdb/include/tdb.h branches/SAMBA_4_0/source/lib/tdb/tools/tdbtorture.c Changeset: Sorry, the patch is too large (401 lines) to include; please use WebSVN to see it! WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10421