patch for user rename with tdbsam

tridge at tridge at
Tue Oct 11 03:43:00 GMT 2005


 > Have you looked at it?  Just wondering how much work it would be.

It should be trivial to backport. In fact, just grab all of lib/tdb
from Samba4 and plonk it in Samba3. The API remains the same, except
you can now optionally use transactions if you want to.

I think for the situation you are talking about it is ideal. The
properties are:

 - changes made within a transaction are visible to the person doing
   the transaction

 - changes made within the transaction are not visible to anyone else
   until the transaction is committed (other processes can continue to
   do searches while the transaction is happening, and will see the
   pre-transaction data until the commit is successful)

 - if the transaction is cancelled then no IOs happen at all (the file
   is completely unmodified)

 - transactions are crash proof (and kill -9 proof). If
   tdb_transaction_commit() has returned then the changes are
   guaranteed to be on disk. If the crash happens before that function
   completes then you end up with an unmodified db (it auto-recovers
   from partial writes on the next tdb connect if needed)
 - the file format is forwards and backwards compatible with the old
   tdb code. The only exception to this is if you crash half way
   through a commit, then the old (pre-transaction) code won't know
   how to auto-recover the db.

 - you can mix transaction-aware code with code that is not
   transaction aware. It just means if you crash while doing a write
   not inside a transaction you risk corruption (just like the old tdb

To convert tdbsam just do a tdb_transaction_start(tdb) at the entry
point to any code that modifies the db, and either do a
tdb_transaction_commit(tdb) when happy with the changes or a
tdb_transaction_cancel(tdb) if you want to throw them all away.

Cheers, Tridge

More information about the samba-technical mailing list