diff options
author | Jonas Oreland <jonaso@google.com> | 2014-12-23 13:38:00 +0100 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2014-12-23 14:16:32 +0100 |
commit | 0b87de124d716cee7c1aa56f30c7f80c2c2bfcce (patch) | |
tree | 5557407d03402bdf28daf1b64e438362358f6188 /sql/transaction.cc | |
parent | 4d8b346e079a27960dbe49e4d0ec4364bed8d30e (diff) | |
download | mariadb-git-0b87de124d716cee7c1aa56f30c7f80c2c2bfcce.tar.gz |
MDEV-162 Enhanced semisync replication
Implement --semi-sync-master-wait-point=AFTER_SYNC|AFTER_COMMIT.
When AFTER_SYNC, the semi-sync wait will be done earlier, before the storage
engine commit rather than after. This means that a transaction will not be
visible on the master until at least one slave has received it.
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r-- | sql/transaction.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc index 5127d241e85..3628790aa63 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -24,6 +24,7 @@ #include "rpl_handler.h" #include "debug_sync.h" // DEBUG_SYNC #include "sql_acl.h" +#include "log.h" // for assert_LOCK_log_owner /* Conditions under which the transaction state must not change. */ static bool trans_check(THD *thd) @@ -232,6 +233,13 @@ bool trans_commit(THD *thd) ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); res= ha_commit_trans(thd, TRUE); + + /* documentation of which mutexes are (not) owned */ + mysql_mutex_assert_not_owner(&LOCK_prepare_ordered); + assert_LOCK_log_owner(false); + mysql_mutex_assert_not_owner(&LOCK_after_binlog_sync); + mysql_mutex_assert_not_owner(&LOCK_commit_ordered); + if (WSREP_ON) wsrep_post_commit(thd, TRUE); /* @@ -433,6 +441,12 @@ bool trans_commit_stmt(THD *thd) } } + /* documentation of which mutexes are (not) owned */ + mysql_mutex_assert_not_owner(&LOCK_prepare_ordered); + assert_LOCK_log_owner(false); + mysql_mutex_assert_not_owner(&LOCK_after_binlog_sync); + mysql_mutex_assert_not_owner(&LOCK_commit_ordered); + /* if res is non-zero, then ha_commit_trans has rolled back the transaction, so the hooks for rollback will be called. |