[Commits] 149840b: MDEV-11149: wsrep_replicate_mysaim: DML fails when binlog checksum enabled

Nirbhay Choubey nirbhay at mariadb.com
Wed Oct 26 19:06:54 EEST 2016


revision-id: 149840bd21ca1774416cb8a022d35956013ac129 (mariadb-10.2.2-63-g149840b)
parent(s): 51b1e2f4d9b16f286fb2421952b3c462e5b9a655
author: Nirbhay Choubey
committer: Nirbhay Choubey
timestamp: 2016-10-26 12:06:54 -0400
message:

MDEV-11149: wsrep_replicate_mysaim: DML fails when binlog checksum enabled

During total-order replication, Query_log_event's checksum_alg
should be explicitly set to the current binlog_checksum as it
is not set for DML queries.
Note: wsrep_replicate_myisam enables replication of DMLs on
MyISAM tables using TOI.

---
 .../suite/galera/r/galera_binlog_checksum.result    | 16 ++++++++++++++++
 .../suite/galera/t/galera_binlog_checksum.test      | 21 +++++++++++++++++++++
 sql/wsrep_mysqld.cc                                 |  6 +++++-
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result
index b0ea229..7303aa6 100644
--- a/mysql-test/suite/galera/r/galera_binlog_checksum.result
+++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result
@@ -11,3 +11,19 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
 COUNT(*) = 1
 1
 DROP TABLE t1;
+#
+# MDEV-11149: wsrep_replicate_mysaim: DML fails when binlog checksum
+# enabled
+#
+connection node_1;
+SET @@global.wsrep_replicate_myisam=1;
+CREATE TABLE t1 (i INT) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(1);
+connection node_2;
+SELECT * FROM t1;
+i
+1
+connection node_1;
+DROP TABLE t1;
+SET @@global.wsrep_replicate_myisam=0;
+# End of tests.
diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.test b/mysql-test/suite/galera/t/galera_binlog_checksum.test
index 4866930..09d7a02 100644
--- a/mysql-test/suite/galera/t/galera_binlog_checksum.test
+++ b/mysql-test/suite/galera/t/galera_binlog_checksum.test
@@ -20,3 +20,24 @@ UPDATE t1 SET f1 = 2 WHERE f1 = 1;
 SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
 
 DROP TABLE t1;
+
+--echo #
+--echo # MDEV-11149: wsrep_replicate_mysaim: DML fails when binlog checksum
+--echo # enabled
+--echo #
+
+--connection node_1
+let $wsrep_replicate_myisam_saved= `SELECT @@wsrep_replicate_myisam`;
+SET @@global.wsrep_replicate_myisam=1;
+
+CREATE TABLE t1 (i INT) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(1);
+
+--connection node_2
+SELECT * FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+eval SET @@global.wsrep_replicate_myisam=$wsrep_replicate_myisam_saved;
+
+--echo # End of tests.
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 01fb6d5..8c58ced 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -1248,9 +1248,11 @@ int wsrep_to_buf_helper(
                        65536, MYF(MY_WME)))
     return 1;
   int ret(0);
+  enum enum_binlog_checksum_alg current_binlog_check_alg=
+    (enum_binlog_checksum_alg) binlog_checksum_options;
 
   Format_description_log_event *tmp_fd= new Format_description_log_event(4);
-  tmp_fd->checksum_alg= (enum_binlog_checksum_alg)binlog_checksum_options;
+  tmp_fd->checksum_alg= current_binlog_check_alg;
   writer.write(tmp_fd);
   delete tmp_fd;
 
@@ -1269,11 +1271,13 @@ int wsrep_to_buf_helper(
     Query_log_event ev(thd, thd->wsrep_TOI_pre_query,
 		       thd->wsrep_TOI_pre_query_len,
 		       FALSE, FALSE, FALSE, 0);
+    ev.checksum_alg= current_binlog_check_alg;
     if (writer.write(&ev)) ret= 1;
   }
 
   /* continue to append the actual query */
   Query_log_event ev(thd, query, query_len, FALSE, FALSE, FALSE, 0);
+  ev.checksum_alg= current_binlog_check_alg;
   if (!ret && writer.write(&ev)) ret= 1;
   if (!ret && wsrep_write_cache_buf(&tmp_io_cache, buf, buf_len)) ret= 1;
   close_cached_file(&tmp_io_cache);


More information about the commits mailing list