summaryrefslogtreecommitdiff
path: root/lib/tdb/common
AgeCommit message (Collapse)AuthorFilesLines
2009-07-21tdb: fix locking errorRusty Russell1-1/+1
54a51839ea65aa788b18fce8de0ae4f9ba63e4e7 "Make tdb transaction lock recursive (samba version)" was broken: I "cleaned it up" and prevented it from ever unlocking. To see the problem: $ bin/tdbtorture -s 1248142523 tdb_brlock failed (fd=3) at offset 8 rw_type=1 lck_type=14 len=1 tdb_transaction_lock: failed to get transaction lock tdb_transaction_start failed: Resource deadlock avoided My testcase relied on the *count* being correct, which it was. Fixing that now. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Michael Adam <obnox@samba.org>
2009-07-20Make tdb transaction lock recursive (samba version)Rusty Russell3-21/+20
This patch replaces 6ed27edbcd3ba1893636a8072c8d7a621437daf7 and 1a416ff13ca7786f2e8d24c66addf00883e9cb12, which fixed the bug where traversals inside transactions would release the transaction lock early. This solution is more general, and solves the more minor symptom that nested traversals would also release the transaction lock early. (It was also suggestd in Volker's comment in 6ed27ed). This patch also applies to ctdb, if the traverse.c part is removed (ctdb's tdb code never received the previous two fixes). Tested using the testsuite from ccan (adapted to the samba code). Thanks to Michael Adam for feedback. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Michael Adam <obnox@samba.org>
2009-06-01overallocate all records by 25%Andrew Tridgell1-0/+3
This greatly reduces the fragmentation of databases where records tend to grow slowly by a small amount each time. The case where this is most seen is the ldb index records. Adding this overallocation reduced the size of the resulting database by more than 20x when running a test that adds 10k users.
2009-06-01auto-repack in transactions that expand the tdbAndrew Tridgell1-0/+12
The idea behind this is to recover from badly fragmented free lists. Choosing the point where the file expands is fairly arbitrary, but seems to work well.
2009-05-28make TDB_NOSYNC affect all the fsync/msync calls in transactionsAndrew Tridgell1-5/+7
During a transaction commit tdb normally uses fsync/msync calls to make it crash safe. This can be disabled using the TDB_NOSYNC flag, but it wasn't disabling all the code paths that caused a fsync/msync.
2009-05-21Detect tight loop in tdb_find()Jim McDonough1-0/+5
2009-03-31tdb: Remove unused variableTim Prouty1-1/+0
2009-03-31Add tdb_transaction_prepare_commit()Howard Chu1-52/+124
Using tdb_transaction_prepare_commit() gives us 2-phase commits. This allows us to safely commit across multiple tdb databases at once, with reasonable transaction semantics Signed-off-by: tridge@samba.org
2009-02-25lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() ↵Stefan Metzmacher1-0/+5
should be a noop The reason for tdb_reopen_all() is that the seek pointer on fds are shared between parent and child. metze
2008-12-16imported the tdb_repack() code from CTDBAndrew Tridgell1-0/+89
The tdb_repack() function repacks a TDB so that it has a single freelist entry. The file doesn't shrink, but it does remove all freelist fragmentation. This code originated in the CTDB vacuuming code, but will now be used in ldb to cope with fragmentation from re-indexing
2008-09-17Move common libraries from root to lib/.Jelmer Vernooij11-0/+4679