tdb: TDB_INCOMPATIBLE_HASH, to allow safe changing of default hash.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 21 Oct 2010 10:09:15 +0000 (12:09 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 21 Oct 2010 12:25:56 +0000 (14:25 +0200)
commit36656e1420427926080cc4dfe64e401697d4dcb1
treee8ce6b2ef7f1b58933220e2928a6a41da8e542c7
parent29ab853e0750499b0fb9625d32fd67d9695b7007
tdb: TDB_INCOMPATIBLE_HASH, to allow safe changing of default hash.

This flag to tdb_open/tdb_open_ex effects creation of a new database:
1) Uses the Jenkins lookup3 hash instead of the old gdbm hash if none is
   specified,
2) Places a non-zero field in header->rwlocks, so older versions of TDB will
   refuse to open it.

This means that the caller (ie Samba) can set this flag to safely
change the hash function.  Versions of TDB from this one on will either
use the correct hash or refuse to open (if a different hash is specified).
Older TDB versions will see the nonzero rwlocks field and refuse to open
it under any conditions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked (modified) from commit 2dcf76c9247ff02a1779000dbbecdc418473ca41)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
lib/tdb/common/open.c
lib/tdb/common/tdb_private.h
lib/tdb/include/tdb.h