mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.8 into 10.9
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#
|
||||
########################################################################################
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size");
|
||||
|
||||
let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
|
||||
let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1);
|
||||
|
90
mysql-test/suite/rpl/include/rpl_row_img_sequence.inc
Normal file
90
mysql-test/suite/rpl/include/rpl_row_img_sequence.inc
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# This include file validates that sequence events are properly binlogged
|
||||
# and replicated.
|
||||
#
|
||||
# Parameters:
|
||||
# expected_columns (list<uint>, in) : A list of positive integers which
|
||||
# correspond to the column numbers that should be output in a binary
|
||||
# log's write_rows event
|
||||
#
|
||||
|
||||
--echo # Create sequences with specific engines per server
|
||||
--connection server_1
|
||||
--eval SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=$server_1_engine
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2
|
||||
--eval SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=$server_2_engine
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
--connection server_3
|
||||
--eval SET STATEMENT sql_log_bin=0 FOR create sequence s1 cache=0 engine=$server_3_engine
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
|
||||
--echo # Pt.1 Ensure SETVAL replicates and binlogs correctly
|
||||
--connection server_1
|
||||
SELECT SETVAL(s1, 10);
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--echo # Validate SETVAL replicated correctly to other servers
|
||||
--connection server_3
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--let $diff_tables= server_1:test.s1,server_2:test.s1,server_3:test.s1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo # Validate server_1 binlogged SETVAL with the correct columns
|
||||
--connection server_1
|
||||
--let binlog_filenamE= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
FLUSH LOGS;
|
||||
--source include/ensure_binlog_row_event_columns.inc
|
||||
|
||||
--echo # Validate server_2 binlogged SETVAL with the correct columns
|
||||
--connection server_2
|
||||
--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
FLUSH LOGS;
|
||||
--source include/ensure_binlog_row_event_columns.inc
|
||||
|
||||
--echo # Validate server_3 binlogged SETVAL with the correct columns
|
||||
--connection server_3
|
||||
--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
FLUSH LOGS;
|
||||
--source include/ensure_binlog_row_event_columns.inc
|
||||
|
||||
|
||||
--echo # Pt.2 Ensure NEXTVAL replicates and binlogs correctly
|
||||
--connection server_1
|
||||
SELECT NEXTVAL(s1);
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--echo # Validate NEXTVAL replicated correctly to other servers
|
||||
--connection server_3
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--let $diff_tables= server_1:test.s1,server_2:test.s1,server_3:test.s1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo # Validate server_1 binlogged NEXTVAL with the correct columns
|
||||
--connection server_1
|
||||
--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
FLUSH LOGS;
|
||||
--source include/ensure_binlog_row_event_columns.inc
|
||||
|
||||
--echo # Validate server_2 binlogged NEXTVAL with the correct columns
|
||||
--connection server_2
|
||||
--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
FLUSH LOGS;
|
||||
--source include/ensure_binlog_row_event_columns.inc
|
||||
|
||||
--echo # Validate server_3 binlogged NEXTVAL with the correct columns
|
||||
--connection server_3
|
||||
--let binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
FLUSH LOGS;
|
||||
--source include/ensure_binlog_row_event_columns.inc
|
||||
|
||||
|
||||
--echo # Cleanup
|
||||
--connection server_1
|
||||
DROP TABLE s1;
|
||||
--source include/save_master_gtid.inc
|
||||
--connection server_3
|
||||
--source include/sync_with_master_gtid.inc
|
@@ -1,12 +1,9 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
# Master server_1 and Slave server_2 initialiation ...
|
||||
# Master server_1 and Slave server_2 initialization ...
|
||||
connection server_2;
|
||||
include/stop_slave.inc
|
||||
connection server_1;
|
||||
set @@sql_log_bin = off;
|
||||
call mtr.add_suppression("Slave: An attempt was made to binlog GTID 10-1-1 which would create an out-of-order sequence number with existing GTID");
|
||||
set @@sql_log_bin = on;
|
||||
RESET MASTER;
|
||||
set @@session.gtid_domain_id=10;
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
@@ -22,39 +19,36 @@ Warnings:
|
||||
Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-1. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
CHANGE MASTER TO master_use_gtid= slave_pos;
|
||||
include/start_slave.inc
|
||||
# ... server_1 -> server_2 is set up
|
||||
# server_1 -> server_2 semisync link is set up.
|
||||
connection server_1;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=Innodb;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT default 0) ENGINE=Innodb;
|
||||
INSERT INTO t1(a) VALUES (1);
|
||||
include/save_master_gtid.inc
|
||||
connection server_2;
|
||||
# Circular configuration server_2 -> server_1 initialiation ...
|
||||
include/sync_with_master_gtid.inc
|
||||
# Circular configuration server_1 -> server_2 -> server_1 ...
|
||||
connection server_1;
|
||||
# A. ... first when server_1 is in gtid strict mode...
|
||||
set @@global.gtid_strict_mode = true;
|
||||
set @@global.rpl_semi_sync_slave_enabled = 1;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root', master_use_gtid=SLAVE_POS;
|
||||
# ... only for it to fail 'cos if its inconsistent (empty) slave's gtid state:
|
||||
SELECT @@global.gtid_slave_pos;
|
||||
@@global.gtid_slave_pos
|
||||
|
||||
START SLAVE;
|
||||
include/wait_for_slave_sql_error.inc [errno=1950]
|
||||
# B. ... Resume on the circular setup with the server_id now in the non-strict mode ...
|
||||
set @@global.gtid_strict_mode = false;
|
||||
include/start_slave.inc
|
||||
# ... to have succeeded.
|
||||
... is done.
|
||||
## A. no out-of-order gtid error for own transaction made round trip
|
||||
connection server_2;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
set @@global.gtid_strict_mode = true;
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
INSERT INTO t1(a) VALUES (2);
|
||||
include/save_master_gtid.inc
|
||||
connection server_1;
|
||||
INSERT INTO t1 VALUES (3);
|
||||
#
|
||||
# the successful sync is a required proof
|
||||
#
|
||||
include/sync_with_master_gtid.inc
|
||||
update t1 set b=b+1 where a=2;
|
||||
include/save_master_gtid.inc
|
||||
connection server_2;
|
||||
# The gtid states on server_2 must be equal to ...
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-1,10-1-3,20-2-1
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
Variable_name Value
|
||||
gtid_slave_pos 0-2-1,10-1-3,20-2-1
|
||||
include/sync_with_master_gtid.inc
|
||||
# Post-execution state check on both servers synchronized with each other
|
||||
connection server_1;
|
||||
# ... the gtid states on server_1
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
@@ -63,14 +57,107 @@ gtid_slave_pos 0-2-1,10-1-3,20-2-1
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-1,10-1-3,20-2-1
|
||||
SELECT * from t1;
|
||||
a b
|
||||
1 0
|
||||
2 1
|
||||
connection server_2;
|
||||
# The gtid states on server_2 must be equal to ...
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-1,10-1-3,20-2-1
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
Variable_name Value
|
||||
gtid_slave_pos 0-2-1,10-1-3,20-2-1
|
||||
SELECT * from t1;
|
||||
a b
|
||||
1 0
|
||||
2 1
|
||||
## B. out-of-order gtid error for a "foreign" server-id transaction
|
||||
connection server_1;
|
||||
set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 10-2-4");
|
||||
set @@session.server_id=2;
|
||||
INSERT INTO t1(a) VALUES (3);
|
||||
set @@session.server_id=default;
|
||||
include/save_master_gtid.inc
|
||||
connection server_2;
|
||||
include/sync_with_master_gtid.inc
|
||||
INSERT INTO t1(a) VALUES (4);
|
||||
include/save_master_gtid.inc
|
||||
connection server_1;
|
||||
include/wait_for_slave_sql_error.inc [errno=1950]
|
||||
set sql_slave_skip_counter=1;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
connection server_2;
|
||||
set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 20-1-3");
|
||||
set @@session.server_id=1;
|
||||
INSERT INTO t1(a) VALUES (5);
|
||||
set @@session.server_id=default;
|
||||
include/save_master_gtid.inc
|
||||
connection server_1;
|
||||
include/sync_with_master_gtid.inc
|
||||
INSERT INTO t1(a) VALUES (6);
|
||||
include/save_master_gtid.inc
|
||||
connection server_2;
|
||||
include/wait_for_slave_sql_error.inc [errno=1950]
|
||||
set sql_slave_skip_counter=1;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
# Post-execution state check on both servers synchronized with each other
|
||||
connection server_1;
|
||||
# ... the gtid states on server_1
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
Variable_name Value
|
||||
gtid_slave_pos 0-2-1,10-1-5,20-1-3
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-1,10-1-5,20-1-3
|
||||
SELECT * from t1;
|
||||
a b
|
||||
1 0
|
||||
2 1
|
||||
3 0
|
||||
4 0
|
||||
5 0
|
||||
6 0
|
||||
connection server_2;
|
||||
include/sync_with_master_gtid.inc
|
||||
# The gtid states on server_2 must be equal to ...
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-1,10-1-5,20-1-3
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
Variable_name Value
|
||||
gtid_slave_pos 0-2-1,10-1-5,20-1-3
|
||||
SELECT * from t1;
|
||||
a b
|
||||
1 0
|
||||
2 1
|
||||
3 0
|
||||
4 0
|
||||
5 0
|
||||
6 0
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
connection server_1;
|
||||
DROP TABLE t1;
|
||||
include/save_master_gtid.inc
|
||||
connection server_2;
|
||||
include/sync_with_master_gtid.inc
|
||||
connection server_1;
|
||||
include/stop_slave.inc
|
||||
set @@global.rpl_semi_sync_master_enabled = default;
|
||||
set @@global.rpl_semi_sync_slave_enabled = default;
|
||||
set @@global.rpl_semi_sync_master_wait_point=default;
|
||||
DROP TABLE t1;
|
||||
set @@global.gtid_ignore_duplicates = default;
|
||||
set @@global.gtid_strict_mode = default;
|
||||
connection server_2;
|
||||
include/stop_slave.inc
|
||||
set @@global.gtid_ignore_duplicates = default;
|
||||
set @@global.rpl_semi_sync_master_enabled = default;
|
||||
set @@global.rpl_semi_sync_slave_enabled = default;
|
||||
set @@global.gtid_strict_mode = default;
|
||||
include/start_slave.inc
|
||||
include/rpl_end.inc
|
||||
|
@@ -3,6 +3,7 @@ include/master-slave.inc
|
||||
*** Test that we check against incorrect table definition for mysql.gtid_slave_pos ***
|
||||
connection master;
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
call mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos:.*");
|
||||
connection slave;
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
@@ -83,16 +84,16 @@ ERROR 25000: You are not allowed to execute this command in a transaction
|
||||
ROLLBACK;
|
||||
SET GLOBAL gtid_strict_mode= 1;
|
||||
SET GLOBAL gtid_slave_pos = "0-1-1";
|
||||
ERROR HY000: Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
ERROR HY000: Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
SET GLOBAL gtid_slave_pos = "";
|
||||
ERROR HY000: Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
ERROR HY000: Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
SET GLOBAL gtid_strict_mode= 0;
|
||||
SET GLOBAL gtid_slave_pos = "0-1-1";
|
||||
Warnings:
|
||||
Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
SET GLOBAL gtid_slave_pos = "";
|
||||
Warnings:
|
||||
Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
|
||||
RESET MASTER;
|
||||
SET GLOBAL gtid_slave_pos = "0-1-1";
|
||||
START SLAVE;
|
||||
|
@@ -1,7 +1,12 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*");
|
||||
call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size.* ");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size.* ");
|
||||
call mtr.add_suppression("Incident event write to the binary log file failed");
|
||||
call mtr.add_suppression("handlerton rollback failed");
|
||||
"*********** Annotate Event write failure **************"
|
||||
SET GLOBAL max_binlog_cache_size = 4096;
|
||||
SET GLOBAL binlog_cache_size = 4096;
|
||||
SET GLOBAL max_binlog_stmt_cache_size = 4096;
|
||||
@@ -10,12 +15,212 @@ disconnect master;
|
||||
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
|
||||
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM;
|
||||
connection master;
|
||||
ERROR HY000: Writing one row to the row-based binary log failed
|
||||
"#######################################################################"
|
||||
"# Test Case1: Annotate event write failure for MyISAM #"
|
||||
"#######################################################################"
|
||||
ERROR HY000: Multi-row statements required more than 'max_binlog_stmt_cache_size' bytes of storage.
|
||||
# Validating update was not binlogged..
|
||||
# ..success
|
||||
# Validating that the inserted data was saved on the master..
|
||||
# ..success
|
||||
connection slave;
|
||||
include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
|
||||
# Validating that the insert was not replicated to the slave..
|
||||
# ..success
|
||||
"#######################################################################"
|
||||
"# Test Case2: Annotate event write failure for INNODB #"
|
||||
"#######################################################################"
|
||||
connection master;
|
||||
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
# Validating binlog GTID position progressed from first insert..
|
||||
# ..success
|
||||
# Validating that only the first insert into t2 saved..
|
||||
# ..success
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
include/sync_with_master_gtid.inc
|
||||
# Validating the first insert into t2 replicated to slave..
|
||||
include/diff_tables.inc [master:test.t2,slave:test.t2]
|
||||
# ..success
|
||||
"#######################################################################"
|
||||
"# Test Case3: Annotate event write failure for mixed engine UPDATE #"
|
||||
"#######################################################################"
|
||||
connection master;
|
||||
ERROR HY000: Multi-row statements required more than 'max_binlog_stmt_cache_size' bytes of storage.
|
||||
# Validating update was not binlogged..
|
||||
# ..success
|
||||
# Validating non-transactional part of update saved..
|
||||
# ..success
|
||||
# Validating transactional part of update was rolled back..
|
||||
# ..success
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
|
||||
# Validating the rolled-back multi-engine update did not replicate to slave at all..
|
||||
# ..success
|
||||
connection master;
|
||||
"****** Clean up *******"
|
||||
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
|
||||
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
|
||||
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
|
||||
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1,t2;
|
||||
"*********** TABLE MAP Event write failure **************"
|
||||
CREATE TABLE tm (f INT) ENGINE=MYISAM;
|
||||
CREATE TABLE ti (f INT) ENGINE=INNODB;
|
||||
INSERT INTO tm VALUES (10);
|
||||
INSERT INTO ti VALUES (20);
|
||||
connection slave;
|
||||
"#######################################################################"
|
||||
"# Test Case4: Table_map event write failure for trans engine UPDATE #"
|
||||
"#######################################################################"
|
||||
# Transaction should be rolled back without writing incident event
|
||||
connection master;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
UPDATE ti, tm set ti.f=30;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
# Validating update was not binlogged..
|
||||
# ..success
|
||||
# Validating update was rolled back from storage engines..
|
||||
# ..success
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
include/sync_with_master_gtid.inc
|
||||
"#######################################################################"
|
||||
"# Test Case5: Table_map event write failure for mixed engine UPDATE #"
|
||||
"#######################################################################"
|
||||
connection master;
|
||||
# In case of mixed engines if non trans table is updated write INCIDENT event
|
||||
UPDATE ti,tm SET tm.f=88, ti.f=120;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
# Validating update was not binlogged..
|
||||
# ..success
|
||||
# Validating that only the non-transactional update saved on master..
|
||||
# ..success
|
||||
connection slave;
|
||||
include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
|
||||
# Validating that neither of the updates replicated to slave..
|
||||
# ..success
|
||||
"#######################################################################"
|
||||
"# Test Case6: Committing a transaction consisting of two updates:
|
||||
"# S1) Update transactional table
|
||||
"# S2) Update transactional table
|
||||
"# with a table_map event write failure on the second event should
|
||||
"# roll-back only the second update without incident
|
||||
"#######################################################################"
|
||||
connection master;
|
||||
SET debug_dbug="";
|
||||
BEGIN;
|
||||
UPDATE ti, tm set ti.f=40;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
UPDATE ti, tm set ti.f=50;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
COMMIT;
|
||||
# Validating binlog GTID position progressed from first update..
|
||||
# ..success
|
||||
# Validating the first update saved..
|
||||
# ..and that the second update did not save..
|
||||
# ..success
|
||||
# Validating that only the first update replicated to slave without incident
|
||||
connection master;
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
include/sync_with_master_gtid.inc
|
||||
include/diff_tables.inc [master:test.ti,slave:test.ti]
|
||||
"#######################################################################"
|
||||
"# Test Case7: Rolling back a transaction consisting of two updates:
|
||||
"# S1) Update transactional table
|
||||
"# S2) Update transactional table
|
||||
"# with a table_map event write failure on the second event should
|
||||
"# roll-back both updates without incident
|
||||
"#######################################################################"
|
||||
connection master;
|
||||
SET debug_dbug="";
|
||||
BEGIN;
|
||||
UPDATE ti, tm set ti.f=60;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
UPDATE ti, tm set ti.f=70;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
ROLLBACK;
|
||||
# Validating update was not binlogged..
|
||||
# ..success
|
||||
# Validating that neither update saved on master..
|
||||
# ..success
|
||||
# Validating the transaction did not replicate to the slave
|
||||
connection master;
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
include/sync_with_master_gtid.inc
|
||||
include/diff_tables.inc [master:test.ti,slave:test.ti]
|
||||
"#######################################################################"
|
||||
"# Test Case8: Committing a transaction consisting of two updates:
|
||||
"# S1) Update transactional table
|
||||
"# S2) Update mixed trans/non-trans tables
|
||||
"# with a table_map event write failure on the second event should
|
||||
"# roll-back only the second update with incident
|
||||
"#######################################################################"
|
||||
connection master;
|
||||
BEGIN;
|
||||
SET debug_dbug="";
|
||||
UPDATE ti, tm set ti.f=80;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
UPDATE ti, tm set ti.f=90,tm.f=99;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
COMMIT;
|
||||
# Validating binlog GTID position progressed from first update..
|
||||
# ..success
|
||||
# Validating the first update saved..
|
||||
# ..and the transactional part of the second update did not save..
|
||||
# ..whereas the non-trans part of the second update did save..
|
||||
# ..success
|
||||
# Validating that the incident propagated to the slave
|
||||
connection slave;
|
||||
include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
|
||||
# Validating that the first update replicated to the slave..
|
||||
# ..and neither part of the second update replicated..
|
||||
# ..success
|
||||
"#######################################################################"
|
||||
"# Test Case9: Rolling back a transaction consisting of two updates:
|
||||
"# S1) Update transactional table
|
||||
"# S2) Update mixed trans/non-trans tables
|
||||
"# with a table_map event write failure on the second event should
|
||||
"# roll-back both transactional updates, preserve the non-transactional
|
||||
"# update on the master (only), and write an incident event
|
||||
"#######################################################################"
|
||||
connection master;
|
||||
SET debug_dbug="";
|
||||
BEGIN;
|
||||
UPDATE ti, tm set ti.f=100;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
UPDATE ti, tm set ti.f=110,tm.f=111;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
ROLLBACK;
|
||||
# Validating update was not binlogged..
|
||||
# ..success
|
||||
# Validating trans updates rollback, but the non-trans update stays..
|
||||
# ..success
|
||||
# Validating that the incident propagated to the slave
|
||||
connection slave;
|
||||
include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
|
||||
# Validating that none of the updates replicated to the slave
|
||||
include/diff_tables.inc [master:test.ti,slave:test.ti]
|
||||
# ..success
|
||||
"#######################################################################"
|
||||
"# Test Case10: If an incident event fails to write, a specific error
|
||||
"# should be logged
|
||||
"#
|
||||
"# Note: This test case is the same as test case 5, with the caveat of
|
||||
"# the incident event failing to write.
|
||||
"#######################################################################"
|
||||
connection master;
|
||||
SET debug_dbug="d,table_map_write_error,incident_event_write_error";
|
||||
UPDATE ti, tm set ti.f=120, tm.f=122;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
# Validate error message indicating incident event failed to write
|
||||
FOUND 1 /Incident event write to the binary log file failed/ in mysqld.1.err
|
||||
connection master;
|
||||
"******** Clean Up **********"
|
||||
SET GLOBAL debug_dbug = '';
|
||||
DROP TABLE tm,ti;
|
||||
include/rpl_end.inc
|
||||
|
@@ -1,6 +1,8 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size");
|
||||
SET GLOBAL max_binlog_cache_size = 4096;
|
||||
SET GLOBAL binlog_cache_size = 4096;
|
||||
SET GLOBAL max_binlog_stmt_cache_size = 4096;
|
||||
|
2290
mysql-test/suite/rpl/r/rpl_row_img_sequence.result
Normal file
2290
mysql-test/suite/rpl/r/rpl_row_img_sequence.result
Normal file
File diff suppressed because it is too large
Load Diff
@@ -70,6 +70,9 @@ INSERT INTO t1 VALUES (3, 'dummy3');
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-5
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
Variable_name Value
|
||||
gtid_binlog_state 0-1-4,0-2-5
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
Variable_name Value
|
||||
gtid_slave_pos 0-1-4
|
||||
@@ -84,12 +87,15 @@ gtid_slave_pos 0-2-5
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-5
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
Variable_name Value
|
||||
gtid_binlog_state 0-1-4,0-2-5
|
||||
connection server_2;
|
||||
#
|
||||
# Case:2
|
||||
#
|
||||
# CRASH the new master, and FAILOVER back to the original
|
||||
# INSERT INTO t1 VALUES (4, REPEAT("x", 4100))
|
||||
# SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100))
|
||||
# INSERT INTO t1 VALUES (5, REPEAT("x", 4100))
|
||||
# Rows 4 and 5 will be in master's binlog but not committed, they get
|
||||
# replicated to slave and applied. On crash master should have 3 rows
|
||||
@@ -98,14 +104,14 @@ connection server_2;
|
||||
# Expected State post crash:
|
||||
#=================================================================
|
||||
# Master | Slave |
|
||||
# 0-2-6 (Not commited) | 0-2-6 (Received through semi-sync |
|
||||
# 0-1-6 (Not commited) | 0-1-6 (Received through semi-sync |
|
||||
# | replication and applied) |
|
||||
# 0-2-7 (Not commited) | 0-2-7 (Received through semi-sync |
|
||||
# | replication and applied) |
|
||||
#=================================================================
|
||||
connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_2,;
|
||||
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go";
|
||||
INSERT INTO t1 VALUES (4, REPEAT("x", 4100));
|
||||
SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100));
|
||||
connect conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
||||
SET GLOBAL debug_dbug="d,Notify_binlog_EOF";
|
||||
@@ -123,7 +129,7 @@ SELECT @@GLOBAL.gtid_current_pos;
|
||||
# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1
|
||||
connection server_2;
|
||||
include/assert.inc [Table t1 should have 3 rows.]
|
||||
FOUND 1 /truncated binlog file:.*slave.*000002/ in mysqld.2.err
|
||||
FOUND 1 /truncated binlog file:.*slave.*000002.* to remove transactions starting from GTID 0-1-6/ in mysqld.2.err
|
||||
disconnect conn_client;
|
||||
connection server_1;
|
||||
set global rpl_semi_sync_master_enabled = 1;
|
||||
@@ -134,7 +140,7 @@ set global rpl_semi_sync_slave_enabled = 1;
|
||||
set @@global.gtid_slave_pos=@@global.gtid_binlog_pos;
|
||||
include/start_slave.inc
|
||||
#
|
||||
# Server_1 promoted as master will send 0-2-6 and 0-2-7 to slave Server_2
|
||||
# Server_1 promoted as master will send 0-1-6 and 0-2-7 to slave Server_2
|
||||
#
|
||||
connection server_1;
|
||||
INSERT INTO t1 VALUES (6, 'dummy6');
|
||||
@@ -142,6 +148,9 @@ INSERT INTO t1 VALUES (6, 'dummy6');
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-1-8
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
Variable_name Value
|
||||
gtid_binlog_state 0-2-7,0-1-8
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
Variable_name Value
|
||||
gtid_slave_pos 0-2-7
|
||||
@@ -156,6 +165,9 @@ gtid_slave_pos 0-1-8
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-1-8
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
Variable_name Value
|
||||
gtid_binlog_state 0-2-7,0-1-8
|
||||
include/diff_tables.inc [server_1:t1, server_2:t1]
|
||||
connection server_1;
|
||||
#
|
||||
@@ -196,7 +208,7 @@ SELECT @@GLOBAL.gtid_current_pos;
|
||||
# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1
|
||||
connection server_1;
|
||||
include/assert.inc [Table t1 should have 6 rows.]
|
||||
NOT FOUND /truncated binlog file:.*master.*000003/ in mysqld.1.err
|
||||
FOUND 1 /truncated binlog file:.*master.*000002.* to remove transactions starting from GTID 0-1-9/ in mysqld.1.err
|
||||
disconnect conn_client;
|
||||
connection server_2;
|
||||
set global rpl_semi_sync_master_enabled = 1;
|
||||
@@ -216,6 +228,9 @@ include/save_master_gtid.inc
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-10
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
Variable_name Value
|
||||
gtid_binlog_state 0-1-9,0-2-10
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
Variable_name Value
|
||||
gtid_slave_pos 0-1-9
|
||||
@@ -231,6 +246,9 @@ gtid_slave_pos 0-2-10
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
Variable_name Value
|
||||
gtid_binlog_pos 0-2-10
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
Variable_name Value
|
||||
gtid_binlog_state 0-1-9,0-2-10
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
|
@@ -1,6 +1,8 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size");
|
||||
SET GLOBAL max_binlog_cache_size = 4096;
|
||||
SET GLOBAL binlog_cache_size = 4096;
|
||||
SET GLOBAL max_binlog_stmt_cache_size = 4096;
|
||||
|
@@ -1,115 +1,188 @@
|
||||
# ==== References ====
|
||||
#
|
||||
# MDEV-27760 event may non stop replicate in circular semisync setup
|
||||
#
|
||||
# MDEV-28609 refine gtid-strict-mode to ignore same server-id gtid from the past
|
||||
# on semisync slave
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
# The following tests prove
|
||||
# A. out-of-order gtid error when the stict gtid mode semisync slave
|
||||
# receives the same server-id gtid event inconsistent
|
||||
# (rpl_semi_sync_fail_over tests the consistent case) with its state;
|
||||
# B. in the non-strict mode the same server-id events remains ignored
|
||||
# by default as usual.
|
||||
#
|
||||
--echo # Master server_1 and Slave server_2 initialiation ...
|
||||
# A.
|
||||
# no out-of-order gtid error is done to the stict gtid mode semisync
|
||||
# slave receives the same server-id gtid event from the past (of its gtid
|
||||
# state). Such transaction is silently ignored similarly to
|
||||
# replicate_same_sever_id; and
|
||||
# B.
|
||||
# In contrast to A. the out-of-order gtid error is thrown when a "foreign"
|
||||
# server-id transaction makes its round-trip to the originator server.
|
||||
|
||||
--echo # Master server_1 and Slave server_2 initialization ...
|
||||
--connection server_2
|
||||
--source include/stop_slave.inc
|
||||
|
||||
# Initial master
|
||||
--connection server_1
|
||||
set @@sql_log_bin = off;
|
||||
call mtr.add_suppression("Slave: An attempt was made to binlog GTID 10-1-1 which would create an out-of-order sequence number with existing GTID");
|
||||
set @@sql_log_bin = on;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
set @@session.gtid_domain_id=10;
|
||||
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
|
||||
|
||||
--connection server_2
|
||||
RESET MASTER;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
|
||||
set @@session.gtid_domain_id=20;
|
||||
|
||||
set @@global.rpl_semi_sync_slave_enabled = 1;
|
||||
--echo # a 1948 warning is expected
|
||||
set @@global.gtid_slave_pos = "";
|
||||
CHANGE MASTER TO master_use_gtid= slave_pos;
|
||||
--source include/start_slave.inc
|
||||
--echo # ... server_1 -> server_2 is set up
|
||||
--echo # server_1 -> server_2 semisync link is set up.
|
||||
|
||||
--connection server_1
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=Innodb;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--save_master_pos
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT default 0) ENGINE=Innodb;
|
||||
INSERT INTO t1(a) VALUES (1);
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2
|
||||
--sync_with_master
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
--echo # Circular configuration server_2 -> server_1 initialiation ...
|
||||
--echo # Circular configuration server_1 -> server_2 -> server_1 ...
|
||||
--connection server_1
|
||||
--echo # A. ... first when server_1 is in gtid strict mode...
|
||||
set @@global.gtid_strict_mode = true;
|
||||
set @@global.rpl_semi_sync_slave_enabled = 1;
|
||||
|
||||
evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root', master_use_gtid=SLAVE_POS;
|
||||
|
||||
--echo # ... only for it to fail 'cos if its inconsistent (empty) slave's gtid state:
|
||||
SELECT @@global.gtid_slave_pos;
|
||||
START SLAVE;
|
||||
# ER_GTID_STRICT_OUT_OF_ORDER
|
||||
--let $slave_sql_errno = 1950
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
--echo # B. ... Resume on the circular setup with the server_id now in the non-strict mode ...
|
||||
set @@global.gtid_strict_mode = false;
|
||||
--source include/start_slave.inc
|
||||
--echo ... is done.
|
||||
|
||||
--echo # ... to have succeeded.
|
||||
--echo ## A. no out-of-order gtid error for own transaction made round trip
|
||||
|
||||
--connection server_2
|
||||
INSERT INTO t1 VALUES (2);
|
||||
--save_master_pos
|
||||
|
||||
--connection server_1
|
||||
--sync_with_master
|
||||
|
||||
INSERT INTO t1 VALUES (3);
|
||||
--save_master_pos
|
||||
|
||||
--connection server_2
|
||||
--sync_with_master
|
||||
--echo # The gtid states on server_2 must be equal to ...
|
||||
# A0. server_1 has already originated the transaction
|
||||
--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos
|
||||
--source include/wait_condition.inc
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
|
||||
# A1. server_2 originates
|
||||
--connection server_2
|
||||
set @@global.gtid_strict_mode = true;
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
INSERT INTO t1(a) VALUES (2);
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_1
|
||||
--echo #
|
||||
--echo # the successful sync is a required proof
|
||||
--echo #
|
||||
--source include/sync_with_master_gtid.inc
|
||||
# A2. server_1 is originating now
|
||||
update t1 set b=b+1 where a=2;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
--echo # Post-execution state check on both servers synchronized with each other
|
||||
--connection server_1
|
||||
--echo # ... the gtid states on server_1
|
||||
--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos
|
||||
--source include/wait_condition.inc
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SELECT * from t1;
|
||||
|
||||
--connection server_2
|
||||
--echo # The gtid states on server_2 must be equal to ...
|
||||
--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos
|
||||
--source include/wait_condition.inc
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
SELECT * from t1;
|
||||
|
||||
--echo ## B. out-of-order gtid error for a "foreign" server-id transaction
|
||||
# B1. circulation starts from server_1
|
||||
|
||||
--connection server_1
|
||||
set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 10-2-4");
|
||||
set @@session.server_id=2;
|
||||
INSERT INTO t1(a) VALUES (3);
|
||||
set @@session.server_id=default;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2
|
||||
--source include/sync_with_master_gtid.inc
|
||||
INSERT INTO t1(a) VALUES (4);
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_1
|
||||
--let $slave_sql_errno = 1950
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
set sql_slave_skip_counter=1;
|
||||
--source include/start_slave.inc
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
# B2. circulation starts from server_2
|
||||
--connection server_2
|
||||
set statement sql_log_bin=0 for call mtr.add_suppression("Slave: An attempt was made to binlog GTID 20-1-3");
|
||||
set @@session.server_id=1;
|
||||
INSERT INTO t1(a) VALUES (5);
|
||||
set @@session.server_id=default;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_1
|
||||
--source include/sync_with_master_gtid.inc
|
||||
INSERT INTO t1(a) VALUES (6);
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
|
||||
--connection server_2
|
||||
--let $slave_sql_errno = 1950
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
set sql_slave_skip_counter=1;
|
||||
--source include/start_slave.inc
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
--echo # Post-execution state check on both servers synchronized with each other
|
||||
--connection server_1
|
||||
--echo # ... the gtid states on server_1
|
||||
--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos
|
||||
--source include/wait_condition.inc
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SELECT * from t1;
|
||||
|
||||
--connection server_2
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--echo # The gtid states on server_2 must be equal to ...
|
||||
--let $wait_condition=select @@gtid_slave_pos=@@gtid_binlog_pos
|
||||
--source include/wait_condition.inc
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
SELECT * from t1;
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
--connection server_1
|
||||
DROP TABLE t1;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_2
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
--connection server_1
|
||||
--source include/stop_slave.inc
|
||||
set @@global.rpl_semi_sync_master_enabled = default;
|
||||
set @@global.rpl_semi_sync_slave_enabled = default;
|
||||
set @@global.rpl_semi_sync_master_wait_point=default;
|
||||
|
||||
DROP TABLE t1;
|
||||
--save_master_pos
|
||||
set @@global.gtid_ignore_duplicates = default;
|
||||
set @@global.gtid_strict_mode = default;
|
||||
|
||||
--connection server_2
|
||||
--sync_with_master
|
||||
--source include/stop_slave.inc
|
||||
set @@global.gtid_ignore_duplicates = default;
|
||||
set @@global.rpl_semi_sync_master_enabled = default;
|
||||
set @@global.rpl_semi_sync_slave_enabled = default;
|
||||
set @@global.gtid_strict_mode = default;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
@@ -5,6 +5,7 @@
|
||||
--echo *** Test that we check against incorrect table definition for mysql.gtid_slave_pos ***
|
||||
--connection master
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
call mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos:.*");
|
||||
--sync_slave_with_master
|
||||
|
||||
--connection slave
|
||||
|
@@ -1,3 +1,4 @@
|
||||
--source include/have_debug.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/not_windows.inc
|
||||
@@ -6,13 +7,19 @@
|
||||
|
||||
########################################################################################
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*");
|
||||
call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size.* ");
|
||||
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size.* ");
|
||||
call mtr.add_suppression("Incident event write to the binary log file failed");
|
||||
call mtr.add_suppression("handlerton rollback failed");
|
||||
|
||||
let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
|
||||
let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1);
|
||||
let $old_max_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_stmt_cache_size", Value, 1);
|
||||
let $old_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_stmt_cache_size", Value, 1);
|
||||
|
||||
--echo "*********** Annotate Event write failure **************"
|
||||
|
||||
SET GLOBAL max_binlog_cache_size = 4096;
|
||||
SET GLOBAL binlog_cache_size = 4096;
|
||||
SET GLOBAL max_binlog_stmt_cache_size = 4096;
|
||||
@@ -26,19 +33,162 @@ let $data = `select concat('"', repeat('a',2000), '"')`;
|
||||
|
||||
connection master;
|
||||
|
||||
# Insert a huge row into MyISAM table. The row will be inserted in engine and a
|
||||
# request to write to binary log will be initiated. Since row annotations are
|
||||
# enabled the size of the annotate event itself will exceed the
|
||||
# "max_binlog_stmt_cache_size". This will result in ER_STMT_CACHE_FULL error
|
||||
# and an incident event will be written to the binary log as row update in
|
||||
# engine cannot be undone.
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case1: Annotate event write failure for MyISAM #"
|
||||
--echo "#######################################################################"
|
||||
|
||||
--disable_query_log
|
||||
--error ER_BINLOG_ROW_LOGGING_FAILED
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--error ER_STMT_CACHE_FULL
|
||||
eval INSERT INTO t1 (a, data) VALUES (2,
|
||||
CONCAT($data, $data, $data, $data, $data, $data));
|
||||
--enable_query_log
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating update was not binlogged..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`)
|
||||
{
|
||||
--die Binlog GTID position should have been unchanged after failed update
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating that the inserted data was saved on the master..
|
||||
if(`SELECT COUNT(*)!=1 FROM t1`)
|
||||
{
|
||||
--die The insertion should have saved on a non-transactional table
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--connection slave
|
||||
# Incident event
|
||||
# 1590=ER_SLAVE_INCIDENT
|
||||
--let $slave_sql_errno= 1590
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo # Validating that the insert was not replicated to the slave..
|
||||
if(`SELECT COUNT(*) FROM t1`)
|
||||
{
|
||||
--die The insertion should not have replicated to the slave
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
# MDEV-21087
|
||||
# Insert two huge rows in to transaction cache. Have data such that first row
|
||||
# fits inside the binary log cache. While writing the annotate event for the
|
||||
# second row the binary log cache size will exceed "max_binlog_cache_size".
|
||||
# Hence this statement cannot be written to binary log. As DMLs in Innodb can
|
||||
# be safely rolled back only an error will be reported. Slave will continue to
|
||||
# work.
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case2: Annotate event write failure for INNODB #"
|
||||
--echo "#######################################################################"
|
||||
|
||||
--connection master
|
||||
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB;
|
||||
--disable_query_log
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
BEGIN;
|
||||
eval INSERT INTO t2 (a, data) VALUES (1, CONCAT($data, $data));
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
eval INSERT INTO t2 (a, data) VALUES (2, CONCAT($data, $data));
|
||||
COMMIT;
|
||||
--enable_query_log
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating binlog GTID position progressed from first insert..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") = 0`)
|
||||
{
|
||||
--die Binlog GTID position should have updated
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating that only the first insert into t2 saved..
|
||||
if(`SELECT COUNT(*)!=1 FROM t2`)
|
||||
{
|
||||
--die Only one row should exist in t2 from the first insert, the second should have rolled back
|
||||
}
|
||||
--echo # ..success
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection slave
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--echo # Validating the first insert into t2 replicated to slave..
|
||||
--let $diff_tables= master:test.t2,slave:test.t2
|
||||
--source include/diff_tables.inc
|
||||
--echo # ..success
|
||||
|
||||
# Testing mixed engine UPDATE statement scenario. In the following multi
|
||||
# update query 'ha_update_row' will be invoked for t1 (myisam) table. This
|
||||
# intern invokes binlog_write_table_map() function call. While writing a huge
|
||||
# annotate event binary log cache size will exceed max_binlog_cache_size.
|
||||
# Writing to binary log fails. Since non transactional changes cannot be
|
||||
# rolled back incident event will be written to binary log.
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case3: Annotate event write failure for mixed engine UPDATE #"
|
||||
--echo "#######################################################################"
|
||||
|
||||
--connection master
|
||||
let $new_data = `select concat('"', repeat('b',2000), '"')`;
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--disable_query_log
|
||||
--error ER_STMT_CACHE_FULL
|
||||
eval UPDATE t1,t2 SET t1.data="Hello", t2.data=CONCAT($new_data,$new_data,$new_data,$new_data,$new_data);
|
||||
--enable_query_log
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating update was not binlogged..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`)
|
||||
{
|
||||
--die Binlog GTID position should have been unchanged after failed update
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating non-transactional part of update saved..
|
||||
if(`SELECT COUNT(*)!=1 from t1 where data="Hello"`)
|
||||
{
|
||||
--die Non-transactional part of update should have saved
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating transactional part of update was rolled back..
|
||||
if(`SELECT COUNT(*) from t2 where data LIKE "b%"`)
|
||||
{
|
||||
--die Transactional part of update should have been rolled back
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection slave
|
||||
|
||||
# Incident event
|
||||
# 1590=ER_SLAVE_INCIDENT
|
||||
--let $slave_sql_errno= 1590
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
connection master;
|
||||
--echo # Validating the rolled-back multi-engine update did not replicate to slave at all..
|
||||
if(`SELECT COUNT(*) from t1 where data="Hello"`)
|
||||
{
|
||||
--die Non-transactional part of update should not have replicated
|
||||
}
|
||||
if(`SELECT COUNT(*) from t2 where data LIKE "b%"`)
|
||||
{
|
||||
--die Transactional part of update should not have replicated
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--connection master
|
||||
|
||||
--echo "****** Clean up *******"
|
||||
--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
|
||||
--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
|
||||
--replace_result $old_binlog_cache_size ORIGINAL_VALUE
|
||||
@@ -48,6 +198,346 @@ connection master;
|
||||
--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
|
||||
--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo "*********** TABLE MAP Event write failure **************"
|
||||
|
||||
--let $debug_save= `SELECT @@GLOBAL.debug_dbug`
|
||||
CREATE TABLE tm (f INT) ENGINE=MYISAM;
|
||||
CREATE TABLE ti (f INT) ENGINE=INNODB;
|
||||
INSERT INTO tm VALUES (10);
|
||||
INSERT INTO ti VALUES (20);
|
||||
--sync_slave_with_master
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case4: Table_map event write failure for trans engine UPDATE #"
|
||||
--echo "#######################################################################"
|
||||
--echo # Transaction should be rolled back without writing incident event
|
||||
--connection master
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
UPDATE ti, tm set ti.f=30;
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating update was not binlogged..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`)
|
||||
{
|
||||
--die Binlog GTID position should have been unchanged after failed update
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating update was rolled back from storage engines..
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=130`)
|
||||
{
|
||||
--die Update for InnoDB table should not have saved
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection slave
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case5: Table_map event write failure for mixed engine UPDATE #"
|
||||
--echo "#######################################################################"
|
||||
--connection master
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # In case of mixed engines if non trans table is updated write INCIDENT event
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
UPDATE ti,tm SET tm.f=88, ti.f=120;
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating update was not binlogged..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`)
|
||||
{
|
||||
--die Binlog GTID position should have been unchanged after failed update
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating that only the non-transactional update saved on master..
|
||||
if(`SELECT COUNT(*)!=1 FROM tm WHERE f=88`)
|
||||
{
|
||||
--die Update for MyISAM table should have saved
|
||||
}
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=120`)
|
||||
{
|
||||
--die Update for InnoDB table should not have saved
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
|
||||
--connection slave
|
||||
# Incident event
|
||||
# 1590=ER_SLAVE_INCIDENT
|
||||
--let $slave_sql_errno= 1590
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo # Validating that neither of the updates replicated to slave..
|
||||
if(`SELECT COUNT(*) FROM tm WHERE f=88`)
|
||||
{
|
||||
--die Update for MyISAM table should not have replicated to slave
|
||||
}
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=120`)
|
||||
{
|
||||
--die Update for InnoDB table should not have replicated to slave
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case6: Committing a transaction consisting of two updates:
|
||||
--echo "# S1) Update transactional table
|
||||
--echo "# S2) Update transactional table
|
||||
--echo "# with a table_map event write failure on the second event should
|
||||
--echo "# roll-back only the second update without incident
|
||||
--echo "#######################################################################"
|
||||
--connection master
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
|
||||
SET debug_dbug="";
|
||||
BEGIN;
|
||||
# successful update
|
||||
UPDATE ti, tm set ti.f=40;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
UPDATE ti, tm set ti.f=50;
|
||||
COMMIT;
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating binlog GTID position progressed from first update..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") = 0`)
|
||||
{
|
||||
--die Binlog GTID position should have updated
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating the first update saved..
|
||||
if(`SELECT COUNT(*)!=1 FROM ti WHERE f=40`)
|
||||
{
|
||||
--die The first update should have saved because it was transactional
|
||||
}
|
||||
--echo # ..and that the second update did not save..
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=50`)
|
||||
{
|
||||
--die The second update should have rolled back because it failed
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating that only the first update replicated to slave without incident
|
||||
--connection master
|
||||
--source include/save_master_gtid.inc
|
||||
--connection slave
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--let $diff_tables= master:test.ti,slave:test.ti
|
||||
--source include/diff_tables.inc
|
||||
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case7: Rolling back a transaction consisting of two updates:
|
||||
--echo "# S1) Update transactional table
|
||||
--echo "# S2) Update transactional table
|
||||
--echo "# with a table_map event write failure on the second event should
|
||||
--echo "# roll-back both updates without incident
|
||||
--echo "#######################################################################"
|
||||
--connection master
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
|
||||
SET debug_dbug="";
|
||||
BEGIN;
|
||||
# successful update
|
||||
UPDATE ti, tm set ti.f=60;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
UPDATE ti, tm set ti.f=70;
|
||||
ROLLBACK;
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating update was not binlogged..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`)
|
||||
{
|
||||
--die Binlog GTID position should have been unchanged after failed update
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating that neither update saved on master..
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=60`)
|
||||
{
|
||||
--die The first update should not have saved
|
||||
}
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=70`)
|
||||
{
|
||||
--die The second update should not have saved
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating the transaction did not replicate to the slave
|
||||
--connection master
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection slave
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--let $diff_tables= master:test.ti,slave:test.ti
|
||||
--source include/diff_tables.inc
|
||||
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case8: Committing a transaction consisting of two updates:
|
||||
--echo "# S1) Update transactional table
|
||||
--echo "# S2) Update mixed trans/non-trans tables
|
||||
--echo "# with a table_map event write failure on the second event should
|
||||
--echo "# roll-back only the second update with incident
|
||||
--echo "#######################################################################"
|
||||
--connection master
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
|
||||
BEGIN;
|
||||
# successful update
|
||||
SET debug_dbug="";
|
||||
UPDATE ti, tm set ti.f=80;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
UPDATE ti, tm set ti.f=90,tm.f=99;
|
||||
COMMIT;
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating binlog GTID position progressed from first update..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") = 0`)
|
||||
{
|
||||
--die Binlog GTID position should have updated
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating the first update saved..
|
||||
if(`SELECT COUNT(*)!=1 FROM ti WHERE f=80`)
|
||||
{
|
||||
--die The first update should have saved because it was transactional
|
||||
}
|
||||
--echo # ..and the transactional part of the second update did not save..
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=90`)
|
||||
{
|
||||
--die The transactional part of the second update should have rolled back because it failed
|
||||
}
|
||||
--echo # ..whereas the non-trans part of the second update did save..
|
||||
if(`SELECT COUNT(*)!=1 FROM tm WHERE f=99`)
|
||||
{
|
||||
--die The non-trans part from the second update should have saved
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating that the incident propagated to the slave
|
||||
--connection slave
|
||||
# Incident event
|
||||
# 1590=ER_SLAVE_INCIDENT
|
||||
--let $slave_sql_errno= 1590
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo # Validating that the first update replicated to the slave..
|
||||
if(`SELECT COUNT(*)!=1 FROM ti WHERE f=80`)
|
||||
{
|
||||
--die The first update should have replicated because it was transactional
|
||||
}
|
||||
--echo # ..and neither part of the second update replicated..
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=90`)
|
||||
{
|
||||
--die The trans part from the second update should not have replicated because it was rolled back
|
||||
}
|
||||
if(`SELECT COUNT(*) FROM tm WHERE f=99`)
|
||||
{
|
||||
--die The non-trans part from the second update should not have replicated because it was not binlogged
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case9: Rolling back a transaction consisting of two updates:
|
||||
--echo "# S1) Update transactional table
|
||||
--echo "# S2) Update mixed trans/non-trans tables
|
||||
--echo "# with a table_map event write failure on the second event should
|
||||
--echo "# roll-back both transactional updates, preserve the non-transactional
|
||||
--echo "# update on the master (only), and write an incident event
|
||||
--echo "#######################################################################"
|
||||
--connection master
|
||||
--let $old_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
|
||||
SET debug_dbug="";
|
||||
BEGIN;
|
||||
# successful update
|
||||
UPDATE ti, tm set ti.f=100;
|
||||
SET debug_dbug="+d,table_map_write_error";
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
UPDATE ti, tm set ti.f=110,tm.f=111;
|
||||
ROLLBACK;
|
||||
|
||||
--let $new_gtid_binlog_pos= query_get_value(SHOW VARIABLES LIKE 'gtid_binlog_pos', Value, 1)
|
||||
--echo # Validating update was not binlogged..
|
||||
if(`SELECT strcmp("$old_gtid_binlog_pos","$new_gtid_binlog_pos") != 0`)
|
||||
{
|
||||
--die Binlog GTID position should have been unchanged after failed update
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating trans updates rollback, but the non-trans update stays..
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=100`)
|
||||
{
|
||||
--die The first update should not have saved
|
||||
}
|
||||
if(`SELECT COUNT(*) FROM ti WHERE f=110`)
|
||||
{
|
||||
--die The transactional part of the second update should not have saved
|
||||
}
|
||||
if(`SELECT COUNT(*)!=1 FROM tm WHERE f=111`)
|
||||
{
|
||||
--die The non-trans part of the second update should have saved
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
--echo # Validating that the incident propagated to the slave
|
||||
--connection slave
|
||||
# Incident event
|
||||
# 1590=ER_SLAVE_INCIDENT
|
||||
--let $slave_sql_errno= 1590
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
|
||||
--echo # Validating that none of the updates replicated to the slave
|
||||
--let $diff_tables= master:test.ti,slave:test.ti
|
||||
--source include/diff_tables.inc
|
||||
if(`SELECT COUNT(*) FROM tm WHERE f=111`)
|
||||
{
|
||||
--die The non-trans part from the second update should not have replicated because it was not binlogged
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
|
||||
--echo "#######################################################################"
|
||||
--echo "# Test Case10: If an incident event fails to write, a specific error
|
||||
--echo "# should be logged
|
||||
--echo "#
|
||||
--echo "# Note: This test case is the same as test case 5, with the caveat of
|
||||
--echo "# the incident event failing to write.
|
||||
--echo "#######################################################################"
|
||||
|
||||
--connection master
|
||||
SET debug_dbug="d,table_map_write_error,incident_event_write_error";
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
UPDATE ti, tm set ti.f=120, tm.f=122;
|
||||
|
||||
--echo # Validate error message indicating incident event failed to write
|
||||
let $log_error_= `SELECT @@GLOBAL.log_error`;
|
||||
if(!$log_error_)
|
||||
{
|
||||
# MySQL Server on windows is started with --console and thus
|
||||
# does not know the location of its .err log, use default location
|
||||
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
}
|
||||
--let SEARCH_PATTERN= Incident event write to the binary log file failed
|
||||
--let SEARCH_FILE= $log_error_
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
|
||||
--connection master
|
||||
--echo "******** Clean Up **********"
|
||||
--eval SET GLOBAL debug_dbug = '$debug_save'
|
||||
DROP TABLE tm,ti;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
21
mysql-test/suite/rpl/t/rpl_row_img_sequence.cnf
Normal file
21
mysql-test/suite/rpl/t/rpl_row_img_sequence.cnf
Normal file
@@ -0,0 +1,21 @@
|
||||
!include include/default_mysqld.cnf
|
||||
|
||||
[mysqld.1]
|
||||
log-slave-updates
|
||||
innodb
|
||||
gtid_domain_id=0
|
||||
|
||||
[mysqld.2]
|
||||
log-slave-updates
|
||||
innodb
|
||||
gtid_domain_id=1
|
||||
|
||||
[mysqld.3]
|
||||
log-slave-updates
|
||||
innodb
|
||||
gtid_domain_id=2
|
||||
|
||||
[ENV]
|
||||
SERVER_MYPORT_1= @mysqld.1.port
|
||||
SERVER_MYPORT_2= @mysqld.2.port
|
||||
SERVER_MYPORT_3= @mysqld.3.port
|
65
mysql-test/suite/rpl/t/rpl_row_img_sequence.test
Normal file
65
mysql-test/suite/rpl/t/rpl_row_img_sequence.test
Normal file
@@ -0,0 +1,65 @@
|
||||
#
|
||||
# Purpose:
|
||||
# This test verifies that sequence DML updates, i.e. NEXTVAL and SETVAL,
|
||||
# respect the binlog_row_image variable value when written into the binary log.
|
||||
# In particular, it ensures that only changed columns are written with MINIMAL
|
||||
# image mode, and all columns are written otherwise.
|
||||
#
|
||||
# Methodology
|
||||
# After issuing a sequence update, ensure that both 1) it was replicated
|
||||
# correctly, and 2) it was binlogged respective to the binlog_row_image value.
|
||||
# The sequence table does not use caching to ensure each update is immediately
|
||||
# binlogged. Each command is binlogged into its own unique log file, and the
|
||||
# entirety of the file is analyzed for correctness of its sequence event.
|
||||
# Specifically, mysqlbinlog is used in verbose mode so it outputs the columns
|
||||
# which belong to the event, and the columns are analyzed to ensure the correct
|
||||
# ones were logged. rpl_row_img_general_loop.inc is used to test with multiple
|
||||
# chained replicas, varying engines between InnoDB and MyISAM.
|
||||
#
|
||||
# References:
|
||||
# MDEV-28487: sequences not respect value of binlog_row_image with select
|
||||
# nextval(seq_gen)
|
||||
#
|
||||
|
||||
--let $rpl_topology= 1->2->3
|
||||
--source include/rpl_init.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
--connection server_1
|
||||
--source include/have_innodb.inc
|
||||
--connection server_2
|
||||
--source include/have_innodb.inc
|
||||
--connection server_3
|
||||
--source include/have_innodb.inc
|
||||
--connection server_1
|
||||
|
||||
--echo #
|
||||
--echo # Test Case 1) binlog_row_image=MINIMAL should write only columns
|
||||
--echo # 1 and 8 to the binary log
|
||||
--echo #
|
||||
--let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
|
||||
--source include/rpl_row_img_set.inc
|
||||
--let $expected_columns=(1,8)
|
||||
--let row_img_test_script= include/rpl_row_img_sequence.inc
|
||||
--source include/rpl_row_img_general_loop.inc
|
||||
|
||||
--echo #
|
||||
--echo # Test Case 2) binlog_row_image=NOBLOB should write all columns to the
|
||||
--echo # binary log
|
||||
--echo #
|
||||
--let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
|
||||
--source include/rpl_row_img_set.inc
|
||||
--let $expected_columns=(1,2,3,4,5,6,7,8)
|
||||
--source include/rpl_row_img_general_loop.inc
|
||||
|
||||
--echo #
|
||||
--echo # Test Case 3) binlog_row_image=NOBLOB should write all columns to the
|
||||
--echo # binary log
|
||||
--echo #
|
||||
--let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
|
||||
--source include/rpl_row_img_set.inc
|
||||
--let $expected_columns=(1,2,3,4,5,6,7,8)
|
||||
--source include/rpl_row_img_general_loop.inc
|
||||
|
||||
--source include/rpl_end.inc
|
||||
--echo # End of tests
|
@@ -1,6 +1,7 @@
|
||||
# ==== References ====
|
||||
#
|
||||
# MDEV-21117: recovery for --rpl-semi-sync-slave-enabled server
|
||||
# MDEV-21117 recovery for --rpl-semi-sync-slave-enabled server
|
||||
# MDEV-27760 event may non stop replicate in circular semisync setup
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
@@ -72,6 +73,7 @@ INSERT INTO t1 VALUES (1, 'dummy1');
|
||||
--save_master_pos
|
||||
--echo # The gtid state on current master must be equal to ...
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
|
||||
--connection server_1
|
||||
@@ -80,6 +82,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
--echo # ... the gtid states on the slave:
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
|
||||
--connection server_2
|
||||
--let $case = 2
|
||||
@@ -89,7 +92,9 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
--echo # CRASH the new master, and FAILOVER back to the original
|
||||
# value 0 for the reverse server id 2 -> 1 failover
|
||||
--let $failover_to_slave=0
|
||||
--let $query_to_crash = INSERT INTO t1 VALUES (4, REPEAT("x", 4100))
|
||||
# Additionally through "foreign" server_id verify MDEV-27760's acceptance
|
||||
# policy on the recient (to be promoted into master) server.
|
||||
--let $query_to_crash = SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100))
|
||||
--let $query2_to_crash= INSERT INTO t1 VALUES (5, REPEAT("x", 4100))
|
||||
--echo # $query_to_crash
|
||||
--echo # $query2_to_crash
|
||||
@@ -100,18 +105,18 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
--echo # Expected State post crash:
|
||||
--echo #=================================================================
|
||||
--echo # Master | Slave |
|
||||
--echo # 0-2-6 (Not commited) | 0-2-6 (Received through semi-sync |
|
||||
--echo # 0-1-6 (Not commited) | 0-1-6 (Received through semi-sync |
|
||||
--echo # | replication and applied) |
|
||||
--echo # 0-2-7 (Not commited) | 0-2-7 (Received through semi-sync |
|
||||
--echo # | replication and applied) |
|
||||
--echo #=================================================================
|
||||
--let $log_search_pattern=truncated binlog file:.*slave.*000002
|
||||
--let $log_search_pattern=truncated binlog file:.*slave.*000002.* to remove transactions starting from GTID 0-1-6
|
||||
--let $expected_rows_on_master= 3
|
||||
--let $expected_rows_on_slave= 5
|
||||
--source rpl_semi_sync_crash.inc
|
||||
|
||||
--echo #
|
||||
--echo # Server_1 promoted as master will send 0-2-6 and 0-2-7 to slave Server_2
|
||||
--echo # Server_1 promoted as master will send 0-1-6 and 0-2-7 to slave Server_2
|
||||
--echo #
|
||||
--connection server_1
|
||||
--let $rows_so_far=6
|
||||
@@ -119,6 +124,7 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
--save_master_pos
|
||||
--echo # The gtid state on current master must be equal to ...
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
|
||||
--connection server_2
|
||||
@@ -127,6 +133,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
--echo # ... the gtid states on the slave:
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
|
||||
--let $diff_tables=server_1:t1, server_2:t1
|
||||
--source include/diff_tables.inc
|
||||
@@ -154,7 +161,7 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
--echo # 0-1-10 (Not commited - | |
|
||||
--echo # never sent to slave) | |
|
||||
--echo #=================================================================
|
||||
--let $log_search_pattern=truncated binlog file:.*master.*000003
|
||||
--let $log_search_pattern=truncated binlog file:.*master.*000002.* to remove transactions starting from GTID 0-1-9
|
||||
--let $expected_rows_on_master= 6
|
||||
--let $expected_rows_on_slave= 7
|
||||
--source rpl_semi_sync_crash.inc
|
||||
@@ -168,6 +175,7 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
--source include/save_master_gtid.inc
|
||||
--echo # The gtid state on current master must be equal to ...
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
|
||||
--connection server_1
|
||||
@@ -176,6 +184,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
--echo # ... the gtid states on the slave:
|
||||
SHOW VARIABLES LIKE 'gtid_slave_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_pos';
|
||||
SHOW VARIABLES LIKE 'gtid_binlog_state';
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
|
Reference in New Issue
Block a user