Commit 9b6bd3f1 authored by Nirbhay Choubey's avatar Nirbhay Choubey

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.
parent db95beb3
......@@ -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.
......@@ -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.
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment