summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Setiya <sachin.setiya@mariadb.com>2017-09-23 01:16:03 +0530
committerSachin Setiya <sachin.setiya@mariadb.com>2017-09-23 01:16:03 +0530
commit53519467886608d2bb60a7989b8967314fa48eae (patch)
tree45fbd9ca21ddeb6cd03cbd6862fe9ef4940ad142
parentcf554f7ac9b866132d955691d5500cb67af98f9e (diff)
downloadmariadb-git-bb-mdev-10715.tar.gz
-rw-r--r--mysql-test/suite/galera/t/galera_mdev_10715.test24
-rw-r--r--sql/wsrep_hton.cc33
2 files changed, 40 insertions, 17 deletions
diff --git a/mysql-test/suite/galera/t/galera_mdev_10715.test b/mysql-test/suite/galera/t/galera_mdev_10715.test
index e654d82fc65..18e32266a7d 100644
--- a/mysql-test/suite/galera/t/galera_mdev_10715.test
+++ b/mysql-test/suite/galera/t/galera_mdev_10715.test
@@ -26,20 +26,20 @@ INSERT INTO t1 VALUES(1);
SELECT @@global.gtid_binlog_state;
--connection node_2
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
---source include/wait_condition.inc
-
---let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
---source include/wait_condition.inc
+#--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+#--source include/wait_condition.inc
+#--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+#--source include/wait_condition.inc
+--sleep 1000
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
SELECT @@global.gtid_binlog_state;
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
-
---let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
---source include/wait_condition.inc
+--sleep 1
+#--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+#--source include/wait_condition.inc
SELECT COUNT(*) = 1 FROM t1;
SELECT @@global.gtid_binlog_state;
@@ -57,12 +57,12 @@ DROP TABLE t1;
--sleep 1
--connection node_3
---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
---source include/wait_condition.inc
+#--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+#--source include/wait_condition.inc
--connection node_2
---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
---source include/wait_condition.inc
+#--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+#--source include/wait_condition.inc
STOP SLAVE;
RESET SLAVE ALL;
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index cb5afa97d6b..5128a8b0a1e 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -24,6 +24,7 @@
#include <cstdlib>
#include "debug_sync.h"
#include "log_event.h"
+#include "log.cc"
extern ulonglong thd_to_trx_id(THD *thd);
@@ -428,11 +429,33 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
rcode = 0;
if (cache) {
thd->binlog_flush_pending_rows_event(true);
-/*Gtid_log_event gtid_event(thd, thd->variables.gtid_seq_no, thd->variables.gtid_domain_id, true,
- LOG_EVENT_SUPPRESS_USE_F, true,
- 0);
- mysql_bin_log.write_gtid_event(thd, true, true, 0);
-*/ rcode = wsrep_write_cache(wsrep, thd, cache, &data_len);
+ /* Get domain id only when gtid mode is set*/
+ if (wsrep_gtid_mode)
+ {
+ Gtid_log_event gtid_event(thd, 0, 0, true,
+ LOG_EVENT_SUPPRESS_USE_F, true,
+ 0);
+ /*
+ If this event is replicate through a master then ,
+ we will forward the same gtid another nodes
+ */
+ if (thd->variables.gtid_seq_no)
+ {
+ gtid_event.domain_id= thd->variables.gtid_domain_id;
+ gtid_event.seq_no= thd->variables.gtid_seq_no;
+ }
+ else
+ {
+ gtid_event.domain_id= wsrep_gtid_domain_id;
+ /* Get the latest sequence no stored and then add one */
+ rpl_gtid *current_gtid= rpl_global_gtid_binlog_state.find_most_recent(
+ gtid_event.domain_id);
+ gtid_event.seq_no= current_gtid->seq_no;
+ }
+ gtid_event.server_id= thd->variables.server_id;
+ mysql_bin_log.write_event(&gtid_event);
+ }
+ rcode = wsrep_write_cache(wsrep, thd, cache, &data_len);
if (WSREP_OK != rcode) {
WSREP_ERROR("rbr write fail, data_len: %zu, %d", data_len, rcode);
DBUG_RETURN(WSREP_TRX_SIZE_EXCEEDED);