From a53ca2c75e27ce96691d7d0ae0b3e7dd7ee6be60 Mon Sep 17 00:00:00 2001 From: Yoni Fogel Date: Fri, 8 Feb 2008 18:40:36 +0000 Subject: [PATCH] Addresses #350 Only uses lock tree if both txns and locking system are enabled. If TXN only is enabled, it implies only one txn at a time: no lock tree needed. If LOCK only is enabled, it implies no txns, therefore only ephemeral locks needed (lock tree not needed) If neither are enabled, clearly lock tree is not needed. git-svn-id: file:///svn/tokudb@2193 c7de825b-a66e-492c-adef-691d508d4ae1 --- src/ydb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ydb.c b/src/ydb.c index 67ed08642c9..291c188cd91 100644 --- a/src/ydb.c +++ b/src/ydb.c @@ -1835,7 +1835,8 @@ static int toku_txn_add_lt(DB_TXN* txn, toku_lock_tree* lt) { static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname, DBTYPE dbtype, u_int32_t flags, int mode) { HANDLE_PANICKED_DB(db); // Warning. Should check arguments. Should check return codes on malloc and open and so forth. - BOOL transactions = (db->dbenv->i->open_flags & DB_INIT_TXN) != 0; + BOOL need_locktree = (db->dbenv->i->open_flags & DB_INIT_LOCK) && + (db->dbenv->i->open_flags & DB_INIT_TXN); int openflags = 0; int r; @@ -1896,7 +1897,7 @@ static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *db db->i->open_flags = flags; db->i->open_mode = mode; - if (transactions) { + if (need_locktree) { r = toku_lt_create(&db->i->lt, db, FALSE, toku_db_lt_panic, db->dbenv->i->max_locks, &db->dbenv->i->num_locks,