Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit bbeb528e74c0e234e1f724ac8d54be404cfc6f9a)
|
|
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.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 4dc29a338fadeac805b369b4b0851c02f1b152c7)
|
|
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.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 3e46dde21261966941469a6c75e1b45cd2d26324)
|
|
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.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 60210a73ec08a7b34ba637ad19e6749cf6dc1952)
|
|
This means getting rid of TDB_VOLATILE (perhaps we should use an
attribute for that?), TDB_INCOMPATIBLE_HASH (use the
tdb_attribute_hash for that) and TDB_CLEAR_IF_FIRST (use the
tdb_attribute_openhook for that).
We also get rid of TDB_DISALLOW_NESTING: that's the default for TDB2.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 22d0e0dc59fc9d7e0046fec6971ef478c2d604fd)
|
|
Rather than leak TDB_INCOMPATIBLE_HASH through to the TDB2 API, we make
it that if they use the tdb1_incompatible_hash function as their hash,
then we treat it as if they had specified the TDB_INCOMPATIBLE_HASH
flag (ie. we mark the header so it's unusable by tdb < 1.2.6).
This precludes the possibility of using TDB_INCOMPATIBLE_HASH with a
custom hash function: that used to allow the user to ensure that old TDB
versions couldn't open the TDB file (and recent ones check the header to
ensure they're using the right hash). But that's a small loss.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 3004f7e89a5978064b4fb29c1027e6d0d39e9418)
|
|
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 8a47d50d72ea62e378dc92b150c92c1317c73fa3)
|
|
To do this, we make sure that the first few fields of tdb1_context and
tdb_context are the same.
This sweep also fixes up a few paths where we weren't setting
tdb->ecode before our old logging function.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 919937354a331bb964564a11b5a5b80403ff8db9)
|
|
We're going to use TDB2's API, so some TDB1 APIs are obviously unnecessary.
We also get rid of USE_RIGHT_MERGES and TRACE code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit b929638e3cfe629285af3ecd0813e03eaeaa1133)
|
|
The main change is to s/tdb/tdb1_/ everywhere.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit fab544c24c1ad6523f95893abcaec4e6cce6c2b4)
|
|
Since we've renamed everything in tdb1, they won't clash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 5d6194b434f3664d1025df12ef06c6a25f693bc8)
|
|
This lets us add the new files to a single place.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 476567430be6962625bf399192e20938985232c7)
|
|
Create an iterator over every open tdb (not internal TDBs). This is
useful for re-establishing the tdb1-style active lock for
CLEAR_IF_FIRST.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 1a0c636bc38213bd0322db47529f78f2dc22ffdd)
|
|
This makes it easy to call it again after a fork(), such as for
re-establishing the CLEAR_IF_FIRST files locks.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 937d0babe99dcd315040a9e48430140e63e4a7df)
|
|
You can only unset it if the TDB was originally opened O_RDWR.
Also, cleaned up error handling in tdb_allrecord_lock() so we only get
one log message on a r/o database.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit b87e14495d5b07e1b247218a72329f10ecb3da7f)
|
|
Since we've deprecated tdb_error() function (and it didn't work right
from inside the logging function anyway, since we didn't set
tdb->ecode yet) we need to hand it to the log function.
(Imported from CCAN commit 6e3d9e8a66bf8b45150500f176452ee8e9ee9927)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
If the caller actually specifies TDB_CONVERT, fail if the TDB does not
need conversion. It's unusual for the user to specify TDB_CONVERT
(it's auto-detected) but better to be strict.
(Imported from CCAN commit 3e3ee8b0c1e77340ab9e8678c2d23646d8cdb627)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
We use off_t in the tdb2 interface (for tdb_attribute_flock); we need
to make sure that all callers agree on the size.
This also causes a problem in the tests: it's not enough to include
config.h first, we need the _FILE_OFFSET_BITS define from private.h.
Otherwise, we can disagree about the definitions of F_SETLK, F_SETLKW
and off_t, causing strange problems.
(Imported from CCAN commit baa17ee2d5e01a32030f19e566007417d72b4b6e)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|