summaryrefslogtreecommitdiff
path: root/lib/tdb
AgeCommit message (Collapse)AuthorFilesLines
2009-10-29tdb: add tests for double .close() in pytdbKirill Smelkov1-0/+9
The reason I do it is that when using older python-tdb as shipped in Debian Lenny, python interpreter crashes on this test: (gdb) bt #0 0xb7f8c424 in __kernel_vsyscall () #1 0xb7df5640 in raise () from /lib/i686/cmov/libc.so.6 #2 0xb7df7018 in abort () from /lib/i686/cmov/libc.so.6 #3 0xb7e3234d in __libc_message () from /lib/i686/cmov/libc.so.6 #4 0xb7e38624 in malloc_printerr () from /lib/i686/cmov/libc.so.6 #5 0xb7e3a826 in free () from /lib/i686/cmov/libc.so.6 #6 0xb7b39c84 in tdb_close () from /usr/lib/libtdb.so.1 #7 0xb7b43e14 in ?? () from /var/lib/python-support/python2.5/_tdb.so #8 0x0a038d08 in ?? () #9 0x00000000 in ?? () master's pytdb does not (we have a check for self->closed in obj_close()), but still... Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29tdb: reset tdb->fd to -1 in tdb_close()Kirill Smelkov1-1/+3
So that erroneous double tdb_close() calls do not try to close() same fd again. This is like SAFE_FREE() but for fd. Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29tdb: fix typo in python's Tdb.get() docstringKirill Smelkov1-1/+1
It's Tdb.get(), not Tdb.fetch(). Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-29tdb: kill last bits from swigKirill Smelkov2-6/+1
We no longer use swig for pytdb, so there is no need for swig make rules. Also pytdb.c header should be updated. Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-25tdb: detect tdb store of identical records and skipAndrew Tridgell1-0/+20
This can help with ldb where we rewrite the index records
2009-10-23tdb: rename 'struct list_struct' into 'struct tdb_record'Stefan Metzmacher9-54/+54
metze
2009-10-22lib/tdb: make tdbtool use tdb_check() for "check" commandRusty Russell1-14/+30
Also, set logging function so we get more informative messages. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-22lib/tdb: add tdb_check()Rusty Russell8-3/+441
ctdb wants a quick way to detect corrupt tdbs; particularly, tdbs with loops in their hash chains. tdb_check() provides this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-22lib/tdb: add -t (always use transactions) option to tdbtortureRusty Russell1-12/+29
This means you can kill it at any time and expect no corruption. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-10-22lib/tdb: wean off TDB_ERRCODE.Rusty Russell9-40/+59
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>
2009-10-22lib/tdb: TDB_TRACE support (for developers)Rusty Russell7-55/+402
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>
2009-10-20tdb: fixed the intermittent failure of tdbtorture in the build farmAndrew Tridgell1-2/+5
There was a race condition that caused the torture.tdb to be left in a state that needed recovery. The torture code thought that any message from the tdb code was an error, so the "recovered" message, which is a TDB_DEBUG_TRACE message, marked the run as being an error when it isn't.
2009-09-21tdb:tdbtool: fix indentation.Michael Adam1-178/+177
Michael
2009-09-21tdb:tdbtool: add transaction_start/_commit/_cancel commands.Michael Adam1-0/+21
So one can perform tdbtool operations protected by transactions. Michael
2009-09-21tdb:tdbtool: add the "speed" command to the help text.Michael Adam1-0/+1
Michael
2009-09-19tdb: increase minor versionAndrew Tridgell1-1/+1
we depend on reads in transactions for s4 replication
2009-09-15tdb: allow reads after prepare commitAndrew Tridgell1-8/+0
We previously only allowed a commit to happen after a prepare commit. It is in fact safe to allow reads between a prepare and a commit, and the s4 replication code can make use of that, so allow it.
2009-09-11tdb:mksigs: allow PRINTF_ATTRIBUTE(..) macros function types as funcion argsMichael Adam1-1/+1
Michael
2009-09-11tdb:mksigs: normalize bool -> _BoolMichael Adam1-0/+3
Michael
2009-09-11tdb:mksigs: ignore symbols (like _DEPRECATED_) after closing function ↵Michael Adam1-0/+1
parentheses Michael
2009-09-11tdb:mksigs: correctly ignode multiline function typedefsMichael Adam1-5/+5
by first concatenating multilint parentheses and removing typefes afterwards. Michael
2009-09-11tdb:mksigs: ignore struct forward declarations.Michael Adam1-0/+1
Michael
2009-09-11tdb:mksyms: allow characters after closing functions parenthesis.Michael Adam1-2/+2
Michael
2009-09-11tdb:mksyms: allow double pointer return value of functions.Michael Adam1-1/+1
Michael
2009-09-07tdb: fix c++ build warning.Günther Deschner1-2/+2
Guenther
2009-08-30One would expect I could spell my name...Michael Adam1-1/+1
2009-08-30tdb: move the original abi_checks script to script/abi_checks_gcc.shMichael Adam1-0/+0
Michael
2009-08-30tdb: run abi_checks as part of "make test".Michael Adam1-0/+2
Strange: I had to place "test:: abi_checks" before the main "test::" target here, otherwise the abi checks would not get run. Michael
2009-08-30tdb: remove files generated by "make abi_checks" in "make clean".Michael Adam1-0/+2
Michael
2009-08-30tdb: add a target "abi_checks" to tdb.Michael Adam1-0/+4
Simply run "make abi_checks" to call the abi check script appropriately. Michael
2009-08-30tdb: add script/abi_checks.sh. check for abi changes without gcc magic.Michael Adam1-0/+91
USAGE: abi_checks.sh LIBRARY_NAME header1 [header2 ...] This creates symbol signature lists using the mksyms and mksigs scripts and compares them with the checked in lists. Michael
2009-08-30tdb: add script to extract signatures from header files.Michael Adam1-0/+178
This produces output like the output gcc produces when invoked with the -aux-info switch. Run like this: cat include/tdb.h | ./script/mksigs.pl This simple parser is probably too coarse to handle all possible header files, but it treats tdb.h correctly... Michael
2009-08-30tdb: add scripts to extract library symbols (exports file) from headersMichael Adam2-0/+121
Michael
2009-08-28lib/tdb: don't overwrite TDBs with different version numbers.Rusty Russell1-5/+7
In future, this may happen, and we don't want to clobber them. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-08-06Add define guards around otherwise unused variable.Jeremy Allison1-0/+3
Jeremy.
2009-08-06There is one signedness issue in tdb which prevents traverses of TDB recordsRusty Russell1-9/+21
over the 2G offset on systems which support 64 bit file offsets. This fixes that case. On systems with 32 bit offsets, expansion and fcntl locking on these records will fail anyway. SAMBA already does '#define _FILE_OFFSET_BITS 64' in config.h (on my 32-bit x86 Linux system at least) to get 64 bit file offsets. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-07-31tdb: don't alter tdb->flags in tdb_reopen_all()Rusty Russell1-6/+13
The flags are user-visible, via tdb_get_flags/add_flags/remove_flags. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-07-31tdb: Reimplementation of Metze's "lib/tdb: if we know pwrite and pread are ↵Rusty Russell1-5/+10
thread/fork safe tdb_reopen_all() should be a noop". This version just wraps the reopen code, so we still re-grab the lock and do the normal sanity checks. The reason we do this at all is to avoid global fd limits, see: http://forums.fedoraforum.org/showthread.php?t=210393 Note also that this whole reopen concept is fundamentally racy: if the parent goes away before the child calls tdb_reopen_all, the database can be left without an active lock and another TDB_CLEAR_IF_FIRST opener will clear it. A fork_with_tdbs() wrapper could use a pipe to solve this, but it's hardly elegant (what if there are other independent things which have similar needs?). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-07-31tdb: Revert "lib/tdb: if we know pwrite and pread are thread/fork safe ↵Rusty Russell1-5/+0
tdb_reopen_all() should be a noop" This reverts commit e17df483fbedb81aededdef5fbb6ae1d034bc2dd. tdb_reopen_all also restores the active lock, required for TDB_CLEAR_IF_FIRST. Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-07-30realloc() has that horrible overloaded free semantic when size is 0:Rusty Russell1-2/+7
current code does a free of the old record in this case, then fail.
2009-07-30If the record is at the end of the database, pretending it has length 1Rusty Russell1-4/+1
might take us out-of-bounds. Only pretend to be length 1 for the malloc.
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-07-03tdb: fix define of tdbdir when srcdir != "."Björn Jacke1-2/+2
2009-07-03Sort the signature filesSimo Sorce2-44/+44
2009-06-17tdb: Fix help string in configure flag to enable Python bindings.Jelmer Vernooij1-1/+1
2009-06-17fix release scripts to always git cleanSimo Sorce1-0/+3
This makes sure we do not include foreign object files or other build byproducts by mistake.
2009-06-15Add exports file and abi checker for tdbSimo Sorce7-3/+172
This is a first attempt at exporting symbols only for public functions We also provide a rudimentary ABI checker that tries to check that function signatures are not changed by mistake. Given our use of macros this is not an API checker. It's all based on tdb.h contents and the gcc -aux-info option
2009-06-15Add option to --disable-python on buildSimo Sorce1-0/+9
2009-06-06lib/tdb/tools/tdbtorture.c: fixed memory leak.Slava Semushin1-0/+2
Found by cppcheck: [lib/tdb/tools/tdbtorture.c:326]: (error) Memory leak: pids