summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2019-05-14 13:03:06 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2019-05-14 13:03:06 +0530
commit47637a3dd13d19e897a7cbfd1499f1bf3b2fdb2a (patch)
tree1417d31b6c784299471c2f4d740fd0a38f1f0526
parent2647fd101db922b1e6c7363124adfc03e81ab8a0 (diff)
downloadmariadb-git-47637a3dd13d19e897a7cbfd1499f1bf3b2fdb2a.tar.gz
MDEV-11095: rpl.rpl_row_mysqlbinlog test fails if row annotation enabled
Problem: ======= Whel rpl.rpl_row_mysqlbinlog test is executed as shown below it fails with result content mismatch. perl mtr rpl_row_mysqlbinlog --mysqld=--binlog-annotate-row-events=1 Analysis: ========= When row annotations are enabled the actual query is written into the binlog which helps users to understand the query, even when row based replication is enabled. For example: Simple insert in row based replication looks like shown below. #190402 16:31:27 server id 1 end_log_pos 526 Annotate_rows: #Q> insert into t values (10) #190402 16:31:27 server id 1 end_log_pos 566 Table_map: `test`.`t` mapped to number 19 # at 566 #190402 16:31:27 server id 1 end_log_pos 600 Write_rows: table id 19 flags: STMT_END_F BINLOG ' B0GjXBMBAAAAKAAAADYCAAAAABMAAAAAAAEABHRlc3QAAXQAAQMAAQ== B0GjXBcBAAAAIgAAAFgCAAAAABMAAAAAAAEAAf/+CgAAAA== '/*!*/; # at 600 The test creates some binary log events and redirects them into a SQL file. Executes RESET MASTER and sources the SQL file back on clean master and verifies that the data is available. Please refer following steps. ../client/mysqlbinlog ./var/mysqld.1/data/master-bin.000001 > test.sql ../client/mysql -uroot -S./var/tmp/mysqld.1.sock -Dtest < test.sql ../client/mysqlbinlog ./var/mysqld.1/data/master-bin.000001 -v > row.sql When the row based replication specific SQL file is sourced once again on master the newly generated binlog will treat the entire "BASE 64" encoded event as query and write it into the binary log. Output from 'row.sql': #Q> BINLOG ' #Q> B0GjXBMBAAAAKAAAADYCAAAAABMAAAAAAAEABHRlc3QAAXQAAQMAAQ== #Q> B0GjXBcBAAAAIgAAAFgCAAAAABMAAAAAAAEAAf/+CgAAAA== #190402 16:31:27 server id 1 end_log_pos 657 Table_map: `test`.`t` mapped to number 23 # at 657 #190402 16:31:27 server id 1 end_log_pos 691 Write_rows: table id 23 flags: STMT_END_F BINLOG ' B0GjXBMBAAAAKAAAAJECAAAAABcAAAAAAAEABHRlc3QAAXQAAQMAAQ== B0GjXBcBAAAAIgAAALMCAAAAABcAAAAAAAEAAQH+CgAAAA== ### INSERT INTO `test`.`t` ### SET ### @1=10 '/*!*/; # at 691 This is expected behaviour as we cannot extract query from BASE 64 encoded input. This causes more number of binary logs to be generated when the test is executed with row annotations. The following lines from test assumes that only two binary logs will contain entire data. --echo --- Test 4 Second Remote test -- ---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql ---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql In a case when row annotations are enabled the data gets spread across four binary logs. As test uses only the first two binary log files, data available in other binary logs gets missed. Hence test fails with result content mismatch as less data is avaialble. Fix: ==== Use "-to-the-last" option of "mysqlbinlog" tool which will ensure that all the available binary log specific contents are included in .sql file.
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test3
1 files changed, 1 insertions, 2 deletions
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index 678679f0cf1..a249043fa19 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -151,8 +151,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_position --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--echo --- Test 4 Second Remote test --
---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql
+--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
# Now that we have our file, lets get rid of the current database.
# Cleanup the master and the slave and try to recreate.