1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

tdb_compat: handle TDB_VOLATILE flag.

This is only meaningful when using the TDB_VERSION1 flag: we set the
attribute to control the maximum number of dead records (to 5, which is
what TDB_VOLATILE did for tdb1).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2011-09-21 12:56:59 +09:30
parent 36b455d952
commit 10e6a32820
2 changed files with 12 additions and 2 deletions

View File

@ -94,7 +94,7 @@ tdb_open_compat_(const char *name, int hash_size_unused,
void *data),
void *log_data)
{
union tdb_attribute cif, log, hash, *attr = NULL;
union tdb_attribute cif, log, hash, max_dead, *attr = NULL;
if (log_fn) {
log.log.base.attr = TDB_ATTRIBUTE_LOG;
@ -122,6 +122,16 @@ tdb_open_compat_(const char *name, int hash_size_unused,
tdb_flags &= ~TDB_INCOMPATIBLE_HASH;
}
if (tdb_flags & TDB_VOLATILE) {
if (tdb_flags & TDB_VERSION1) {
max_dead.base.attr = TDB_ATTRIBUTE_TDB1_MAX_DEAD;
max_dead.base.next = attr;
max_dead.tdb1_max_dead.max_dead = 5;
attr = &max_dead;
}
tdb_flags &= ~TDB_VOLATILE;
}
/* Testsuite uses this to speed things up. */
if (getenv("TDB_NO_FSYNC")) {
tdb_flags |= TDB_NOSYNC;

View File

@ -83,7 +83,7 @@ int tdb_reopen_all(int parent_longlived);
/* These no longer exist in tdb2. */
#define TDB_CLEAR_IF_FIRST 1048576
#define TDB_INCOMPATIBLE_HASH 2097152
#define TDB_VOLATILE 0
#define TDB_VOLATILE 4194304
/* tdb2 does nonblocking functions via attibutes. */
enum TDB_ERROR tdb_transaction_start_nonblock(struct tdb_context *tdb);