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.
+
*/
/* 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) {
#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)