Understanding TDB behavior

Stefan (metze) Metzmacher metze at samba.org
Thu Jul 16 13:00:54 UTC 2015


Hi Amitay,

> Recently I noticed an unexpected (at least to me) behavior in TDB.
> 
> One process has created a database without mutex support and is still
> running.
> Second process tries to open the same database with mutex support.
> 
> My expectation was that the tdb_open() in the second process should fail.
> But, the second process succeeds and converts the database to use mutexes.
> 
> Is this expected?
> 
> To check this exhaustively, I wrote a new tdb test (attached) that tries
> various create and open flags combinations.  And as a result here are the
> findings:
> 
> 1. Either TDB_ALLOW_NESTING or TDB_DISALLOW_NESTING is always set for
> create and open.
> 
> 2. Create and open with TDB_MUTEX_LOCKING | TDB_CLEAR_IF_FIRST always adds
> TDB_INCOMPATIBLE_HASH.
> 
> 3. Database created with TDB_MUTEX_LOCKING can only be opened without
> TDB_MUTEX_LOCKING provided TDB_NOLOCK is specified, otherwise fails with
> EINVAL.
> 
> 4. Open with TDB_MUTEX_LOCKING | TDB_CLEAR_IF_FIRST always converts the
> existing database to use mutexes and incompatible hash.

CLEAR_IF_FIRST means CLEAR_IF_FIRST :-)

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150716/78dce946/signature.sig>


More information about the samba-technical mailing list