summaryrefslogtreecommitdiff
path: root/sql/transaction.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2014-12-05 16:09:48 +0100
committerKristian Nielsen <knielsen@knielsen-hq.org>2014-12-06 08:49:50 +0100
commitdb21fddc3740dfa48f3443751c48282467afac5e (patch)
tree3ed31a4a5ce9abf3fe98cdd9c9bdf68ba8b5832b /sql/transaction.cc
parent1e3f09f1638e2bdec6029f6c98317d17d7ca76d1 (diff)
downloadmariadb-git-db21fddc3740dfa48f3443751c48282467afac5e.tar.gz
MDEV-6676: Optimistic parallel replication
Implement a new mode for parallel replication. In this mode, all transactions are optimistically attempted applied in parallel. In case of conflicts, the offending transaction is rolled back and retried later non-parallel. This is an early-release patch to facilitate testing, more changes to user interface / options will be expected. The new mode is not enabled by default.
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r--sql/transaction.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 18c7aef9f96..5127d241e85 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -155,6 +155,7 @@ bool trans_begin(THD *thd, uint flags)
when we come here. We should at some point change this to an assert.
*/
thd->transaction.all.modified_non_trans_table= FALSE;
+ thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
if (res)
DBUG_RETURN(TRUE);
@@ -243,6 +244,7 @@ bool trans_commit(THD *thd)
(void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
+ thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->lex->start_transaction_opt= 0;
DBUG_RETURN(MY_TEST(res));
@@ -290,6 +292,7 @@ bool trans_commit_implicit(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
+ thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
/*
Upon implicit commit, reset the current transaction
@@ -335,6 +338,7 @@ bool trans_rollback(THD *thd)
/* Reset the binlog transaction marker */
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
thd->transaction.all.modified_non_trans_table= FALSE;
+ thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->lex->start_transaction_opt= 0;
DBUG_RETURN(MY_TEST(res));
@@ -379,6 +383,7 @@ bool trans_rollback_implicit(THD *thd)
*/
thd->variables.option_bits&= ~(OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= false;
+ thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
/* Rollback should clear transaction_rollback_request flag. */
DBUG_ASSERT(! thd->transaction_rollback_request);
@@ -891,6 +896,7 @@ bool trans_xa_commit(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
+ thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
@@ -940,6 +946,7 @@ bool trans_xa_rollback(THD *thd)
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.modified_non_trans_table= FALSE;
+ thd->transaction.all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));