Commit d9f4581b authored by Yoni Fogel's avatar Yoni Fogel

Addresses #368

Deals with NULL transactions in a transaction environment for cursors.
Returns EINVAL (disallows NULL transaction cursors in txn environment.)
This may change later to auto-create transaction and commit it upon
cursor close.

git-svn-id: file:///svn/tokudb@2253 c7de825b-a66e-492c-adef-691d508d4ae1
parent 98d5d2c9
......@@ -2321,9 +2321,16 @@ static int locked_db_close(DB * db, u_int32_t flags) {
ydb_lock(); int r = toku_db_close(db, flags); ydb_unlock(); return r;
}
//TODO: Something about the cursor with no txn.. EINVAL maybe?
inline static int autotxn_db_cursor(DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) {
if (!txn && (db->dbenv->i->open_flags & DB_INIT_TXN)) {
return do_error(db->dbenv, EINVAL,
"Cursors in a transaction environment must have transactions.\n");
}
return toku_db_cursor(db, txn, c, flags);
}
static int locked_db_cursor(DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) {
ydb_lock(); int r = toku_db_cursor(db, txn, c, flags); ydb_unlock(); return r;
ydb_lock(); int r = autotxn_db_cursor(db, txn, c, flags); ydb_unlock(); return r;
}
inline static int autotxn_db_del(DB* db, DB_TXN* txn, DBT* key,
......
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