summaryrefslogtreecommitdiffstats
path: root/ctdb/lib/tdb/common/tdb.c
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-build: Remove duplicate tdb libraryAmitay Isaacs2014-06-201-1154/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* lib/tdb: Sync tdb from samba git treeAmitay Isaacs2012-04-131-51/+48
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 0f40ea2386892ae10b30beeded0e00edf4c019c3)
* tdb: fix short write logic in tdb_new_databaseRusty Russell2010-08-161-1/+15
| | | | | | | | | | | | | | Commit 207a213c/24fed55d purported to fix the problem of signals during tdb_new_database (which could cause a spurious short write, hence a failure). However, the code is wrong: newdb+written is not correct. Fix this by introducing a general tdb_write_all() and using it here and in the tracing code. Cc: Stefan Metzmacher <metze@samba.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 27ba0e5a6681063225df7244a85aa304c51c6948)
* Fix some nonempty blank linesVolker Lendecke2010-04-221-11/+10
| | | | | | (Imported from commit ea8e0d5d54b020c530e392c4edaeed43e20af303) (This used to be ctdb commit 7161cb1607bb105cd6f4f32df50f519314e77b3f)
* tdb: If tdb_parse_record does not find a record, return -1 instead of 0Volker Lendecke2010-04-221-1/+4
| | | | | | (Imported from commit fb98f60594b6cabc52d0f2f49eda08f793ba4748) (This used to be ctdb commit e90aba9967ea4a8ae7f6bdfc19666c47bd92951e)
* tdb: use tdb_nest_lock() for seqnum lock.Rusty Russell2010-04-221-3/+3
| | | | | | | | | | | This is pure overhead, but it centralizes the locking. Realloc (esp. as most implementations are lazy) is fast compared to the fnctl anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from commit d48c3e4982a38fb6b568ed3903e55e07a0fe5ca6) (This used to be ctdb commit 2e8512403525c14c9b776ce28891d09c17ada91d)
* tdb: cleanup: rename global_lock to allrecord_lock.Rusty Russell2010-04-221-1/+1
| | | | | | | | | | | | | The word global is overloaded in tdb. The global_lock inside struct tdb_context is used to indicate we hold a lock across all the chains. Rename it to allrecord_lock. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from commit e9114a758538d460d4f9deae5ce631bf44b1eff8) (This used to be ctdb commit a912657fb50a78b9b328c4564281fb9f7f1b3766)
* tdb: cleanup: split brlock and brunlock methods.Rusty Russell2010-04-221-2/+3
| | | | | | | | | | | | | | | | | | | | | This is taken from the CCAN code base: rather than using tdb_brlock for locking and unlocking, we split it into brlock and brunlock functions. For extra debugging information, brunlock says what kind of lock it is unlocking (even though fnctl locks don't need this). This requires an extra argument to tdb_transaction_unlock() so we know whether the lock was upgraded to a write lock or not. We also use a "flags" argument tdb_brlock: 1) TDB_LOCK_NOWAIT replaces lck_type = F_SETLK (vs F_SETLKW). 2) TDB_LOCK_MARK_ONLY replaces setting TDB_MARK_LOCK bit in ltype. 3) TDB_LOCK_PROBE replaces the "probe" argument. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from commit 452b4a5a6efeecfb5c83475f1375ddc25bcddfbe) (This used to be ctdb commit 7b5fdc9c588237c83a1e70e5437e2e5510055b92)
* Spelling fixes for tdb.Brad Hards2010-04-221-1/+1
| | | | | | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> (Imported from commit 09e756b1d651caef203a4b7e02234f6dea374b08) (This used to be ctdb commit b0dff4ed35ab2423b8fcc801cdaaebaa0d7654bb)
* tdb: add TDB_DISALLOW_NESTING and make TDB_ALLOW_NESTING the default behaviorStefan Metzmacher2009-12-161-0/+30
| | | | | | | | | | | | | | | We need to keep TDB_ALLOW_NESTING as default behavior, so that existing code continues to work. However we may change the default together with a major version number change in future. metze (cherry picked from samba commit 3b9f19ed919fef2e88b2f92ae541e07bc7379cd1) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit c1c0ede32dc00ed619d1cf5fda40a9de43995f3a)
* tdb: detect tdb store of identical records and skipAndrew Tridgell2009-12-161-0/+20
| | | | | | | | | This can help with ldb where we rewrite the index records (cherry picked from samba commit d4c0e8fdf063f88032c32de7ece60d502b322089) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit 470750fa2e3cf987f10de48451b1ee13aab03907)
* tdb: rename 'struct list_struct' into 'struct tdb_record'Stefan Metzmacher2009-12-161-15/+15
| | | | | | | | | metze (cherry picked from samba commit 3b62e250c066f44d0ab08a7db037b6b4f74a914b) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit 03b3682e3fa53c9f5fdf2c4beac8b5d030fd2630)
* Attempt to fix bug 5684Volker Lendecke2009-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | With the ctdb checkin dde9f3f006 tdb optimized out write lock checks for write-enabled transaction. Sadly, this also removed the possibility to ever remove dead records left over from tdb_delete calls within a transaction. Tridge, please check this! Did dde9f3f006 have any reason beyond performance optimizations? Thanks, Volker (cherry picked from samba commit 3f884c4ae36f3260e63626bdd4989d9258ae6497) (This used to be commit 1d85e0647e287d269b3f6b534da88f497d6f76c3) (cherry picked from samba commit 8c88209c6f4b57b0dbe1459bd5bc583c5d321758) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit b02bf7659f04f1fa203834bd75a2392b48e56c16)
* lib/tdb: wean off TDB_ERRCODE.Rusty Russell2009-12-161-3/+6
| | | | | | | | | | | | | | | It was a regrettable hack which I used to reduce line count in tdb; in fact it caused confusion as can be seen in this patch. In particular, ecode now needs to be set before TDB_LOG anyway, and having it exposed in the header is useless (the struct tdb_context isn't defined, so it's doubly useless). Also, we should never set errno, as io.c was doing. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cherry picked from samba commit b77f41d58b05101e02d8ac0e54cb0e30807d89c2) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit a6620f6e74aadc708395b21b42303d1082192fcc)
* lib/tdb: TDB_TRACE support (for developers)Rusty Russell2009-12-161-23/+209
| | | | | | | | | | | | | | | | | | When TDB_TRACE is defined (in tdb_private.h), verbose tracing of tdb operations is enabled. This can be replayed using "replay_trace" from http://ccan.ozlabs.org/info/tdb. The majority of this patch comes from moving internal functions to _<funcname> to avoid double-tracing. There should be no additional overhead for the normal (!TDB_TRACE) case. Note that the verbose traces compress really well with rzip. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cherry picked from samba commit 703004340c3e0f43f741bd368d2525cfd187d590) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit b01b756cb577f32a1ec4597efb00017241e01685)
* tdb: fix c++ build warning.Günther Deschner2009-12-161-2/+2
| | | | | | | | | Guenther (cherry picked from samba commit 1c2f4919abe99d07540b7380ad16d475d62aa50b) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit 9d5015e6fc68d3eb9e7b7178dbaf8c129dc79471)
* realloc() has that horrible overloaded free semantic when size is 0: current ↵Rusty Russell2009-08-041-2/+7
| | | | | | code does a free of the old record in this case, then fail. (This used to be ctdb commit 8b6a5bba93843cd83b7b386b82949ad88f29884a)
* Port from SAMBA ctdb: commit 936d76802f98d04d9743b2ca8eeeaadd4362db51 ↵Rusty Russell2009-08-041-0/+89
| | | | | | | | | | | | | | Author: Andrew Tridgell <tridge@samba.org> Date: Tue Dec 16 14:38:17 2008 +1100 imported the tdb_repack() code from CTDB 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 (This used to be ctdb commit fe3ceb101a5a9c336973c2c6c31406bd8181c2fe)
* Port from SAMBA tdb: commit a91bcbccf8a2243dac57cacec6fdfc9907580f69 Author: ↵Rusty Russell2009-08-041-0/+5
| | | | | | | | Jim McDonough <jmcd@samba.org> Date: Thu May 21 16:26:26 2009 -0400 Detect tight loop in tdb_find() (This used to be ctdb commit 5253a0ba3a34fbf5810f363ecc094203d49e835f)
* carefully step around the recovery area when doing a tdb_wipe_all. This preventsAndrew Tridgell2008-02-081-33/+47
| | | | | | problems with wipe_all on databases that may need crash recovery (This used to be ctdb commit e7b1349bf8784c151c2651edd99b3f40ebcece1f)
* fixed a problem with tdb growing after each recoveryAndrew Tridgell2008-02-071-0/+43
| | | | (This used to be ctdb commit d754380961e67271809fed6c44f45356fe7a9c77)
* merge from samba4Andrew Tridgell2008-01-181-42/+0
| | | | (This used to be ctdb commit 21245b894b32f232251fd7c0e2fbfd073fb10514)
* fixed the bug that caused tdbtorture to failAndrew Tridgell2008-01-141-0/+47
| | | | | | It was an error in the new transaction code (This used to be ctdb commit 27f0dfdfb93d92859de3cbbd3874cfb38c13a169)
* - added tdb_add_flags() and tdb_remove_flags()Andrew Tridgell2008-01-061-0/+10
| | | | | | | | - make freelist merging more paranoid - fixed TDB_DATA_STAART() (broken by earlier commit) (This used to be ctdb commit c3be8eb7d1ca316111ec51f45dbca2fa5609cf93)
* merge from Samba4Andrew Tridgell2008-01-051-1/+5
| | | | (This used to be ctdb commit 9aed7a1d065272c2e5b54872228a73f37664b526)
* convert tdb from u32 to uint32_t to match the current Samba treesAndrew Tridgell2008-01-051-15/+15
| | | | (This used to be ctdb commit 0dc754b7e8b0985a252885ed043949dfb7ea1ae1)
* added tdb_wipe_all() functionAndrew Tridgell2008-01-051-1/+55
| | | | (This used to be ctdb commit 8e2d81cf54630970d66af92de2c0333acd2e1d22)
* avoid write locks during delete checks in traversalsAndrew Tridgell2008-01-051-1/+2
| | | | (This used to be ctdb commit dde9f3f0061988a0cdf10ee9e4db982c1b79ad1a)
* update lib/tdb from samba4Andrew Tridgell2007-07-101-2/+1
| | | | (This used to be ctdb commit 96a39ccee38bcfd64d614fe4670766e59ef246b6)
* update lib/replace from samba4Andrew Tridgell2007-07-101-1/+1
| | | | (This used to be ctdb commit f0555484105668c01c21f56322992e752e831109)
* added seqnum propogation code to ctdbAndrew Tridgell2007-05-041-6/+19
| | | | (This used to be ctdb commit be2572b1b09eaaa1ea6a726d60f16996f9407d13)
* added a tdb_enable_seqnum() functionAndrew Tridgell2007-05-041-0/+8
| | | | (This used to be ctdb commit 1f89da231c6637e339d5da156d6a48340706fe61)
* merge local copy of tdb from samba4 tdbAndrew Tridgell2007-04-161-27/+237
| | | | (This used to be ctdb commit d4619ce98ce44acaebeb6ae9c516a7917bf4e27f)
* added rest of tdb (missed in earlier commit)Andrew Tridgell2007-02-201-0/+441
(This used to be ctdb commit 4c1434cc4613fc94958de0aa882bf7ca41ec8458)