Commit f57b8ae1 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:5038], fix some bugs in transactions after code review

git-svn-id: file:///svn/toku/tokudb@44352 c7de825b-a66e-492c-adef-691d508d4ae1
parent 97d2d07b
......@@ -13,7 +13,7 @@
#include "txn_manager.h"
struct txn_manager {
toku_mutex_t txn_manager_lock; // a lock protecting live_list_reverse and snapshot_txnids for now TODO: revisit this decision
toku_mutex_t txn_manager_lock; // a lock protecting this object
OMT live_txns; // a sorted tree. Old comment said should be a hashtable. Do we still want that?
OMT live_root_txns; // a sorted tree.
OMT snapshot_txnids; //contains TXNID x | x is snapshot txn
......@@ -682,7 +682,7 @@ int toku_txn_manager_iter_over_live_txns(
void toku_txn_manager_add_prepared_txn(TXN_MANAGER txn_manager, TOKUTXN txn) {
toku_mutex_lock(&txn_manager->txn_manager_lock);
assert(txn->state==TOKUTXN_LIVE);
txn->state = TOKUTXN_PREPARING; // This state transition must be protected against begin_checkpoint. Right now it uses the ydb lock.
txn->state = TOKUTXN_PREPARING; // This state transition must be protected against begin_checkpoint
toku_list_push(&txn_manager->prepared_txns, &txn->prepared_txns_link);
toku_mutex_unlock(&txn_manager->txn_manager_lock);
}
......
......@@ -207,7 +207,7 @@ static void fill_prov_info(
prov_txns[i] = txn;
if (txn) {
prov_states[i] = toku_txn_get_state(txn);
if (prov_states[i] == TOKUTXN_LIVE || prov_states[i] == TOKUTXN_LIVE) {
if (prov_states[i] == TOKUTXN_LIVE || prov_states[i] == TOKUTXN_PREPARING) {
// pin
toku_txn_manager_pin_live_txn_unlocked(txn_manager, txn);
}
......@@ -236,7 +236,7 @@ static void release_txns(
}
// see if any txn pinned before bothering to grab txn_manager lock
for (u_int32_t i = 0; i < num_provisional; i++) {
if (prov_states[i] == TOKUTXN_LIVE || prov_states[i] == TOKUTXN_LIVE) {
if (prov_states[i] == TOKUTXN_LIVE || prov_states[i] == TOKUTXN_PREPARING) {
assert(prov_txns[i]);
some_txn_pinned = TRUE;
}
......@@ -244,7 +244,7 @@ static void release_txns(
if (some_txn_pinned) {
toku_txn_manager_suspend(txn_manager);
for (u_int32_t i = 0; i < num_provisional; i++) {
if (prov_states[i] == TOKUTXN_LIVE || prov_states[i] == TOKUTXN_LIVE) {
if (prov_states[i] == TOKUTXN_LIVE || prov_states[i] == TOKUTXN_PREPARING) {
toku_txn_manager_unpin_live_txn_unlocked(txn_manager, prov_txns[i]);
}
}
......
......@@ -169,8 +169,8 @@ toku_txn_abort_only(DB_TXN * txn,
}
HANDLE_PANICKED_ENV(txn->mgrp);
assert_zero(r);
r = toku_txn_release_locks(txn);
toku_txn_complete_txn(db_txn_struct_i(txn)->tokutxn);
r = toku_txn_release_locks(txn);
return r;
}
......
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