tdb question

tridge at samba.org tridge at samba.org
Thu Jan 31 23:48:32 GMT 2008


Herb,

 > So is there some api call that I'm missing to delete all
 > entries or would I still need to do the traverse/delete
 > between transaction start/commit?

You should definately use a transaction. If you use the latest tdb
code that I have committed over the last few weeks then it doesn't
matter how many records you modify in a transaction (I've fixed the
O(n^2)) behaviour. It is actually much faster to do lots of modifies
in a transaction and then commit than it is to do the operations
outside a transaction, as it doesn't need to lock on each
operation. It also means you never expose a half-modified database to
other processes - so you can do huge modifies on a live database.

To wipe the whole database inside the transaction use
tdb_wipe_all(). This is _much_ faster than a traverse/delete. 

Cheers, Tridge


More information about the samba-technical mailing list