revision-id: abba70496923f21410aa78a85bc227a96cfd6cfe (mariadb-10.1.39-70-gabba7049692) parent(s): aa55d93cde4da10ea5848b90314d1e0263f5fa43 author: Sachin committer: Sachin timestamp: 2019-06-26 19:42:05 +0530 message: Fix galera_log_bin Call reset master on node_2 also. There are three more issues. 1. instead of show_binlog_events we are doing manual replace on nodes , which is not a good idea. 2. Mask bin log file name in show_binlog_events, because On first run file name is XXX003 on second run file name is XXX001. 3. One first run on node_1 there is binlog_checkpoint event while on subsequent runs there is no checkopoint event. --- mysql-test/include/show_binlog_events.inc | 5 ++ mysql-test/include/show_events.inc | 1 + mysql-test/suite/galera/r/galera_log_bin.result | 81 ++++++++++++------------- mysql-test/suite/galera/t/galera_log_bin.test | 24 +++++--- 4 files changed, 61 insertions(+), 50 deletions(-) diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index 57fe1ffe0e3..70d5412c645 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -26,6 +26,11 @@ # Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.: # $binlog_limit= 3 -- print three events # $binlog_limit= 4, 3 -- skip four events, print the three next events +# +# $additional_filter #In the form of s{a}{b}; +# Apply more filter to show_binlog_events result + + --let $include_filename= show_binlog_events.inc --source include/begin_include_file.inc diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc index 9ee01f73999..c8ff7fea2a8 100644 --- a/mysql-test/include/show_events.inc +++ b/mysql-test/include/show_events.inc @@ -102,6 +102,7 @@ let $script= s{((?:master|slave|slave-relay)-bin\.[0-9]{6};pos=)[0-9]+DOLLAR}{DOLLAR1POS}; s{SONAME ".*"}{SONAME "LIB"}; s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g; + $additional_filter; || --let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'}; diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result index 4772f347375..2d73b70369b 100644 --- a/mysql-test/suite/galera/r/galera_log_bin.result +++ b/mysql-test/suite/galera/r/galera_log_bin.result @@ -10,50 +10,47 @@ SELECT COUNT(*) = 2 FROM t2; COUNT(*) = 2 1 ALTER TABLE t1 ADD COLUMN f2 INTEGER; -FLUSH LOGS; -SHOW BINLOG EVENTS IN 'mysqld-bin.000002' LIMIT 4,18; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -mysqld-bin.000002 # Gtid # # GTID 0-1-1 -mysqld-bin.000002 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB -mysqld-bin.000002 # Gtid # # BEGIN GTID 0-1-2 -mysqld-bin.000002 # Table_map # # table_id: # (test.t1) -mysqld-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F -mysqld-bin.000002 # Xid # # COMMIT /* xid=# */ -mysqld-bin.000002 # Gtid # # GTID 0-1-3 -mysqld-bin.000002 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB -mysqld-bin.000002 # Gtid # # BEGIN GTID 0-1-4 -mysqld-bin.000002 # Table_map # # table_id: # (test.t2) -mysqld-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F -mysqld-bin.000002 # Xid # # COMMIT /* xid=# */ -mysqld-bin.000002 # Gtid # # BEGIN GTID 0-1-5 -mysqld-bin.000002 # Table_map # # table_id: # (test.t2) -mysqld-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F -mysqld-bin.000002 # Xid # # COMMIT /* xid=# */ -mysqld-bin.000002 # Gtid # # GTID 0-1-6 -mysqld-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -COUNT(*) = 2 -1 -SHOW BINLOG EVENTS IN 'mysqld-bin.000003' LIMIT 3,18; +mysqld-bin.# # Gtid # # GTID #-#-# +mysqld-bin.# # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB +mysqld-bin.# # Gtid # # BEGIN GTID #-#-# +mysqld-bin.# # Table_map # # table_id: # (test.t1) +mysqld-bin.# # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.# # Xid # # COMMIT /* XID */ +mysqld-bin.# # Gtid # # GTID #-#-# +mysqld-bin.# # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB +mysqld-bin.# # Gtid # # BEGIN GTID #-#-# +mysqld-bin.# # Table_map # # table_id: # (test.t2) +mysqld-bin.# # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.# # Xid # # COMMIT /* XID */ +mysqld-bin.# # Gtid # # BEGIN GTID #-#-# +mysqld-bin.# # Table_map # # table_id: # (test.t2) +mysqld-bin.# # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.# # Xid # # COMMIT /* XID */ +mysqld-bin.# # Gtid # # GTID #-#-# +mysqld-bin.# # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -mysqld-bin.000003 # Gtid # # GTID 0-1-1 -mysqld-bin.000003 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB -mysqld-bin.000003 # Gtid # # BEGIN GTID 0-1-2 -mysqld-bin.000003 # Table_map # # table_id: # (test.t1) -mysqld-bin.000003 # Write_rows_v1 # # table_id: # flags: STMT_END_F -mysqld-bin.000003 # Xid # # COMMIT /* xid=# */ -mysqld-bin.000003 # Gtid # # GTID 0-1-3 -mysqld-bin.000003 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB -mysqld-bin.000003 # Gtid # # BEGIN GTID 0-1-4 -mysqld-bin.000003 # Table_map # # table_id: # (test.t2) -mysqld-bin.000003 # Write_rows_v1 # # table_id: # flags: STMT_END_F -mysqld-bin.000003 # Xid # # COMMIT /* xid=# */ -mysqld-bin.000003 # Gtid # # BEGIN GTID 0-1-5 -mysqld-bin.000003 # Table_map # # table_id: # (test.t2) -mysqld-bin.000003 # Write_rows_v1 # # table_id: # flags: STMT_END_F -mysqld-bin.000003 # Xid # # COMMIT /* xid=# */ -mysqld-bin.000003 # Gtid # # GTID 0-1-6 -mysqld-bin.000003 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER +mysqld-bin.# # Gtid # # GTID #-#-# +mysqld-bin.# # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB +mysqld-bin.# # Gtid # # BEGIN GTID #-#-# +mysqld-bin.# # Table_map # # table_id: # (test.t1) +mysqld-bin.# # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.# # Xid # # COMMIT /* XID */ +mysqld-bin.# # Gtid # # GTID #-#-# +mysqld-bin.# # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB +mysqld-bin.# # Gtid # # BEGIN GTID #-#-# +mysqld-bin.# # Table_map # # table_id: # (test.t2) +mysqld-bin.# # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.# # Xid # # COMMIT /* XID */ +mysqld-bin.# # Gtid # # BEGIN GTID #-#-# +mysqld-bin.# # Table_map # # table_id: # (test.t2) +mysqld-bin.# # Write_rows_v1 # # table_id: # flags: STMT_END_F +mysqld-bin.# # Xid # # COMMIT /* XID */ +mysqld-bin.# # Gtid # # GTID #-#-# +mysqld-bin.# # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER DROP TABLE t1; DROP TABLE t2; RESET MASTER; +RESET MASTER; diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test index d2d3987d711..0516b0d3f14 100644 --- a/mysql-test/suite/galera/t/galera_log_bin.test +++ b/mysql-test/suite/galera/t/galera_log_bin.test @@ -21,19 +21,27 @@ SELECT COUNT(*) = 2 FROM t2; --connection node_1 ALTER TABLE t1 ADD COLUMN f2 INTEGER; -FLUSH LOGS; ---replace_column 2 # 4 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/ -SHOW BINLOG EVENTS IN 'mysqld-bin.000002' LIMIT 4,18; +--let $MASTER_MYPORT=$NODE_MYPORT_1 +--let $binlog_file = query_get_value(show master status,File,1) +--delimiter || +let $additional_filter = s{mysqld-bin\.[0-9]+}{mysqld-bin\.#}; + next if /.*Binlog_checkpoint.*/;|| +--delimiter ; +--source include/show_binlog_events.inc --connection node_2 -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ---replace_column 2 # 4 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/ -SHOW BINLOG EVENTS IN 'mysqld-bin.000003' LIMIT 3,18; +--let $binlog_file = query_get_value(show master status,File,1) +--delimiter || +let $additional_filter = s{mysqld-bin\.[0-9]+}{mysqld-bin\.#}; + next if /.*Binlog_checkpoint.*/;|| +--delimiter ; +--source include/show_binlog_events.inc DROP TABLE t1; DROP TABLE t2; --connection node_1 RESET MASTER; + +--connection node_2 +RESET MASTER;