summaryrefslogtreecommitdiff
path: root/sql/transaction.cc
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2017-11-22 17:10:34 +0200
committerMonty <monty@mariadb.org>2017-12-18 13:43:37 +0200
commite972125f11d8f37bc263b113e85ed064257a92ee (patch)
treef705082eec5bdb4f274b3e7ceee4714b86c96075 /sql/transaction.cc
parentabceaa75428f9b2d64ce64629d010af9aa6eae1f (diff)
downloadmariadb-git-e972125f11d8f37bc263b113e85ed064257a92ee.tar.gz
MDEV-13073 This part merges the Ali semisync related changes
and specifically the ack receiving functionality. Semisync is turned to be static instead of plugin so its functions are invoked at the same points as RUN_HOOKS. The RUN_HOOKS and the observer interface remain to be removed by later patch. Todo: React on killed status by repl_semisync_master.wait_after_sync(). Currently Repl_semi_sync_master::commit_trx does not check the killed status. There were few bugfixes found that are present in mysql and its unclear whether/how they are covered. Those include: Bug#15985893: GTID SKIPPED EVENTS ON MASTER CAUSE SEMI SYNC TIME-OUTS Bug#17932935 CALLING IS_SEMI_SYNC_SLAVE() IN EACH FUNCTION CALL HAS BAD PERFORMANCE Bug#20574628: SEMI-SYNC REPLICATION PERFORMANCE DEGRADES WITH A HIGH NUMBER OF THREADS
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r--sql/transaction.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc
index cbd875e3114..f6ccf5a1930 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -24,7 +24,7 @@
#include "rpl_handler.h"
#include "debug_sync.h" // DEBUG_SYNC
#include "sql_acl.h"
-
+#include "semisync_master.h"
#ifndef EMBEDDED_LIBRARY
/**
@@ -318,9 +318,19 @@ bool trans_commit(THD *thd)
transaction, so the hooks for rollback will be called.
*/
if (res)
+ {
(void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+#ifdef HAVE_REPLICATION
+ repl_semisync_master.waitAfterRollback(thd, FALSE);
+#endif
+ }
else
+ {
(void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
+#ifdef HAVE_REPLICATION
+ repl_semisync_master.waitAfterCommit(thd, FALSE);
+#endif
+ }
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.reset();
thd->lex->start_transaction_opt= 0;
@@ -414,6 +424,9 @@ bool trans_rollback(THD *thd)
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
res= ha_rollback_trans(thd, TRUE);
(void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+#ifdef HAVE_REPLICATION
+ repl_semisync_master.waitAfterRollback(thd, FALSE);
+#endif
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
/* Reset the binlog transaction marker */
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
@@ -526,9 +539,19 @@ bool trans_commit_stmt(THD *thd)
transaction, so the hooks for rollback will be called.
*/
if (res)
+ {
(void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+#ifdef HAVE_REPLICATION
+ repl_semisync_master.waitAfterRollback(thd, FALSE);
+#endif
+ }
else
+ {
(void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
+#ifdef HAVE_REPLICATION
+ repl_semisync_master.waitAfterCommit(thd, FALSE);
+#endif
+ }
thd->transaction.stmt.reset();
@@ -568,6 +591,9 @@ bool trans_rollback_stmt(THD *thd)
}
(void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+#ifdef HAVE_REPLICATION
+ repl_semisync_master.waitAfterRollback(thd, FALSE);
+#endif
thd->transaction.stmt.reset();