summaryrefslogtreecommitdiff
path: root/lib/tdb2
AgeCommit message (Collapse)AuthorFilesLines
2012-03-07lib/tdb2: add --valgrind, --valgrind-log options.Rusty Russell1-1/+13
Not used by default, since it slows down testing (on my laptop) from 22 seconds to 2 minutes 30 seconds. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Amitay Isaacs <amitay@samba.org> Autobuild-Date: Wed Mar 7 04:57:21 CET 2012 on sn-devel-104
2012-03-07lib/tdb2: wire up unit tests.Rusty Russell2-1/+81
The tests are ccan-style, so the names tell how to link them. This logic is generic, and could be moved to wafsamba, cleaned up, and used elsewhere. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-03-07lib/tdb2: adapt unit tests to SAMBA environment.Rusty Russell89-147/+234
This means changing headers, implementing a simple tap-like wrapper, and also splitting out the helpers into those which are linked with the api* tests (which can't use non-public tdb2 functions) and those linked with the run* tests (which can). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-27lib/tdb2: rename tdb2.pc to tdb.pcRusty Russell2-1/+1
The library is called tdb, so the pc file must have the same name. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Mon Feb 27 06:59:58 CET 2012 on sn-devel-104
2012-02-21lib/tdb2: 2.0.0 ABIAmitay Isaacs1-0/+40
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Tue Feb 21 07:43:55 CET 2012 on sn-devel-104
2012-02-21lib/tdb2: Convert tdb2 to a standalone libraryAmitay Isaacs4-0/+99
Adds a Makefile, configure script, and tdb2.pc.in. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-21lib/tdb2: Fix wscriptAmitay Isaacs1-29/+52
Particularly fix the upcoming standalone build. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-21lib/tdb2: Mark public function as suchAmitay Isaacs9-40/+40
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-21lib/tdb2: Do not include config.h in (to-be) public library, use replace.Amitay Isaacs2-2/+22
Like tdb1, it's the caller's responsibility to set up various config options (eg. by #include "config.h") before including the public header. We use HAVE_CCAN for including the (private) CCAN headers, otherwise dummy macros are used. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-21lib/tdb2: tools should use config.h, and replace where available.Rusty Russell5-1/+28
The tdb2 tools should #include "config.h" before tdb2.h (about to become a requirement) and use libreplace where available. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-02-08Fix shadow variable name warning.Jeremy Allison1-10/+10
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 8 22:55:08 CET 2012 on sn-devel-104
2012-02-02tdb2: add --disable-tdb2Rusty Russell1-0/+3
I thought you could --disable-tdb2=false, apparently not! Thanks Michael Adam... Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Thu Feb 2 03:43:08 CET 2012 on sn-devel-104
2012-01-30tdb2: make --enable-tdb2 the default.Rusty Russell1-2/+2
We still use the tdb1 on-disk format, but we do so via the tdb2 library. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Mon Jan 30 08:02:43 CET 2012 on sn-devel-104
2012-01-30tdb2: add -1 and -2 options to tdbtortureRusty Russell1-1/+18
(For now, -1 is the default).
2012-01-30tdb2:tdbtorture: use TEST_DATA_PREFIX for filesRusty Russell1-9/+34
TDB2 version of commit b83672b36c1ea8c35833c40c3919b63809f16624. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-01-30tdb2: name tools the same as TDB1 tools.Rusty Russell1-5/+5
Otherwise, when we switch everyone's scripts will break (including our own tests!). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-01-30tdb2: tools/tdb2backupRusty Russell2-0/+374
Minor changes from tdb/tools/tdbbackup.c. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-01-30tdb2: copy tdb1's changed expansion logic.Rusty Russell3-27/+40
TDB2 uses the same expansion logic as TDB1, which got factored out recently. So update TDB2 to match. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit c438ec17d7b2efe76e56e5fc5ab88bd4a02735e8)
2012-01-30tdb2: careful on wrap.Rusty Russell6-20/+29
It's much harder to wrap a 64-bit tdb2 than a 32-bit tdb1, but we should still take care against bugs. Also, we should *not* cast the length to a size_t when comparing it to the stat result, in case size_t is 32 bit. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 6f7cb26e589cea081e71c59801eae87178967861)
2011-12-25tdb: Use tdb_parse_record in tdb_update_hashVolker Lendecke1-11/+15
This avoids a tdb_fetch, thus a malloc/memcpy/free in the tdb_store path
2011-12-19tdb2: Avoid a malloc/memcpy in _tdb1_storeVolker Lendecke1-19/+8
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Mon Dec 19 16:53:40 CET 2011 on sn-devel-104
2011-12-14tdb2: Fix python documentation for tdb.Tdb objectAmitay Isaacs1-1/+1
2011-12-05tdb2: tlist: remove type arg from tlist_top(), tlist_tail()Rusty Russell1-1/+1
With the type canary, it's unnecessary. Though the implementation is a bit more awkward since they longer map directly through to list_top/tail. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit a6b5111fe6948e51114c33aa34785c9fd0d403e6) Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Mon Dec 5 12:13:08 CET 2011 on sn-devel-104
2011-12-05tdb2: display capability information in tdb_summary()Rusty Russell2-25/+145
This means we know they're there in future, and what restrictions they carry. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit b3ca95351517e76b635347b39382b059a66f8388)
2011-12-05tdb2: add a capability list from the header.Rusty Russell9-27/+410
This allows even more extensibility in future: in particular, the top bits of each capability tell us what to do if we don't understand it: fail the open, fail to open for write, or don't try to check the format. tdb_check needs to understand the capability list so it can know to skip over it: each element in the list is prefixed with the type tag and the length. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 35f198de1851a7d57064546b7ced677b6fabee27)
2011-12-05tdb2: provide tdb_layout_write() rather than implying it by new_tdb_layout arg.Rusty Russell4-32/+47
Neater API. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 79d603a5f73dfbb655d8d08f67eecb5f2da542d5)
2011-12-05tdb2: add an internal TDB_CANT_CHECK flag.Rusty Russell2-0/+12
This will be used shortly to indicate that a TDB2 file indicates it cannot be checked. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit e01d795c8964b791def1e9f68c386b350b3a2a84)
2011-12-05tdb2: suppress failtest more than once on mmap.Rusty Russell1-0/+5
Now we test failing mmap, ccanlint -v time has increased from 200 to 330 seconds. Worse, tests no time out on my laptop. Fix this, by preventing us from going down that particular rabbit hole. ccanlint -v now takes 201 seconds again. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit fbae37ba91ec230e34be564084099726cc3a9d47)
2011-12-05tdb2: simplify failtest helper.Rusty Russell2-31/+3
failtest now culls duplicates for itself (and more efficiently), so don't replicate the logic here. It changes things a bit, because failtest uses backtraces rather than a simple call point to find duplicates. Also, fix one case (in run-11-simple-fetch.c) where we simply exited rather than using failtest_exit(). We got away with it before, because we never hit that particular failure pattern. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 3d99c9334fe3067c88772547b9c06acec21616ea)
2011-12-05tdb2: failtest: use a linked list for history, not an array.Rusty Russell2-30/+26
This avoids a silly realloc, but more importantly it gets us closer to being runtime extensible, as each history element can be a different size. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 9571a41e8494f3135557e3ec50c2de856392173e)
2011-12-05tdb2: consolidate testing failtest suppression routines.Rusty Russell8-72/+14
Less cut & paste means less patching as failtest changes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 1819a36a3e69565bd7b853503fceb846558a45bd)
2011-12-05tdb2: fix intermittant failure in run-50-multiple-freelists-fail.cRusty Russell4-10/+18
layout.c's TDB creation functions were incorrect in case of a hash collision, causing occasional failure. Make it always use the (previously-failing) seed value, and fix it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 60a487d57979e4364e70c837079f3cf083ddc9c7)
2011-11-02tdb2: don't be fascist when TDB_VERSION1 is specified.Rusty Russell2-5/+40
We currently insist that a tdb file be a version1 file if tdb_open() is passed the TDB_VERSION1 flag; we fail if it's actually a tdb2. But that makes generic wrappers harder, and is unlikely to be what the user wants: if they do, they can check tdb_get_flags() & TDB_VERSION1 after opening. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 9691464a16ef22d6acadfef209666381dfe22b2f) Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Nov 2 08:38:38 CET 2011 on sn-devel-104
2011-11-01tdb2: use HAVE_LIBREPLACE instead of _SAMBA_BUILD_.Rusty Russell3-5/+5
This is what lib/tdb2 really wants: to know if it should use normal headers or replace.h. It currently uses _SAMBA_BUILD_, which is wrong for ldb, for example. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Tue Nov 1 03:19:58 CET 2011 on sn-devel-104
2011-09-21tdb2: change --enable-tdb2-breaks-compat to --enable-tdb2Rusty Russell1-2/+2
Since we no longer break compatibility, don't scare people. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Sep 21 09:25:11 CEST 2011 on sn-devel-104
2011-09-20tdb2: allow readonly changes even while holding locks.Rusty Russell1-10/+0
This happens in SAMBA with the TDB_VERSION1, presumably due to a read-only traverse nested inside a normal traverse (since it doesn't occur without TDB_VERSION1). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 24e5ddb143fb5e79112649472258f5da67cc7362) Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Tue Sep 20 09:35:10 CEST 2011 on sn-devel-104
2011-09-14tdb2: remove bogus leftover .orig file.Rusty Russell1-618/+0
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Wed Sep 14 06:06:41 CEST 2011 on sn-devel-104
2011-09-14tdb2: fix prototypes which return enum TDB_ERROR.Rusty Russell2-10/+10
Since enums and ints are compatible in C, the compiler didn't warn that our prototypes for these functions disagreed with the definitions. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 6d3832ee613adeb9ae7ed6454996ffa39c32650f)
2011-09-14tdb2: fix return handling in pytdb wrapper.Rusty Russell1-8/+10
tdb_close() does genuinely return non-zero, not an error code, even in tdb2. And tdb_exists() returns true or false, not an error code. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-09-14tdb2: add error conversion functions.Rusty Russell12-91/+97
This clarifies the code a little, but also provides a more explicit mechanism which can be used to debug error handling (by introducing tdb_err_t and making it a pointer type). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit afa6d57b7d93fe4675a952f556eb462951baa257)
2011-09-14tdb2: set tdb_error() on tdb_transaction_prepare_commit.Rusty Russell1-1/+1
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit feb36b14278b4230af70dab90369a345b6a027ef)
2011-09-14tdb2: make tests work in parallel.Rusty Russell6-6/+6
Lazy cut & paste of tdb names causes failure when we run in parallel. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 380372e733416c2b348d5307f536d0a0807e95df)
2011-09-14tdb2: fix error handling for tdb1_transaction_commit.Rusty Russell1-1/+2
tdb_repack() returns an enum TDB_ERROR, whereas tdb1_transaction_commit is expected to return 0 or -1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit b679512e4260b9847e2f846b07443e6907d8276f)
2011-09-14tdb2: don't return -1 (ie. TDB_ERR_CORRUPT) on transaction write fail.Rusty Russell1-1/+1
A left-over -1 return; should be returning ecode (probably TDB_ERR_IO). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 077bdae6877d26749987b26a1b5b28cdba5ebbdd)
2011-09-14tdb2: enhance tdb1 porting document.Rusty Russell1-0/+28
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 9cbae0f976118472f0065eee674eacf6ab4b80c5)
2011-09-14tdb2: delete old tdb1 tests.Rusty Russell2-394/+0
These two tdb1-specific tests have been superceded by the TDB_VERSION1 flags used in the main tests. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit e42097b73f6cd509aa17a48487a707401a2d4bd0)
2011-09-14tdb2: test: Speed up run-01-new_database.Rusty Russell2-7/+78
Don't run tdb_check with failtest on, since it is very slow. Do the tdb_check w/ failtest in a new test, but skip MMAP suppression which doesn't add much and slows down valgrind a lot. Before this change run-01-new_database took 40 seconds (under valgrind), after it takes 8 seconds, and run-12-check takes 3 seconds). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit b3ae89992ecaffed31dcc2e912539c289478801a)
2011-09-14tdb2: speed up testing.Rusty Russell2-5/+7
The time to run tests under valgrind has become excessive; particularly the failure tests which fork(). Thus we cut down testing: 1) api-94-repack: reduce from 234 seconds to 2 seconds by cutting iterations, despite adding TDB_VERSION1 tests. 2) api-missing-entries: reduce from 17 seconds to under 1 second by not checking db inside loop, but at end. This reduces the total ccanlint time from 729 to 489 seconds. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit a99c2ccf97465d47c3277d997ea93f20ff97ad4d)
2011-09-14tdb2: test: convert (non-invasive) run tests to api tests.Rusty Russell23-23/+115
This reduces compilation time, since these are merely linked with the pre-built module, rather than recompiling it into the test (which allows for fancy things like failtest). This reduces the test compile time down from about 62 seconds to 45 seconds. Since ccanlint compiles tests three times (once normally, once with coverage, and once with reduced config.h) this makes a difference: we go from 780 seconds to 729 seconds. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit c4ca9f54301c0367891be6330f59fdd5dcdd51d1)
2011-09-14tdb2: test: fix run-57-die-during-transaction.c to be more efficient.Rusty Russell3-3/+18
We track malloc and free, but we didn't catch the free() inside external_agent, which means that our list of allocations keeps growing. Particularly under valgrind, which re-uses memory less than the glibc allocator. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit d9cbd7d4454ae35e4e2f6d18a9469bf26948e4b9)