Commit 845dfc1b authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:5037], fix bug by adding trx->should_abort in case loader returns an error

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@44505 c7de825b-a66e-492c-adef-691d508d4ae1
parent 964a8139
......@@ -3283,6 +3283,7 @@ cleanup:
if (error || loader_error) {
my_errno = error ? error : loader_error;
if (using_loader) {
trx->should_abort = true;
share->try_table_lock = true;
}
}
......@@ -5972,12 +5973,21 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
DBUG_PRINT("trans", ("commiting non-updating transaction"));
reset_stmt_progress(&trx->stmt_progress);
if (!is_fast_alter_running) {
commit_txn(trx->stmt, 0);
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("commit:%p:%d\n", trx->stmt, error);
if (trx->should_abort) {
abort_txn(trx->stmt);
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("rollback:%p\n", trx->stmt);
}
}
else {
commit_txn(trx->stmt, 0);
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("commit:%p:%d\n", trx->stmt, error);
}
}
trx->stmt = NULL;
trx->sub_sp_level = NULL;
trx->should_abort = false;
}
}
}
......
......@@ -1326,6 +1326,7 @@ cleanup:
abort_txn(txn);
trx->stmt = NULL;
trx->sub_sp_level = NULL;
trx->should_abort = false;
if (dropping_indexes) {
restore_drop_indexes(table, alter_info->index_drop_buffer, alter_info->index_drop_count);
}
......
......@@ -105,6 +105,7 @@ typedef struct st_tokudb_trx_data {
uint tokudb_lock_count;
tokudb_stmt_progress stmt_progress;
bool checkpoint_lock_taken;
bool should_abort;
} tokudb_trx_data;
extern char *tokudb_data_dir;
......
......@@ -811,6 +811,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
}
*txn = 0;
trx->sub_sp_level = NULL;
trx->should_abort = false;
}
else if (tokudb_debug & TOKUDB_DEBUG_TXN) {
TOKUDB_TRACE("nothing to commit %d\n", all);
......@@ -834,6 +835,7 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
}
*txn = 0;
trx->sub_sp_level = NULL;
trx->should_abort = false;
}
else {
if (tokudb_debug & TOKUDB_DEBUG_TXN) {
......
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