Commit 6822b968 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 2b3e161a
......@@ -519,9 +519,9 @@ toku_txn_is_read_only(TOKUTXN txn) {
if (!txn->begin_was_logged) {
// Did no work.
invariant(txn->roll_info.num_rollentries == 0);
// Was not prepared.
invariant(txn->do_fsync_lsn.lsn == ZERO_LSN.lsn);
invariant(toku_omt_size(txn->open_fts) == 0);
invariant(txn->num_pin==0);
return true;
}
return false;
......
......@@ -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) {
if (!txn->begin_was_logged) {
//Read only transaction
if (toku_txn_is_read_only(txn)) {
invariant(txn->state==TOKUTXN_LIVE);
invariant(txn->num_pin==0);
txn->state = TOKUTXN_ABORTING;
goto done;
}
......@@ -802,10 +800,8 @@ done:
}
void toku_txn_manager_note_commit_txn(TXN_MANAGER txn_manager, TOKUTXN txn) {
if (!txn->begin_was_logged) {
//Read only transaction
if (toku_txn_is_read_only(txn)) {
invariant(txn->state==TOKUTXN_LIVE);
invariant(txn->num_pin==0);
txn->state = TOKUTXN_COMMITTING;
goto done;
}
......
......@@ -68,7 +68,7 @@ struct __toku_db_env_internal {
TOKULOGGER logger;
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 *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)
......
......@@ -47,8 +47,8 @@ toku_txn_release_locks(DB_TXN* txn) {
static void
toku_txn_destroy(DB_TXN *txn) {
(void) __sync_fetch_and_sub(&txn->mgrp->i->open_txns, 1);
assert(txn->mgrp->i->open_txns>=0);
int32_t open_txns = __sync_sub_and_fetch(&txn->mgrp->i->open_txns, 1);
invariant(open-txns > 0);
toku_txn_destroy_txn(db_txn_struct_i(txn)->tokutxn);
toku_mutex_destroy(&db_txn_struct_i(txn)->txn_mutex);
#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