Commit d2b02de3 authored by Yoni Fogel's avatar Yoni Fogel

refs #5153 minor cleanups from review

git-svn-id: file:///svn/toku/tokudb@45058 c7de825b-a66e-492c-adef-691d508d4ae1
parent a9cffad7
...@@ -519,9 +519,9 @@ toku_txn_is_read_only(TOKUTXN txn) { ...@@ -519,9 +519,9 @@ toku_txn_is_read_only(TOKUTXN txn) {
if (!txn->begin_was_logged) { if (!txn->begin_was_logged) {
// Did no work. // Did no work.
invariant(txn->roll_info.num_rollentries == 0); invariant(txn->roll_info.num_rollentries == 0);
// Was not prepared.
invariant(txn->do_fsync_lsn.lsn == ZERO_LSN.lsn); invariant(txn->do_fsync_lsn.lsn == ZERO_LSN.lsn);
invariant(toku_omt_size(txn->open_fts) == 0); invariant(toku_omt_size(txn->open_fts) == 0);
invariant(txn->num_pin==0);
return true; return true;
} }
return false; return false;
......
...@@ -773,10 +773,8 @@ static void invalidate_xa_xid (TOKU_XA_XID *xid) { ...@@ -773,10 +773,8 @@ static void invalidate_xa_xid (TOKU_XA_XID *xid) {
} }
void toku_txn_manager_note_abort_txn(TXN_MANAGER txn_manager, TOKUTXN txn) { void toku_txn_manager_note_abort_txn(TXN_MANAGER txn_manager, TOKUTXN txn) {
if (!txn->begin_was_logged) { if (toku_txn_is_read_only(txn)) {
//Read only transaction
invariant(txn->state==TOKUTXN_LIVE); invariant(txn->state==TOKUTXN_LIVE);
invariant(txn->num_pin==0);
txn->state = TOKUTXN_ABORTING; txn->state = TOKUTXN_ABORTING;
goto done; goto done;
} }
...@@ -802,10 +800,8 @@ void toku_txn_manager_note_abort_txn(TXN_MANAGER txn_manager, TOKUTXN txn) { ...@@ -802,10 +800,8 @@ void toku_txn_manager_note_abort_txn(TXN_MANAGER txn_manager, TOKUTXN txn) {
} }
void toku_txn_manager_note_commit_txn(TXN_MANAGER txn_manager, TOKUTXN txn) { void toku_txn_manager_note_commit_txn(TXN_MANAGER txn_manager, TOKUTXN txn) {
if (!txn->begin_was_logged) { if (toku_txn_is_read_only(txn)) {
//Read only transaction
invariant(txn->state==TOKUTXN_LIVE); invariant(txn->state==TOKUTXN_LIVE);
invariant(txn->num_pin==0);
txn->state = TOKUTXN_COMMITTING; txn->state = TOKUTXN_COMMITTING;
goto done; goto done;
} }
......
...@@ -68,7 +68,7 @@ struct __toku_db_env_internal { ...@@ -68,7 +68,7 @@ struct __toku_db_env_internal {
TOKULOGGER logger; TOKULOGGER logger;
toku_ltm* ltm; toku_ltm* ltm;
int open_txns; // Number of open transactions int32_t open_txns; // Number of open transactions
DB *directory; // Maps dnames to inames DB *directory; // Maps dnames to inames
DB *persistent_environment; // Stores environment settings, can be used for upgrade DB *persistent_environment; // Stores environment settings, can be used for upgrade
OMT open_dbs; // Stores open db handles, sorted first by dname and then by numerical value of pointer to the db (arbitrarily assigned memory location) OMT open_dbs; // Stores open db handles, sorted first by dname and then by numerical value of pointer to the db (arbitrarily assigned memory location)
......
...@@ -47,8 +47,8 @@ toku_txn_release_locks(DB_TXN* txn) { ...@@ -47,8 +47,8 @@ toku_txn_release_locks(DB_TXN* txn) {
static void static void
toku_txn_destroy(DB_TXN *txn) { toku_txn_destroy(DB_TXN *txn) {
(void) __sync_fetch_and_sub(&txn->mgrp->i->open_txns, 1); int32_t open_txns = __sync_sub_and_fetch(&txn->mgrp->i->open_txns, 1);
assert(txn->mgrp->i->open_txns>=0); invariant(open-txns > 0);
toku_txn_destroy_txn(db_txn_struct_i(txn)->tokutxn); toku_txn_destroy_txn(db_txn_struct_i(txn)->tokutxn);
toku_mutex_destroy(&db_txn_struct_i(txn)->txn_mutex); toku_mutex_destroy(&db_txn_struct_i(txn)->txn_mutex);
#if !TOKUDB_NATIVE_H #if !TOKUDB_NATIVE_H
......
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