The branch, master has been updated via bf8dae63d10498e6b6179bbacdd72f1ff0fc60be (commit) via 1b2029dbb055ff07367ebc1f307f5241320227b2 (commit) via 459e4ee135bd1cd24c15e5325906eb4ecfd550ec (commit) from 70f21428c9eec96bcc787be191e7478ad68956dc (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit bf8dae63d10498e6b6179bbacdd72f1ff0fc60be Author: Ronnie Sahlberg <ronniesahlb...@gmail.com> Date: Sun Apr 26 08:47:38 2009 +1000 we only need to have transaction nesting disabled when we start the new transaction for the recovery commit 1b2029dbb055ff07367ebc1f307f5241320227b2 Author: Ronnie Sahlberg <ronniesahlb...@gmail.com> Date: Sun Apr 26 08:42:54 2009 +1000 set the TDB_NO_NESTING flag for the tdb before we start a transaction from within recovery commit 459e4ee135bd1cd24c15e5325906eb4ecfd550ec Author: Ronnie Sahlberg <ronniesahlb...@gmail.com> Date: Sun Apr 26 08:38:37 2009 +1000 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. ----------------------------------------------------------------------- Summary of changes: lib/tdb/common/transaction.c | 18 ++++++++++++++---- lib/tdb/include/tdb.h | 1 + server/ctdb_freeze.c | 2 ++ 3 files changed, 17 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index 4e2127b..6a34c45 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -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) { diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h index 0008085..6281181 100644 --- a/lib/tdb/include/tdb.h +++ b/lib/tdb/include/tdb.h @@ -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) diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c index e39332e..6f99f8b 100644 --- a/server/ctdb_freeze.c +++ b/server/ctdb_freeze.c @@ -345,7 +345,9 @@ int32_t ctdb_control_transaction_start(struct ctdb_context *ctdb, uint32_t id) } } + tdb_add_flags(ctdb_db->ltdb->tdb, TDB_NO_NESTING); ret = tdb_transaction_start(ctdb_db->ltdb->tdb); + tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NO_NESTING); tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_NOLOCK); -- CTDB repository