- 31 Aug, 2011 40 commits
-
-
Rusty Russell authored
There are some minor changes required, in particular: 1) Make sure lockcheck understands tdb1 allrecord lock upgrades. 2) Handle tdb1 sequence number jumps: various operations increment the sequence number twice, especually tdb_append. 3) Don't test fail on unlock, since it gets triggered with traversal on the tdb1 backend (we didn't actually ever test this case for tdb2). 4) Move clear_if_first to offset 4, to match tdb1.
-
Rusty Russell authored
The TDB2 tests are stricter about this; they want every error logged.
-
Rusty Russell authored
We're always allowed to unlock after a fork; by setting the count to 0 before calling the generic unlock function we don't trigger the pid check.
-
Rusty Russell authored
This reports errors if we fork() while holding a lock, or misuse a tdb which we have dual-opened.
-
Rusty Russell authored
Rather than rturning TDB_ERR_EINVAL, return TDB_ERR_RDONLY, and log when we fail due to nesting.
-
Rusty Russell authored
It's actually quite a good fit; we use compare_wrong_bucket for dead records, which is kind of correct (they should be in the free list).
-
Rusty Russell authored
-
Rusty Russell authored
-
Rusty Russell authored
The tdb1 backend simply returns "true" if there's an error determining if a tdb needs recovery. But this leads failtest down a rabbit hole; it's better to return the error at this case (and makes for better for diagnostics, since they will come from the first fault, not later in tdb1_transaction_recover().
-
Rusty Russell authored
This allows us to simulate the old "volatile" flag for tdb1. It's not necessary for tdb2. As this is the last function in tdb1.h, we remove that file.
-
Rusty Russell authored
-
Rusty Russell authored
It's only used in two files, make it static in one and do it manually in the other.
-
Rusty Russell authored
Move the tdb1_repack() code into the core, make it general, rename to tdb_repack(). It's generic code: copy database into temporary, wipe it, copy back.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag. Also, change tdb1_check's checkfn argument to return an error code (and set tdb->last_error accordingly).
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag; we now only do a tdb1_traverse_read on a read-only database, as there is no tdb2 equivalent.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Switch on the TDB_VERSION1 flag.
-
Rusty Russell authored
Finally, we gut tdb1_open() to the tdb1-specific parts, and call it from tdb_open if they specify the TDB_VERSION1 flag or the version is a TDB1. We also unify tdb_close(), based on the TDB_VERSION1 flag. Note that tdb_open(TDB_VERSION1) will fail on an existing tdb if it's a TDB2.
-
Rusty Russell authored
It also only makes sense with O_CREAT.
-
Rusty Russell authored
This replaces the tdb1_open "hash_size" argument. It will only be valid when you call tdb_open() with O_CREAT in open_flags, and TDB_VERSION1 in tdb_flags.
-
Rusty Russell authored
This brings it closer to tdb_open(), so we can unify more easily.
-
Rusty Russell authored
We're going to need access to it from tdb1_open, so expose it now. It's better in hash.c anyway.
-
Rusty Russell authored
This is a percursor to unifying with tdb_open() from tdb2, which handles this itself.
-
Rusty Russell authored
Finally, we split out the tdb2-specific parts of tdb_context, and put them into a "tdb2" sub-struct; the tdb1 parts go into a "tdb1" sub-struct. We get rido of tdb1_context and use tdb_context everywhere.
-
Rusty Russell authored
There's also a semantic change here: for tdb1, being read-only meant no locking, and it was an error to try to lock a r/o database. For TDB2, you'd need to specify TDB_NOLOCK, which suppresses locking silently.
-
Rusty Russell authored
This means converting the tdb1 inbuilt hash functions to the tdb2-style, so they return 64 bit. We truncate to 32 bit everywhere but in tdb_check() which needs to do so explicitly.
-
Rusty Russell authored
In TDB2, the user can override locking functions, so they may deliberarely fail (eg. be non-blocking) expecting to retry. For this reason, the TDB2 API requires the caller to cancel the transaction if tdb_transaction_prepare_commit() fails.
-
Rusty Russell authored
The TDB1 code logs multiple times on errors; we must prevent that in the limited case where locking fails. With TDB2, this can happen due to the lock function attribute, where the user supplies replacement locking functions which are allowed to return with errno EAGAIN or EINTR for various special-effects. Flooding the logs for this is unfriendly.
-
Rusty Russell authored
This means they will use the TDB_ATTRIBUTE_FLOCK functions, and get automatic reopen support.
-
Rusty Russell authored
Because tdb2 allows multiple opens of the same TDB, we separate out the file information from the struct tdb_context. Do the same for tdb1.
-
Rusty Russell authored
This will be set for old TDBs; we can start distinguishing paths based on it now.
-