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

add TDB_NO_NESTING. When this flag is set tdb will not allow any nested transactions and tdb_transaction_start() will implicitely _cancel() any pending transactions before starting any new ones.

(This used to be ctdb commit 459e4ee135bd1cd24c15e5325906eb4ecfd550ec)
This commit is contained in:
Ronnie Sahlberg 2009-04-26 08:38:37 +10:00
parent 38ea6708dd
commit 777c634eae
2 changed files with 15 additions and 4 deletions

View File

@ -85,6 +85,11 @@
still available, but no transaction recovery area is used and no
fsync/msync calls are made.
- if TDB_NO_NESTING is passed to flags in tdb open then transaction
nesting is disabled. tdb_transaction_start() will then implicitely
cancel any pending transactions and always start a new transaction
context instead of nesting.
*/
@ -409,10 +414,15 @@ int tdb_transaction_start(struct tdb_context *tdb)
/* cope with nested tdb_transaction_start() calls */
if (tdb->transaction != NULL) {
tdb->transaction->nesting++;
TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_start: nesting %d\n",
tdb->transaction->nesting));
return 0;
if (!tdb->flags & TDB_NO_NESTING) {
tdb->transaction->nesting++;
TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_start: nesting %d\n",
tdb->transaction->nesting));
return 0;
} else {
tdb_transaction_cancel(tdb);
TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_start: cancelling previous transaction\n"));
}
}
if (tdb->num_locks != 0 || tdb->global_lock.count) {

View File

@ -47,6 +47,7 @@ extern "C" {
#define TDB_NOSYNC 64 /* don't use synchronous transactions */
#define TDB_SEQNUM 128 /* maintain a sequence number */
#define TDB_VOLATILE 256 /* Activate the per-hashchain freelist, default 5 */
#define TDB_NO_NESTING 512 /* Dont allow transaction nesting */
#define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret)