Commit a53ca2c7 authored by Yoni Fogel's avatar Yoni Fogel

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
parent 0f39ff8a
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment