summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/common/traverse.c
AgeCommit message (Collapse)AuthorFilesLines
2008-09-16Use single copy of tdb in both samba3 and samba4.Jelmer Vernooij1-348/+0
2008-05-20Convert in_transaction to a bool. Add the same fix VolkerJeremy Allison1-4/+9
used for tdb_traverse() to tdb_traverse_read(). Jeremy. (This used to be commit e05ec3047c4fe0cc2e09a812830fc835dc35abea)
2008-05-20Fix nesting tdb_traverse in a transactionVolker Lendecke1-3/+8
Calling tdb_traverse inside a transaction led to the transaction lock being held indefinitely. This was caused by the tdb_transaction_lock/unlock inside tdb_traverse: The transaction code holds the global lock at offset TRANSACTION_LOCK. The call to tdb_transaction_lock does nothing because the transaction_lock is already being held. tdb_transaction_unlock inside tdb_wrap resets tdb->have_transaction_lock but does not release the kernel-level fcntl lock. transaction_commit later on does not release that fcntl lock either, because tdb->have_transaction_lock was already reset by tdb_transaction(). This patch does fix that problem for me. An alternative would be to make tdb->have_transaction_lock a counter that can cope with proper nesting, maybe in other places as well. Volker (This used to be commit 89543005fe2e4934b3c560c937d49304a32a7fc2)
2008-01-18merged changes from v3-2-testAndrew Tridgell1-0/+3
(This used to be commit 7077df3e2e3f171532f6a5ac87d45201736c9c11)
2008-01-15merged tdb from ctdb bzr treeAndrew Tridgell1-0/+3
(This used to be commit ed0c3a0f74c305b3b8554b05c3f97cf79db8296a)
2007-10-10r24336: Use standard data type uint32_t rather than tdb-specific u32.Jelmer Vernooij1-1/+1
(This used to be commit f90a698387c53508862eb6359bd4d1fba1d2b4b0)
2007-10-10r23798: updated old Temple Place FSF addresses to new URLAndrew Tridgell1-2/+1
(This used to be commit 40c0919aaa9c1b14bbaebb95ecce53eb0380fdbb)
2007-10-10r23795: more v2->v3 conversionAndrew Tridgell1-1/+1
(This used to be commit 84b468b2f8f2dffda89593f816e8bc6a8b6d42ac)
2007-10-10r23371: Fix the misleading comment I added - it really *should*Jeremy Allison1-2/+2
say "locks chain and returned record", not "and returns record" Jeremy. (This used to be commit fa880e6cc16024f14d10cdc8120ce67bfd1d2eb6)
2007-10-10r23370: Traverse in tdb wasn't consistently using theJeremy Allison1-8/+10
travlocks.lock_rw for lock read/write types, it was sometimes using it (tdb_next_lock) and sometimes explicitly using F_WRLCK instead. Change this to consistently use travlocks.lock_rw only. I'm pretty sure about this fix (else I woudn't be checking this in :-) but tridge and Volker please review. Jeremy. (This used to be commit fa548ad75e945ae4d167baffb87140c90cba268c)
2007-10-10r23238: merged transaction lock changes from ctdbAndrew Tridgell1-9/+5
this ensures that having the global lock also implies the transaction lock (This used to be commit 9dbb2633d7781fcc5d15b175ef36bfda5eb199bb)
2007-10-10r19401: make tdb_lockall() much more efficient, and add a tdb_lockall_read()Andrew Tridgell1-4/+4
call which does a read lock on all chains. These will be used to make ldb searches more efficient (This used to be commit de664ec1f8cf179f1d650563272c0de3f7636e2b)
2007-10-10r17532: merge from SAMBA_3_0 Revision: 17460Stefan Metzmacher1-0/+1
First step at fixing the build breakage with the groupmapping test. On Linux, F_RDLCK is defined to 0, for example NetBSD has it at 1. Still does not work fully though. Still investigating. metze (This used to be commit af08e56442367b5d803f61b8554d85e2fe0ce7e9)
2007-10-10r16774: This patch modifies the tdb API to allow the logging function to be usedAndrew Bartlett1-10/+10
as part of ldb. This allows tdb failures to be passed all the way up to Samba's DEBUG system, which allowed easier debugging. Unfortunately I had to extend the tdb API, as the logging function didn't have a context pointer. I've worked over the 'debug levels' in TDB. Most of them were 0, which didn't seem right, as some were trace-like messages. We didn't see any of these previously, except when accessing TDB directly. Andrew Bartlett (This used to be commit 58898092c1ce043f6d698db5065f372b79109e22)
2007-10-10r15120: Minimize the diff between Samba3 and Samba4 tdb: In Samba3 we don't ↵Volker Lendecke1-7/+7
allow C++ keywords. Change "private" -> "private_data". Volker (This used to be commit 047671567173e808fece41485bbeaaeebab7d4a2)
2007-10-10r14029: Fix resource leak in error codepath. Coverity CID #64.Jeremy Allison1-2/+6
Jeremy. (This used to be commit d2e9d5b34baee90060ee9131b3da903309625a56)
2007-10-10r13773: Be consistent in the way you get out and free allocated dataSimo Sorce1-2/+2
(This used to be commit 1113d4caa7bea1a7ffb9a50f42c5672bc1d452b4)
2007-10-10r10522: finally got the locking working on solaris10. This adds a read lock onAndrew Tridgell1-0/+12
the transaction lock in tdb_traverse_read(). This prevents a pattern of locks which triggers the deadlock detection code in solaris10. I suspect solaris10 is trying to prevent lock starvation by granting locks in the order they were requested, which makes it much easier to produce deadlocks. (This used to be commit 54203aacd138c30826d54c5d9b6cc8d6e9e270f8)
2007-10-10r10465: separate out a read_only db from a read-only traversal to ensure weAndrew Tridgell1-5/+5
don't end up doing a mmap read only (This used to be commit 294ccfd46a0c4e1af9365d028acdabec03c41ad3)
2007-10-10r10424: for caller convenience, automatically turn a tdb_traverse() into aAndrew Tridgell1-0/+4
tdb_traverse_read() for read only databases (This used to be commit 9b53e04377d2ff652c4a9496798d2e3aa0dccab3)
2007-10-10r10421: following on discussions with simo, I have worked out a way ofAndrew Tridgell1-15/+55
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 (This used to be commit 7dd31288a701d772e45b1960ac4ce4cc1be782ed)
2007-10-10r10405: added transactions into tdb, and hook them into ldb. See myAndrew Tridgell1-1/+1
samba-technical posting for more details on the transactions design. This also adds a number of command line arguments to tdbtorture, making it more flexible, and fixes some lock deadlock conditions in the tdbtorture code. (This used to be commit 06bd8abba942ec9f1e23f5c5d546cbb71ca3a701)
2007-10-10r10253: a fairly large tdb cleanup and re-organise. Nearly all of this changeAndrew Tridgell1-0/+274
just involves splitting up the core tdb.c code into separate files on logical boundaries, but there are some minor functional changes as well: - move the 'struct tdb_context' into tdb_private.h, hiding it from users. This was done to allow the structure to change without breaking code that uses tdb. - added accessor functions tdb_fd(), tdb_name(), and tdb_log_fn() to access the elements of struct tdb_context that were used by external code but are no longer visible - simplied tdb_append() to use tdb_fetch()/tdb_store(), which is just as good due to the way tdb locks work - changed some of the types (such as tdb_off to tdb_off_t) to make syntax highlighting work better - removed the old optional spinlock code. It was a bad idea. - fixed a bug in tdb_reopen_all() that caused tdbtorture to sometimes fail or report nasty looking errors. This is the only real bug fixed in this commit. Jeremy/Jerry, you might like to pickup this change for Samba3, as that could definately affect smbd in Samba3. The aim of all of these changes is to make the tdb transactions/journaling code I am working on easier to write. I started to write it on top of the existing tdb.c code and it got very messy. Splitting up the code makes it much easier to follow. There are more cleanups we could do in tdb, such as using uint32_t instead of u32 (suggested by metze). I'll leave those for another day. (This used to be commit 4673cdd0d261614e707b72a7a348bb0e7dbb2482)