1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.0.14 into 10.1

This commit is contained in:
Sergei Golubchik
2014-10-15 12:59:13 +02:00
2115 changed files with 87968 additions and 80173 deletions

View File

@ -0,0 +1,31 @@
include/master-slave.inc
[connection master]
#
# MDEV-6525 ; Problems with CREATE OR REPLACE under lock
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(a) FROM t1 );
connect con1,localhost,root,,test;
CREATE TEMPORARY TABLE tmp (b INT) ENGINE=InnoDB;
LOCK TABLE t1 WRITE;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
CREATE OR REPLACE TABLE t1 LIKE tmp;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
connection default;
set session lock_wait_timeout=1;
SELECT f1();
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
set session lock_wait_timeout=@@global.lock_wait_timeout;
SELECT f1();
connection con1;
unlock tables;
connection default;
ERROR 42S22: Unknown column 'a' in 'field list'
disconnect con1;
drop function f1;
drop table t1;
include/rpl_end.inc

View File

@ -0,0 +1,15 @@
create table v1 (a int);
include/master-slave.inc
[connection master]
create table t1 (a int);
create view v1 as select * from t1;
ERROR 42S01: Table 'v1' already exists
show tables;
Tables_in_test
t1
v1
show tables;
Tables_in_test
t1
drop table if exists t1, v1;
include/rpl_end.inc

View File

@ -0,0 +1,4 @@
include/master-slave.inc
[connection master]
kill user test2@nohost;
include/rpl_end.inc

View File

@ -128,7 +128,33 @@ insert into t3 value (1, @@global.binlog_checksum);
drop table t1, t2, t3;
set @@global.binlog_checksum = @master_save_binlog_checksum;
set @@global.master_verify_checksum = @save_master_verify_checksum;
*** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters ***
CREATE TABLE t4 (a INT PRIMARY KEY);
INSERT INTO t4 VALUES (1);
SET sql_log_bin=0;
CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename");
SET sql_log_bin=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET debug_dbug= '+d,binlog_inject_new_name_error';
FLUSH LOGS;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
SET debug_dbug= @old_dbug;
INSERT INTO t4 VALUES (2);
include/wait_for_slave_sql_error.inc [errno=1590]
Last_SQL_Error = 'The incident LOST_EVENTS occured on the master. Message: error writing to the binary log'
SELECT * FROM t4 ORDER BY a;
a
1
STOP SLAVE IO_THREAD;
SET sql_slave_skip_counter= 1;
include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a
1
2
set @@global.binlog_checksum = @slave_save_binlog_checksum;
set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum;
End of tests
DROP TABLE t4;
include/rpl_end.inc

View File

@ -61,13 +61,7 @@ include/stop_slave.inc
INSERT INTO t1 VALUES (5, "m1a");
INSERT INTO t2 VALUES (5, "i1a");
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=SLAVE_POS;
SET GLOBAL sql_slave_skip_counter=1;
ERROR HY000: When using GTID, @@sql_slave_skip_counter can not be used. Instead, setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID position.
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
SET GLOBAL sql_slave_skip_counter=10;
ERROR HY000: When using GTID, @@sql_slave_skip_counter can not be used. Instead, setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID position.
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a b
@ -191,14 +185,8 @@ master-bin.000001 #
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
master-bin.000001 # Gtid_list # # [1-2-20,0-1-10,0-3-30]
master-bin.000001 # Gtid_list # # [#-#-#]
master-bin.000001 # Binlog_checkpoint # # master-bin.000001
SELECT @@GLOBAL.gtid_binlog_pos;
@@GLOBAL.gtid_binlog_pos
1-2-20,0-3-30
SELECT @@GLOBAL.gtid_binlog_state;
@@GLOBAL.gtid_binlog_state
1-2-20,0-1-10,0-3-30
SET GLOBAL gtid_binlog_state = @old_state;
ERROR HY000: This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log
RESET MASTER;
@ -258,7 +246,7 @@ a
include/stop_slave.inc
SET gtid_domain_id= 1;
INSERT INTO t1 VALUES (3);
SET @pos= '1-1-1,0-1-110';
SET @pos= 'POS';
SELECT master_gtid_wait(@pos, 0);
master_gtid_wait(@pos, 0)
-1
@ -322,5 +310,108 @@ master_gtid_wait('2-1-10')
0
master_gtid_wait('2-1-10')
0
*** Test sql_gtid_slave_pos when used with GTID ***
include/stop_slave.inc
SET gtid_domain_id=2;
SET gtid_seq_no=1000;
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (11);
SET sql_slave_skip_counter= 1;
include/start_slave.inc
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
a
11
SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
status
Ok
include/stop_slave.inc
SET gtid_domain_id=2;
SET gtid_seq_no=1010;
INSERT INTO t1 VALUES (12);
INSERT INTO t1 VALUES (13);
SET sql_slave_skip_counter= 2;
include/start_slave.inc
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
a
11
13
SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
status
Ok
include/stop_slave.inc
SET gtid_domain_id=2;
SET gtid_seq_no=1020;
INSERT INTO t1 VALUES (14);
INSERT INTO t1 VALUES (15);
INSERT INTO t1 VALUES (16);
SET sql_slave_skip_counter= 3;
include/start_slave.inc
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
a
11
13
15
16
SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
status
Ok
include/stop_slave.inc
SET gtid_domain_id=2;
SET gtid_seq_no=1030;
INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19);
SET sql_slave_skip_counter= 5;
include/start_slave.inc
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
a
11
13
15
16
19
SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
status
Ok
include/stop_slave.inc
SET gtid_domain_id=3;
SET gtid_seq_no=100;
CREATE TABLE t2 (a INT PRIMARY KEY);
DROP TABLE t2;
SET gtid_domain_id=2;
SET gtid_seq_no=1040;
INSERT INTO t1 VALUES (20);
SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode;
SET GLOBAL slave_ddl_exec_mode=STRICT;
SET sql_slave_skip_counter=1;
START SLAVE UNTIL master_gtid_pos="3-1-100";
include/sync_with_master_gtid.inc
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t2;
ERROR 42S02: Table 'test.t2' doesn't exist
SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
status
Ok
SET sql_log_bin=0;
CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051");
SET sql_log_bin=1;
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1051]
SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
status
Ok
STOP SLAVE IO_THREAD;
SET sql_slave_skip_counter=2;
include/start_slave.inc
SELECT * FROM t1 WHERE a >= 20 ORDER BY a;
a
20
SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
status
Ok
SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
status
Ok
SET GLOBAL slave_ddl_exec_mode= @saved_mode;
DROP TABLE t1;
include/rpl_end.inc

View File

@ -46,7 +46,7 @@ master-bin.000002 #
master-bin.000003 #
SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000003 # Gtid_list # # [1-1-2,2-1-1,0-1-1]
master-bin.000003 # Gtid_list # # #
SET SESSION debug_dbug="+d,crash_dispatch_command_before";
SELECT 1;
Got one of the listed errors
@ -58,7 +58,7 @@ master-bin.000003 #
master-bin.000004 #
SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000004 # Gtid_list # # [1-1-2,0-1-1,2-1-1]
master-bin.000004 # Gtid_list # # #
SELECT * FROM t1 ORDER BY a;
a
1
@ -112,5 +112,98 @@ SHOW VARIABLES like 'gtid_strict_mode';
Variable_name Value
gtid_strict_mode ON
include/start_slave.inc
*** MDEV-6462: Incorrect recovery on a slave reconnecting to crashed master ***
set sql_log_bin= 0;
call mtr.add_suppression("Error writing file 'master-bin'");
set sql_log_bin= 1;
set sql_log_bin= 0;
call mtr.add_suppression("The server_id of master server changed in the middle of GTID");
call mtr.add_suppression("Unexpected change of master binlog file name in the middle of GTID");
set sql_log_bin= 1;
SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (11);
COMMIT;
ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable")
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
COMMIT;
Got one of the listed errors
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
3
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
# Wait 30 seconds for SQL thread to catch up with IO thread
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
# Repeat this with additional transactions on the master
SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (12);
COMMIT;
ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable")
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
COMMIT;
Got one of the listed errors
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
1
INSERT INTO t1 VALUES (13);
INSERT INTO t1 VALUES (14);
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
13
14
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
13
14
SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (21);
COMMIT;
ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable")
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
COMMIT;
Got one of the listed errors
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
1
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
13
14
# Wait 30 seconds for SQL thread to catch up with IO thread
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
13
14
# Repeat this with additional transactions on the master
SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (22);
COMMIT;
ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable")
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
COMMIT;
Got one of the listed errors
INSERT INTO t1 VALUES (23);
INSERT INTO t1 VALUES (24);
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
13
14
23
24
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
13
14
23
24
DROP TABLE t1;
include/rpl_end.inc

View File

@ -0,0 +1,42 @@
include/master-slave.inc
[connection master]
*** Test MDEV-6120, output of current GTID when a replication error is logged to the errorlog ***
CREATE TABLE t1(a INT PRIMARY KEY);
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
INSERT INTO t1 VALUES (1);
SET gtid_seq_no=100;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
SET sql_log_bin=0;
INSERT INTO t1 VALUES (2);
SET sql_log_bin=1;
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062]
include/stop_slave.inc
SET GLOBAL gtid_slave_pos= "0-1-100";
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
SET @dbug_save= @@debug_dbug;
SET debug_dbug= '+d,incident_database_resync_on_replace';
REPLACE INTO t1 VALUES (5);
SET debug_dbug= @dbug_save;
include/wait_for_slave_sql_error.inc [errno=1590]
include/stop_slave.inc
SET sql_slave_skip_counter=1;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
DROP TABLE t1;
include/rpl_end.inc

View File

@ -119,7 +119,7 @@ a b
2 3
*** Now replicate all extra changes from 3,4,5 to 2, in preparation for making 2 the new master. ***
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3;
START SLAVE UNTIL master_gtid_pos = "1-1-1,0-1-3,3-1-7,2-1-4";
START SLAVE UNTIL master_gtid_pos = "SERVER3_POS";
include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
a
@ -142,7 +142,7 @@ a b
3 1
3 3
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4;
START SLAVE UNTIL master_gtid_pos = "1-1-7,0-1-3,3-1-4,2-1-1";
START SLAVE UNTIL master_gtid_pos = "SERVER4_POS";
include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
a
@ -168,7 +168,7 @@ a b
3 1
3 3
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_5;
START SLAVE UNTIL master_gtid_pos = "1-1-4,0-1-3,3-1-1,2-1-7";
START SLAVE UNTIL master_gtid_pos = "SERVER5_POS";
include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
a

View File

@ -34,10 +34,10 @@ master-bin.000003 # Gtid_list # # [0-1-3]
FLUSH LOGS;
SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000004 # Gtid_list # # [1-1-1,0-1-4]
master-bin.000004 # Gtid_list # # #
SHOW BINLOG EVENTS IN 'master-bin.000005' LIMIT 1,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000005 # Gtid_list # # [1-1-1,0-1-4]
master-bin.000005 # Gtid_list # # #
show binary logs;
Log_name File_size
master-bin.000002 #

View File

@ -168,7 +168,7 @@ a
include/stop_slave.inc
CREATE TABLE t3 (a INT);
DROP TABLE t3;
START SLAVE UNTIL master_gtid_pos='1-1-5,2-1-5,0-1-6';
START SLAVE UNTIL master_gtid_pos='UNTIL_CONDITION';
include/wait_for_slave_to_stop.inc
SHOW CREATE TABLE t3;
Table Create Table

View File

@ -0,0 +1,25 @@
include/master-slave.inc
[connection master]
include/stop_slave.inc
set @restore_slave_net_timeout= @@global.slave_net_timeout;
set @@global.slave_net_timeout= 10;
show status like 'Slave_heartbeat_period';;
Variable_name Slave_heartbeat_period
Value 60.000
SET @save_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error";
CALL mtr.add_suppression('SET @master_heartbeat_period to master failed with error');
CALL mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
include/start_slave.inc
drop table if exists t1;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
a
1
drop table t1;
include/stop_slave.inc
SET GLOBAL debug_dbug=@save_dbug;
set @@global.slave_net_timeout= @restore_slave_net_timeout;
include/start_slave.inc
include/rpl_end.inc

View File

@ -5,8 +5,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
UNIQUE(b));
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
SELECT * FROM t1;
a b
1 10

View File

@ -4,12 +4,12 @@ select last_insert_id();
last_insert_id()
0
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
select last_insert_id();
last_insert_id()
1
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
select * from t1;
@ -26,7 +26,7 @@ drop table t2;
drop table t3;
create table t1(a int, b int, unique(b));
insert into t1 values(1,10);
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
call mtr.add_suppression("Slave SQL.*Error .Duplicate entry .10. for key .b.. on query.* error.* 1062");
call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.*error code=1062.*Error on slave:.*error.* 0");
include/wait_for_slave_sql_error_and_skip.inc [errno=1062]
@ -34,7 +34,7 @@ include/check_slave_no_error.inc
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
include/wait_for_slave_sql_error.inc [errno=1062]
include/stop_slave_io.inc
change master to master_user='test';
@ -45,7 +45,7 @@ start slave;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
include/wait_for_slave_sql_error.inc [errno=1062]
stop slave;
reset slave;
@ -53,7 +53,7 @@ include/check_slave_no_error.inc
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
@ -68,7 +68,7 @@ day id category name
2003-03-22 2161 c asdf
alter table t2 drop key day;
delete from t2;
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
@ -76,7 +76,7 @@ include/wait_for_slave_sql_error.inc [errno=0]
drop table t1, t2;
drop table t1, t2;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
DROP TABLE t1;
include/rpl_reset.inc
@ -88,16 +88,16 @@ use b48297_db1;
CREATE TABLE t1 (c1 VARCHAR(256)) engine=MyISAM;;
use b42897_db2;
### assertion: works with cross-referenced database
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
use b48297_db1;
### assertion: works with fully qualified name on current database
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
### assertion: works without fully qualified name on current database
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1;
### create connection without default database
### connect (conn2,localhost,root,,*NO-ONE*);
### assertion: works without stating the default database
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE b48297_db1.t1;
### disconnect and switch back to master connection
use b48297_db1;
include/diff_tables.inc [master:b48297_db1.t1, slave:b48297_db1.t1]

View File

@ -0,0 +1,49 @@
include/master-slave.inc
[connection master]
include/stop_slave.inc
include/rpl_stop_server.inc [server_number=1]
include/rpl_start_server.inc [server_number=1]
SET SQL_LOG_BIN=0;
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
SET SQL_LOG_BIN=1;
SET @old_engine= @@GLOBAL.default_storage_engine;
SET GLOBAL default_storage_engine=InnoDB;
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=12;
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
include/start_slave.inc
SET SQL_LOG_BIN=0;
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
SET SQL_LOG_BIN=1;
SELECT @@gtid_slave_pos;
@@gtid_slave_pos
0-1-1381
CHECKSUM TABLE table0_int_autoinc, table0_key_pk_parts_2_int_autoinc, table100_int_autoinc, table100_key_pk_parts_2_int_autoinc, table10_int_autoinc, table10_key_pk_parts_2_int_autoinc, table1_int_autoinc, table1_key_pk_parts_2_int_autoinc, table2_int_autoinc, table2_key_pk_parts_2_int_autoinc;
Table Checksum
test.table0_int_autoinc 3623174395
test.table0_key_pk_parts_2_int_autoinc 2888328157
test.table100_int_autoinc 3624823809
test.table100_key_pk_parts_2_int_autoinc 3316583308
test.table10_int_autoinc 1615053718
test.table10_key_pk_parts_2_int_autoinc 4147461080
test.table1_int_autoinc 478809705
test.table1_key_pk_parts_2_int_autoinc 3032208641
test.table2_int_autoinc 854763867
test.table2_key_pk_parts_2_int_autoinc 4231615291
include/stop_slave.inc
SET GLOBAL default_storage_engine= @old_engine;
SET GLOBAL slave_parallel_threads=@old_parallel;
SET sql_log_bin=0;
DROP TABLE table0_int_autoinc;
DROP TABLE table0_key_pk_parts_2_int_autoinc;
DROP TABLE table100_int_autoinc;
DROP TABLE table100_key_pk_parts_2_int_autoinc;
DROP TABLE table10_int_autoinc;
DROP TABLE table10_key_pk_parts_2_int_autoinc;
DROP TABLE table1_int_autoinc;
DROP TABLE table1_key_pk_parts_2_int_autoinc;
DROP TABLE table2_int_autoinc;
DROP TABLE table2_key_pk_parts_2_int_autoinc;
SET sql_log_bin=1;
include/start_slave.inc
include/rpl_end.inc

View File

@ -0,0 +1,56 @@
include/master-slave.inc
[connection master]
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
include/stop_slave.inc
SET sql_log_bin= 0;
INSERT INTO t1 VALUES (1, 2);
SET sql_log_bin= 1;
CHANGE MASTER TO master_use_gtid= current_pos;
Contents on slave before:
SELECT * FROM t1 ORDER BY a;
a b
1 2
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=8;
CREATE TEMPORARY TABLE t2 LIKE t1;
INSERT INTO t2 VALUE (1, 1);
INSERT INTO t2 VALUE (2, 1);
INSERT INTO t2 VALUE (3, 1);
INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2;
Contents on master:
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 1
3 1
4 1
5 1
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062]
STOP SLAVE IO_THREAD;
Contents on slave on slave error:
SELECT * FROM t1 ORDER BY a;
a b
1 2
SET sql_log_bin= 0;
DELETE FROM t1 WHERE a=1;
SET sql_log_bin= 1;
include/start_slave.inc
Contents on slave after:
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 1
3 1
4 1
5 1
DROP TABLE t1;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads= @old_parallel;
include/start_slave.inc
include/rpl_end.inc

View File

@ -314,7 +314,7 @@ SET debug_sync='now WAIT_FOR t1_ready';
KILL THD_ID;
SET debug_sync='now WAIT_FOR t2_killed';
SET debug_sync='now SIGNAL t1_cont';
include/wait_for_slave_sql_error.inc [errno=1317,1964]
include/wait_for_slave_sql_error.inc [errno=1317,1927,1964]
STOP SLAVE IO_THREAD;
SELECT * FROM t3 WHERE a >= 30 ORDER BY a;
a b
@ -398,7 +398,7 @@ SET debug_sync='now WAIT_FOR t1_ready';
KILL THD_ID;
SET debug_sync='now WAIT_FOR t2_killed';
SET debug_sync='now SIGNAL t1_cont';
include/wait_for_slave_sql_error.inc [errno=1317,1964]
include/wait_for_slave_sql_error.inc [errno=1317,1927,1964]
SET debug_sync='RESET';
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
@ -481,7 +481,7 @@ SET debug_sync='now WAIT_FOR t1_ready';
KILL THD_ID;
SET debug_sync='now WAIT_FOR t2_killed';
SET debug_sync='now SIGNAL t1_cont';
include/wait_for_slave_sql_error.inc [errno=1317,1964]
include/wait_for_slave_sql_error.inc [errno=1317,1927,1964]
SELECT * FROM t3 WHERE a >= 50 ORDER BY a;
a b
51 51
@ -793,6 +793,7 @@ SET debug_sync='now WAIT_FOR master_queued2';
SET debug_sync='now SIGNAL master_cont1';
SET debug_sync='RESET';
include/start_slave.inc
include/stop_slave.inc
SELECT * FROM t4 ORDER BY a;
a b
1 NULL
@ -801,6 +802,42 @@ a b
5 NULL
6 6
7 NULL
DELETE FROM t4;
INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1';
UPDATE t4 SET b=NULL WHERE a=6;
SET debug_sync='now WAIT_FOR master_queued1';
SET @old_format= @@SESSION.binlog_format;
SET binlog_format='statement';
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2';
DELETE FROM t4 WHERE b <= 1;
SET debug_sync='now WAIT_FOR master_queued2';
SET debug_sync='now SIGNAL master_cont1';
SET @old_format=@@GLOBAL.binlog_format;
SET debug_sync='RESET';
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with";
include/start_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
SELECT * FROM t4 ORDER BY a;
a b
1 NULL
2 2
3 NULL
4 4
5 NULL
6 NULL
SET @last_gtid= 'GTID';
SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok",
CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos))
AS result;
result
GTID found ok
SELECT "ROW FOUND" AS `Is the row found?`
FROM mysql.gtid_slave_pos
WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid;
Is the row found?
ROW FOUND
*** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication ***
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=1;
@ -819,11 +856,78 @@ test_check
OK
test_check
OK
*** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error ***
CREATE TABLE t6 (a INT) ENGINE=MyISAM;
CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1;
SET @old_format= @@binlog_format;
SET binlog_format= statement;
SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont';
INSERT INTO t6 VALUES (1), (2), (3);
SET debug_sync='now WAIT_FOR ready';
KILL QUERY CONID;
SET debug_sync='now SIGNAL cont';
ERROR 70100: Query execution was interrupted
SET binlog_format= @old_format;
SET debug_sync='RESET';
SET debug_sync='RESET';
include/wait_for_slave_sql_error.inc [errno=1317]
STOP SLAVE IO_THREAD;
SET GLOBAL gtid_slave_pos= 'AFTER_ERROR_GTID_POS';
include/start_slave.inc
INSERT INTO t6 VALUES (4);
SELECT * FROM t6 ORDER BY a;
a
1
4
SELECT * FROM t6 ORDER BY a;
a
4
*** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 ***
INSERT INTO t2 VALUES (31);
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
include/stop_slave.inc
SET GLOBAL slave_parallel_threads= 0;
include/start_slave.inc
SET sql_log_bin= 0;
INSERT INTO t2 VALUES (32);
SET sql_log_bin= 1;
INSERT INTO t2 VALUES (32);
FLUSH LOGS;
INSERT INTO t2 VALUES (33);
INSERT INTO t2 VALUES (34);
SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
a
31
32
33
34
include/save_master_gtid.inc
include/wait_for_slave_sql_error.inc [errno=1062]
include/stop_slave_io.inc
SET GLOBAL slave_parallel_threads=10;
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062]
START SLAVE SQL_THREAD;
include/wait_for_slave_sql_error.inc [errno=1062]
SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
a
31
32
SET sql_slave_skip_counter= 1;
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
a
31
32
33
34
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
SET DEBUG_SYNC= 'RESET';
DROP function foo;
DROP TABLE t1,t2,t3,t4,t5;
DROP TABLE t1,t2,t3,t4,t5,t6;
SET DEBUG_SYNC= 'RESET';
include/rpl_end.inc

View File

@ -0,0 +1,196 @@
include/rpl_init.inc [topology=1->2]
*** Test retry of transactions that fail to replicate due to deadlock or similar temporary error. ***
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1);
SET sql_log_bin=0;
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
RETURNS INT DETERMINISTIC
BEGIN
RETURN x;
END
||
SET sql_log_bin=1;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
include/start_slave.inc
SET sql_log_bin=0;
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
RETURNS INT DETERMINISTIC
BEGIN
IF d1 != '' THEN
SET debug_sync = d1;
END IF;
IF d2 != '' THEN
SET debug_sync = d2;
END IF;
RETURN x;
END
||
SET sql_log_bin=1;
include/stop_slave.inc
SET gtid_seq_no = 100;
BEGIN;
INSERT INTO t1 VALUES (2,1);
UPDATE t1 SET b=b+1 WHERE a=1;
INSERT INTO t1 VALUES (3,1);
COMMIT;
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 1
3 1
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100";
include/start_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
retries
1
SELECT * FROM t1 ORDER BY a;
a b
1 2
2 1
3 1
*** Test that double retry works when the first retry also fails with temp error ***
include/stop_slave.inc
SET gtid_seq_no = 100;
SET @old_server_id = @@server_id;
SET server_id = 10;
BEGIN;
INSERT INTO t1 VALUES (4,1);
UPDATE t1 SET b=b+1 WHERE a=1;
INSERT INTO t1 VALUES (5,1);
INSERT INTO t1 VALUES (6,1);
COMMIT;
SET server_id = @old_server_id;
SELECT * FROM t1 ORDER BY a;
a b
1 3
2 1
3 1
4 1
5 1
6 1
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100,rpl_parallel_simulate_double_temp_err_gtid_0_x_100";
include/start_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
retries
2
SELECT * FROM t1 ORDER BY a;
a b
1 3
2 1
3 1
4 1
5 1
6 1
*** Test too many retries, eventually causing failure. ***
include/stop_slave.inc
SET gtid_seq_no = 100;
SET @old_server_id = @@server_id;
SET server_id = 11;
BEGIN;
INSERT INTO t1 VALUES (7,1);
UPDATE t1 SET b=b+1 WHERE a=1;
INSERT INTO t1 VALUES (8,1);
INSERT INTO t1 VALUES (9,1);
COMMIT;
SET server_id = @old_server_id;
SELECT * FROM t1 ORDER BY a;
a b
1 4
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
SET sql_log_bin=0;
CALL mtr.add_suppression("Slave worker thread retried transaction 10 time\\(s\\) in vain, giving up");
CALL mtr.add_suppression("Slave: Deadlock found when trying to get lock; try restarting transaction");
SET sql_log_bin=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100,rpl_parallel_simulate_infinite_temp_err_gtid_0_x_100";
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1213]
SET GLOBAL debug_dbug=@old_dbug;
retries
10
SELECT * FROM t1 ORDER BY a;
a b
1 3
2 1
3 1
4 1
5 1
6 1
STOP SLAVE IO_THREAD;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a b
1 4
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
*** Test retry of event group that spans multiple relay log files. ***
CREATE TABLE t2 (a int PRIMARY KEY, b BLOB) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,"Hulubullu");
include/stop_slave.inc
SET @old_max= @@GLOBAL.max_relay_log_size;
SET GLOBAL max_relay_log_size=4096;
SET gtid_seq_no = 100;
SET @old_server_id = @@server_id;
SET server_id = 12;
BEGIN;
INSERT INTO t1 VALUES (10, 4);
COMMIT;
SET server_id = @old_server_id;
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
a b
10 4
SELECT a, LENGTH(b) FROM t2 ORDER BY a;
a LENGTH(b)
1 9
2 5006
3 5012
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100";
include/start_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
retries
1
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
a b
10 4
SELECT a, LENGTH(b) FROM t2 ORDER BY a;
a LENGTH(b)
1 9
2 5006
3 5012
INSERT INTO t1 VALUES (11,11);
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
a b
10 4
11 11
SELECT a, LENGTH(b) FROM t2 ORDER BY a;
a LENGTH(b)
1 9
2 5006
3 5012
4 5000
SET GLOBAL max_relay_log_size=@old_max;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
DROP TABLE t1, t2;
DROP function foo;
include/rpl_end.inc

View File

@ -0,0 +1,123 @@
include/rpl_init.inc [topology=1->2]
*** MDEV-6321: close_temporary_tables() in format description event not serialised correctly ***
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
CHANGE MASTER TO master_use_gtid= current_pos;
include/start_slave.inc
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(100) CHARACTER SET utf8);
include/stop_slave.inc
SET gtid_domain_id= 1;
INSERT INTO t1 VALUES (1, 0);
CREATE TEMPORARY TABLE t2 (a int);
SET gtid_domain_id= 2;
CREATE TEMPORARY TABLE t3 (a INT PRIMARY KEY);
CREATE TEMPORARY TABLE t4 (a int);
INSERT INTO t3 VALUES (100);
INSERT INTO t4 SELECT a+1 FROM t3;
INSERT INTO t2 VALUES (2), (4), (6), (8), (10), (12), (14), (16), (18), (20);
INSERT INTO t2 VALUES (3), (6), (9), (12), (15), (18);
INSERT INTO t2 VALUES (4), (8), (12), (16), (20);
INSERT INTO t3 SELECT a+2 FROM t4;
INSERT INTO t4 SELECT a+4 FROM t3;
INSERT INTO t2 VALUES (5), (10), (15), (20);
INSERT INTO t2 VALUES (6), (12), (18);
INSERT INTO t2 VALUES (7), (14);
INSERT INTO t2 VALUES (8), (16);
INSERT INTO t2 VALUES (9), (18);
INSERT INTO t2 VALUES (10), (20);
INSERT INTO t3 SELECT a+8 FROM t4;
INSERT INTO t4 SELECT a+16 FROM t3;
INSERT INTO t2 VALUES (11);
INSERT INTO t2 VALUES (12);
INSERT INTO t2 VALUES (13);
INSERT INTO t3 SELECT a+32 FROM t4;
INSERT INTO t2 VALUES (14);
INSERT INTO t2 VALUES (15);
INSERT INTO t2 VALUES (16);
INSERT INTO t4 SELECT a+64 FROM t3;
INSERT INTO t2 VALUES (17);
INSERT INTO t2 VALUES (18);
INSERT INTO t2 VALUES (19);
INSERT INTO t3 SELECT a+128 FROM t4;
INSERT INTO t2 VALUES (20);
INSERT INTO t1 SELECT a, a MOD 7 FROM t3;
INSERT INTO t1 SELECT a, a MOD 7 FROM t4;
INSERT INTO t1 SELECT a, COUNT(*) FROM t2 GROUP BY a;
FLUSH TABLES;
SET SESSION debug_dbug="+d,crash_dispatch_command_before";
SELECT 1;
Got one of the listed errors
INSERT INTO t1 VALUES (0, 1);
include/start_slave.inc
SELECT * FROM t1 WHERE a <= 20 ORDER BY a;
a b
0 1
1 0
2 1
3 1
4 2
5 1
6 3
7 1
8 3
9 2
10 3
11 1
12 5
13 1
14 3
15 3
16 4
17 1
18 5
19 1
20 5
SELECT COUNT(*) FROM t1 WHERE a BETWEEN 100+0 AND 100+256;
COUNT(*)
55
SHOW STATUS LIKE 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
*** Test that if master logged partial event group before crash, we finish that group correctly before executing format description event ***
include/stop_slave.inc
CALL mtr.add_suppression("Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them");
SET gtid_domain_id= 1;
DELETE FROM t1;
ALTER TABLE t1 ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY);
INSERT INTO t2 VALUES (1);
INSERT INTO t2 VALUES (2);
SET gtid_domain_id= 2;
CREATE TEMPORARY TABLE t3 (a INT PRIMARY KEY);
INSERT INTO t3 VALUES (10);
INSERT INTO t3 VALUES (20);
INSERT INTO t1 SELECT a, 'server_1' FROM t2;
INSERT INTO t1 SELECT a, 'default' FROM t3;
INSERT INTO t1 SELECT a+2, '+server_1' FROM t2;
FLUSH TABLES;
SET SESSION debug_dbug="+d,crash_before_writing_xid";
INSERT INTO t1 SELECT a+4, '++server_1' FROM t2;
Got one of the listed errors
INSERT INTO t1 VALUES (0, 1);
include/save_master_gtid.inc
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
0 1
1 server_1
2 server_1
3 +server_1
4 +server_1
10 default
20 default
SHOW STATUS LIKE 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
FLUSH LOGS;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
DROP TABLE t1;
include/rpl_end.inc

View File

@ -0,0 +1,14 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
==== Check that we can understand the new format of relay-log.info ====
include/stop_slave.inc
RESET SLAVE;
# Read relay-log.info
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
# Check that relay log coordinates are equal to those saved in new-format_relay-log.info
= , 0, slave-relay-bin.000001, 4
include/rpl_end.inc

View File

@ -0,0 +1,14 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
==== Check that we still understand the old format of relay-log.info ====
include/stop_slave.inc
RESET SLAVE;
# Read relay-log.info
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
# Check that relay log coordinates are equal to those we saved in old-format_relay-log.info
= , 0, slave-relay-bin.000001, 4
include/rpl_end.inc

View File

@ -0,0 +1,63 @@
include/master-slave.inc
[connection master]
call mtr.add_suppression("Read semi-sync reply network error");
call mtr.add_suppression("Timeout waiting for reply of binlog");
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
[connection slave]
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave';
UNINSTALL PLUGIN rpl_semi_sync_slave;
[connection master]
UNINSTALL PLUGIN rpl_semi_sync_master;
CREATE TABLE t1(i int);
INSERT INTO t1 values (1);
DROP TABLE t1;
[connection slave]
include/install_semisync.inc
[connection slave]
UNINSTALL PLUGIN rpl_semi_sync_slave;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
plugin_name plugin_status
rpl_semi_sync_slave DELETED
[connection master]
UNINSTALL PLUGIN rpl_semi_sync_master;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
plugin_name plugin_status
rpl_semi_sync_master DELETED
CREATE TABLE t1(i int);
INSERT INTO t1 values (2);
DROP TABLE t1;
[connection slave]
show status like "Rpl_semi_sync_slave_status";
Variable_name Value
Rpl_semi_sync_slave_status ON
[connection master]
show status like "Rpl_semi_sync_master_status";
Variable_name Value
Rpl_semi_sync_master_status ON
show status like "Rpl_semi_sync_master_clients";
Variable_name Value
Rpl_semi_sync_master_clients 1
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
plugin_name plugin_status
rpl_semi_sync_master DELETED
[connection slave]
include/stop_slave.inc
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
plugin_name plugin_status
[connection master]
create table t2 (a int);
drop table t2;
[connection slave]
include/start_slave.inc
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
plugin_name plugin_status
[connection master]
CREATE TABLE t1(i int);
INSERT INTO t1 values (3);
DROP TABLE t1;
[connection slave]
include/rpl_end.inc

View File

@ -0,0 +1,25 @@
include/master-slave.inc
[connection master]
**** On Master ****
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
a
1
2
3
REPLACE INTO t1 VALUES (4);
SELECT * FROM t1;
a
1
2
3
4
include/check_slave_is_running.inc
Should have two binary logs here
show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
DROP TABLE t1;
include/rpl_end.inc

View File

@ -94,10 +94,12 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
include/stop_slave.inc
[connection master]
include/stop_dump_threads.inc
SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*';
[connection slave]
include/restart_slave.inc
include/start_slave.inc
BEGIN;
UPDATE t1 SET c2 = 2 WHERE c1 = 1;
[connection master]
@ -116,6 +118,9 @@ SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
[connection slave]
include/wait_for_slave_to_stop.inc
[connection slave1]
[connection master]
include/stop_dump_threads.inc
[connection slave1]
include/start_slave.inc
[connection master]
DROP TABLE t1, t2;

View File

@ -10,6 +10,12 @@ t1 CREATE TABLE `t1` (
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 `VAROPT`='5'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /* `ull`=12340 */
set sql_mode=ignore_bad_table_options;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 `ull`=12340

View File

@ -0,0 +1,44 @@
--source include/have_innodb.inc
--source include/have_binlog_format_row_or_statement.inc
--source include/have_metadata_lock_info.inc
--source include/master-slave.inc
--enable_connect_log
--echo #
--echo # MDEV-6525 ; Problems with CREATE OR REPLACE under lock
--echo #
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(a) FROM t1 );
--connect (con1,localhost,root,,test)
CREATE TEMPORARY TABLE tmp (b INT) ENGINE=InnoDB;
LOCK TABLE t1 WRITE;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
CREATE OR REPLACE TABLE t1 LIKE tmp;
SHOW CREATE TABLE t1;
--connection default
set session lock_wait_timeout=1;
--error 1205
SELECT f1();
set session lock_wait_timeout=@@global.lock_wait_timeout;
--send SELECT f1()
--connection con1
# This is here just in case, any timeout should be ok
--sleep 1
unlock tables;
--connection default
--error 1054
--reap
--disconnect con1
# Cleanup
drop function f1;
drop table t1;
--disable_connect_log
--source include/rpl_end.inc

View File

@ -0,0 +1,24 @@
#
# MDEV-6409 CREATE VIEW replication problem if error occurs in mysql_register_view
#
#
#
# verify that failed CREATE VIEW is not replicated
create table v1 (a int);
source include/master-slave.inc;
connection master;
create table t1 (a int);
--error ER_TABLE_EXISTS_ERROR
create view v1 as select * from t1;
show tables;
sync_slave_with_master;
show tables;
connection master;
drop table if exists t1, v1;
--source include/rpl_end.inc

View File

@ -0,0 +1,11 @@
#
# MDEV-6290 Crash in KILL HARD QUERY USER x@y when slave threads are running
#
# this test doesn't depend on the binlog format, no need to run it three times
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--connection server_2
kill user test2@nohost;
--source include/rpl_end.inc

View File

@ -260,9 +260,67 @@ AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
#connection slave;
sync_slave_with_master;
--echo *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters ***
--connection master
--source include/wait_for_binlog_checkpoint.inc
CREATE TABLE t4 (a INT PRIMARY KEY);
INSERT INTO t4 VALUES (1);
SET sql_log_bin=0;
CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename");
SET sql_log_bin=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET debug_dbug= '+d,binlog_inject_new_name_error';
--error ER_NO_UNIQUE_LOGFILE
FLUSH LOGS;
SET debug_dbug= @old_dbug;
INSERT INTO t4 VALUES (2);
--connection slave
--let $slave_sql_errno= 1590
--source include/wait_for_slave_sql_error.inc
# Search the error log for the error message.
# The bug was that 4 garbage bytes were output in the middle of the error
# message; by searching for a pattern that spans that location, we can
# catch the error.
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.2.err;
}
--let SEARCH_FILE= $log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occured on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590
--source include/search_pattern_in_file.inc
SELECT * FROM t4 ORDER BY a;
STOP SLAVE IO_THREAD;
SET sql_slave_skip_counter= 1;
--source include/start_slave.inc
--connection master
--save_master_pos
--connection slave
--sync_with_master
SELECT * FROM t4 ORDER BY a;
--connection slave
set @@global.binlog_checksum = @slave_save_binlog_checksum;
set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum;
--echo End of tests
--connection master
DROP TABLE t4;
--source include/rpl_end.inc

View File

@ -68,16 +68,8 @@ save_master_pos;
connection server_4;
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
MASTER_USE_GTID=SLAVE_POS;
# Test that sql_slave_skip_counter is prevented in GTID mode.
--error ER_SLAVE_SKIP_NOT_IN_GTID
SET GLOBAL sql_slave_skip_counter=1;
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
MASTER_USE_GTID=CURRENT_POS;
--error ER_SLAVE_SKIP_NOT_IN_GTID
SET GLOBAL sql_slave_skip_counter=10;
--source include/start_slave.inc
sync_with_master;
SELECT * FROM t1 ORDER BY a;
@ -184,8 +176,8 @@ SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30';
--let $binlog_file= master-bin.000001
--let $binlog_start= 4
--source include/show_binlog_events.inc
SELECT @@GLOBAL.gtid_binlog_pos;
SELECT @@GLOBAL.gtid_binlog_state;
#SELECT @@GLOBAL.gtid_binlog_pos;
#SELECT @@GLOBAL.gtid_binlog_state;
--error ER_BINLOG_MUST_BE_EMPTY
SET GLOBAL gtid_binlog_state = @old_state;
RESET MASTER;
@ -262,6 +254,7 @@ INSERT INTO t1 VALUES (3);
--let $pos= `SELECT @@gtid_binlog_pos`
--connection s1
--replace_result $pos POS
eval SET @pos= '$pos';
SELECT master_gtid_wait(@pos, 0);
SELECT * FROM t1 WHERE a >= 3;
@ -374,6 +367,120 @@ reap;
reap;
--echo *** Test sql_gtid_slave_pos when used with GTID ***
--connection server_2
--source include/stop_slave.inc
--connection server_1
SET gtid_domain_id=2;
SET gtid_seq_no=1000;
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (11);
--save_master_pos
--connection server_2
SET sql_slave_skip_counter= 1;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
--source include/stop_slave.inc
--connection server_1
SET gtid_domain_id=2;
SET gtid_seq_no=1010;
INSERT INTO t1 VALUES (12);
INSERT INTO t1 VALUES (13);
--save_master_pos
--connection server_2
SET sql_slave_skip_counter= 2;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
--source include/stop_slave.inc
--connection server_1
SET gtid_domain_id=2;
SET gtid_seq_no=1020;
INSERT INTO t1 VALUES (14);
INSERT INTO t1 VALUES (15);
INSERT INTO t1 VALUES (16);
--save_master_pos
--connection server_2
SET sql_slave_skip_counter= 3;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
--source include/stop_slave.inc
--connection server_1
SET gtid_domain_id=2;
SET gtid_seq_no=1030;
INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19);
--save_master_pos
--connection server_2
SET sql_slave_skip_counter= 5;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
--source include/stop_slave.inc
--connection server_1
SET gtid_domain_id=3;
SET gtid_seq_no=100;
CREATE TABLE t2 (a INT PRIMARY KEY);
DROP TABLE t2;
SET gtid_domain_id=2;
SET gtid_seq_no=1040;
INSERT INTO t1 VALUES (20);
--save_master_pos
--connection server_2
SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode;
SET GLOBAL slave_ddl_exec_mode=STRICT;
SET sql_slave_skip_counter=1;
START SLAVE UNTIL master_gtid_pos="3-1-100";
--let $master_pos=3-1-100
--source include/sync_with_master_gtid.inc
--source include/wait_for_slave_sql_to_stop.inc
--error ER_NO_SUCH_TABLE
SELECT * FROM t2;
SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
# Start the slave again, it should fail on the DROP TABLE as the table is not there.
SET sql_log_bin=0;
CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051");
SET sql_log_bin=1;
START SLAVE;
--let $slave_sql_errno=1051
--source include/wait_for_slave_sql_error.inc
SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
STOP SLAVE IO_THREAD;
SET sql_slave_skip_counter=2;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 WHERE a >= 20 ORDER BY a;
SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
SET GLOBAL slave_ddl_exec_mode= @saved_mode;
--connection server_1
DROP TABLE t1;

View File

@ -100,7 +100,7 @@ SET gtid_domain_id= 2;
INSERT INTO t1 VALUES (3);
FLUSH LOGS;
--source include/show_binary_logs.inc
--replace_column 2 # 4 # 5 #
--replace_column 2 # 4 # 5 # 6 #
SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@ -120,7 +120,7 @@ EOF
--source include/wait_until_connected_again.inc
--source include/show_binary_logs.inc
--replace_column 2 # 4 # 5 #
--replace_column 2 # 4 # 5 # 6 #
SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
--save_master_pos
@ -294,6 +294,192 @@ SHOW VARIABLES like 'gtid_strict_mode';
eval SET GLOBAL gtid_strict_mode= $old_gtid_strict;
--enable_query_log
--echo *** MDEV-6462: Incorrect recovery on a slave reconnecting to crashed master ***
--connection server_1
set sql_log_bin= 0;
call mtr.add_suppression("Error writing file 'master-bin'");
set sql_log_bin= 1;
--connection server_2
set sql_log_bin= 0;
call mtr.add_suppression("The server_id of master server changed in the middle of GTID");
call mtr.add_suppression("Unexpected change of master binlog file name in the middle of GTID");
set sql_log_bin= 1;
--connection server_1
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (11);
--error ER_ERROR_ON_WRITE
COMMIT;
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
--error 2006,2013
COMMIT;
--source include/wait_until_disconnected.inc
# Simulate that we reconnect to a different server (new server_id).
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart: --server-id=3
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
SELECT @@GLOBAL.server_id;
SELECT * from t1 WHERE a > 10 ORDER BY a;
--echo # Wait 30 seconds for SQL thread to catch up with IO thread
--connection server_2
--let $wait_timeout= 300
while ($wait_timeout != 0)
{
--let $read_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
--let $exec_log_pos= query_get_value('SHOW SLAVE STATUS', Exec_Master_Log_Pos, 1)
if ($read_log_pos == $exec_log_pos)
{
--let $wait_timeout= 0
}
if ($read_log_pos != $exec_log_pos)
{
--sleep 0.1
--dec $wait_timeout
}
}
if ($read_log_pos != $exec_log_pos)
{
--die Timeout wait for SQL thread to catch up with IO thread
}
SELECT * from t1 WHERE a > 10 ORDER BY a;
--echo # Repeat this with additional transactions on the master
--connection server_1
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (12);
--error ER_ERROR_ON_WRITE
COMMIT;
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
--error 2006,2013
COMMIT;
--source include/wait_until_disconnected.inc
# Simulate that we reconnect to a different server (new server_id).
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart: --server-id=1
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
SELECT @@GLOBAL.server_id;
INSERT INTO t1 VALUES (13);
INSERT INTO t1 VALUES (14);
SELECT * from t1 WHERE a > 10 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--source include/sync_with_master_gtid.inc
SELECT * from t1 WHERE a > 10 ORDER BY a;
--connection server_1
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (21);
--error ER_ERROR_ON_WRITE
COMMIT;
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
--error 2006,2013
COMMIT;
--source include/wait_until_disconnected.inc
# Simulate that we reconnect to the same server (same server_id).
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
SELECT @@GLOBAL.server_id;
SELECT * from t1 WHERE a > 10 ORDER BY a;
--echo # Wait 30 seconds for SQL thread to catch up with IO thread
--connection server_2
--let $wait_timeout= 300
while ($wait_timeout != 0)
{
--let $read_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
--let $exec_log_pos= query_get_value('SHOW SLAVE STATUS', Exec_Master_Log_Pos, 1)
if ($read_log_pos == $exec_log_pos)
{
--let $wait_timeout= 0
}
if ($read_log_pos != $exec_log_pos)
{
--sleep 0.1
--dec $wait_timeout
}
}
if ($read_log_pos != $exec_log_pos)
{
--die Timeout wait for SQL thread to catch up with IO thread
}
SELECT * from t1 WHERE a > 10 ORDER BY a;
--echo # Repeat this with additional transactions on the master
--connection server_1
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
SET GLOBAL debug_dbug="+d,inject_error_writing_xid";
BEGIN;
INSERT INTO t1 VALUES (22);
--error ER_ERROR_ON_WRITE
COMMIT;
SET GLOBAL debug_dbug="+d,crash_dispatch_command_before";
--error 2006,2013
COMMIT;
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
INSERT INTO t1 VALUES (23);
INSERT INTO t1 VALUES (24);
SELECT * from t1 WHERE a > 10 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--source include/sync_with_master_gtid.inc
SELECT * from t1 WHERE a > 10 ORDER BY a;
--connection server_1
DROP TABLE t1;

View File

@ -0,0 +1,76 @@
--source include/have_debug.inc
--source include/master-slave.inc
--echo *** Test MDEV-6120, output of current GTID when a replication error is logged to the errorlog ***
--connection master
CREATE TABLE t1(a INT PRIMARY KEY);
--sync_slave_with_master
--connection slave
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
--connection master
INSERT INTO t1 VALUES (1);
SET gtid_seq_no=100;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
--save_master_pos
--connection slave
SET sql_log_bin=0;
INSERT INTO t1 VALUES (2);
SET sql_log_bin=1;
START SLAVE;
--let $slave_sql_errno=1062
--source include/wait_for_slave_sql_error.inc
--source include/stop_slave.inc
# Skip the problem event from the master.
SET GLOBAL gtid_slave_pos= "0-1-100";
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 ORDER BY a;
--connection master
SET @dbug_save= @@debug_dbug;
SET debug_dbug= '+d,incident_database_resync_on_replace';
REPLACE INTO t1 VALUES (5);
SET debug_dbug= @dbug_save;
--save_master_pos
--connection slave
--let $slave_sql_errno=1590
--source include/wait_for_slave_sql_error.inc
--source include/stop_slave.inc
SET sql_slave_skip_counter=1;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 ORDER BY a;
# Check error log for correct messages.
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.2.err;
}
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=Slave SQL: Error 'Duplicate entry .* on query\. .*Query: '.*', Gtid 0-1-100, Internal MariaDB error code:|Slave SQL: Could not execute Write_rows.*table test.t1; Duplicate entry.*, Gtid 0-1-100, Internal MariaDB error
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=Slave SQL: The incident LOST_EVENTS occured on the master\. Message: <none>, Internal MariaDB error code: 1590
--source include/search_pattern_in_file.inc
--connection master
DROP TABLE t1;
--source include/rpl_end.inc

View File

@ -139,6 +139,7 @@ SELECT * FROM t4 ORDER BY a,b;
--connection server_2
--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3;
--replace_result $server3_pos SERVER3_POS
eval START SLAVE UNTIL master_gtid_pos = "$server3_pos";
--source include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
@ -151,6 +152,7 @@ SELECT * FROM t4 ORDER BY a,b;
--connection server_2
--replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4;
--replace_result $server4_pos SERVER4_POS
eval START SLAVE UNTIL master_gtid_pos = "$server4_pos";
--source include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;
@ -163,6 +165,7 @@ SELECT * FROM t4 ORDER BY a,b;
--connection server_2
--replace_result $SERVER_MYPORT_5 SERVER_MYPORT_5
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_5;
--replace_result $server5_pos SERVER5_POS
eval START SLAVE UNTIL master_gtid_pos = "$server5_pos";
--source include/wait_for_slave_to_stop.inc
SELECT * FROM t1 ORDER BY a;

View File

@ -144,6 +144,7 @@ INSERT INTO t1 VALUES (20);
--connection server_2
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 ORDER BY a;

View File

@ -63,7 +63,7 @@ INSERT INTO t1 VALUES (4);
--replace_column 2 # 4 # 5 #
SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1;
FLUSH LOGS;
--replace_column 2 # 4 # 5 #
--replace_column 2 # 4 # 5 # 6 #
SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@ -83,7 +83,7 @@ EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
--replace_column 2 # 4 # 5 #
--replace_column 2 # 4 # 5 # 6 #
SHOW BINLOG EVENTS IN 'master-bin.000005' LIMIT 1,1;
--source include/show_binary_logs.inc

View File

@ -175,6 +175,7 @@ DROP TABLE t3;
--save_master_pos
--connection server_2
--replace_result $until_condition UNTIL_CONDITION
eval START SLAVE UNTIL master_gtid_pos='$until_condition';
--source include/wait_for_slave_to_stop.inc
SHOW CREATE TABLE t3;

View File

@ -0,0 +1,52 @@
# Testing master to slave heartbeat protocol, test cases that need debug build.
--source include/master-slave.inc
--source include/have_debug.inc
connection slave;
--source include/stop_slave.inc
set @restore_slave_net_timeout= @@global.slave_net_timeout;
--disable_warnings
set @@global.slave_net_timeout= 10;
--enable_warnings
###
### Checking the range
###
#
# default period slave_net_timeout/2
#
--query_vertical show status like 'Slave_heartbeat_period';
SET @save_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error";
CALL mtr.add_suppression('SET @master_heartbeat_period to master failed with error');
CALL mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
--source include/start_slave.inc
connection master;
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
sync_slave_with_master;
--connection slave
SELECT * FROM t1;
connection master;
drop table t1;
connection slave;
--source include/stop_slave.inc
--disable_warnings
SET GLOBAL debug_dbug=@save_dbug;
set @@global.slave_net_timeout= @restore_slave_net_timeout;
--enable_warnings
--source include/start_slave.inc
--source include/rpl_end.inc

View File

@ -0,0 +1,70 @@
--source include/have_innodb.inc
--source include/have_partition.inc
--source include/have_binlog_format_mixed_or_row.inc
--source include/master-slave.inc
--connection slave
--source include/stop_slave.inc
--connection master
--let $datadir= `SELECT @@datadir`
--let $rpl_server_number= 1
--source include/rpl_stop_server.inc
--remove_file $datadir/master-bin.000001
--remove_file $datadir/master-bin.state
--copy_file $MYSQL_TEST_DIR/std_data/mdev6020-mysql-bin.000001 $datadir/master-bin.000001
--let $rpl_server_number= 1
--source include/rpl_start_server.inc
--source include/wait_until_connected_again.inc
--connection slave
SET SQL_LOG_BIN=0;
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
SET SQL_LOG_BIN=1;
SET @old_engine= @@GLOBAL.default_storage_engine;
SET GLOBAL default_storage_engine=InnoDB;
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=12;
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
--source include/start_slave.inc
--connection master
SET SQL_LOG_BIN=0;
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
SET SQL_LOG_BIN=1;
--save_master_pos
--connection slave
--sync_with_master
SELECT @@gtid_slave_pos;
CHECKSUM TABLE table0_int_autoinc, table0_key_pk_parts_2_int_autoinc, table100_int_autoinc, table100_key_pk_parts_2_int_autoinc, table10_int_autoinc, table10_key_pk_parts_2_int_autoinc, table1_int_autoinc, table1_key_pk_parts_2_int_autoinc, table2_int_autoinc, table2_key_pk_parts_2_int_autoinc;
--source include/stop_slave.inc
SET GLOBAL default_storage_engine= @old_engine;
SET GLOBAL slave_parallel_threads=@old_parallel;
SET sql_log_bin=0;
DROP TABLE table0_int_autoinc;
DROP TABLE table0_key_pk_parts_2_int_autoinc;
DROP TABLE table100_int_autoinc;
DROP TABLE table100_key_pk_parts_2_int_autoinc;
DROP TABLE table10_int_autoinc;
DROP TABLE table10_key_pk_parts_2_int_autoinc;
DROP TABLE table1_int_autoinc;
DROP TABLE table1_key_pk_parts_2_int_autoinc;
DROP TABLE table2_int_autoinc;
DROP TABLE table2_key_pk_parts_2_int_autoinc;
SET sql_log_bin=1;
--source include/start_slave.inc
--connection master
--source include/rpl_end.inc

View File

@ -0,0 +1 @@
--disable-log-slave-updates

View File

@ -0,0 +1,71 @@
--source include/have_innodb.inc
--source include/master-slave.inc
--connection master
# ToDo: Remove this FLUSH LOGS when MDEV-6403 is fixed.
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
--sync_slave_with_master
--connection slave
--source include/stop_slave.inc
# Provoke a duplicate key error on replication.
SET sql_log_bin= 0;
INSERT INTO t1 VALUES (1, 2);
SET sql_log_bin= 1;
CHANGE MASTER TO master_use_gtid= current_pos;
--echo Contents on slave before:
SELECT * FROM t1 ORDER BY a;
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=8;
--connection master
CREATE TEMPORARY TABLE t2 LIKE t1;
INSERT INTO t2 VALUE (1, 1);
INSERT INTO t2 VALUE (2, 1);
INSERT INTO t2 VALUE (3, 1);
INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2;
--save_master_pos
--echo Contents on master:
SELECT * FROM t1 ORDER BY a;
--connection slave
START SLAVE;
# The slave will stop with a duplicate key error.
# The bug was 1) that the next DROP TEMPORARY TABLE would be allowed to run
# anyway, and 2) that then record_gtid() would get an error during commit
# (since the prior commit failed), and this error was not correctly handled,
# which caused an assertion about closing tables while a statement was still
# active.
--let $slave_sql_errno=1062
--source include/wait_for_slave_sql_error.inc
STOP SLAVE IO_THREAD;
--echo Contents on slave on slave error:
SELECT * FROM t1 ORDER BY a;
# Resolve the duplicate key error so replication can be resumed.
SET sql_log_bin= 0;
DELETE FROM t1 WHERE a=1;
SET sql_log_bin= 1;
--source include/start_slave.inc
--sync_with_master
--echo Contents on slave after:
SELECT * FROM t1 ORDER BY a;
--connection master
DROP TABLE t1;
--connection slave
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads= @old_parallel;
--source include/start_slave.inc
--source include/rpl_end.inc

View File

@ -5,11 +5,9 @@
# options are added into mysql_upgrade. These options control whether sql
# statements are binlogged or not.
#############################################################################
--source include/master-slave.inc
--source include/have_innodb.inc
# Only run test if "mysql_upgrade" is found
--source include/have_mysql_upgrade.inc
--source include/mysql_upgrade_preparation.inc
--source include/master-slave.inc
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("table or database name 'mysqltest-1'");

View File

@ -438,7 +438,7 @@ SET debug_sync='now WAIT_FOR t2_killed';
# Now we can allow T1 to proceed.
SET debug_sync='now SIGNAL t1_cont';
--let $slave_sql_errno= 1317,1964
--let $slave_sql_errno= 1317,1927,1964
--source include/wait_for_slave_sql_error.inc
STOP SLAVE IO_THREAD;
SELECT * FROM t3 WHERE a >= 30 ORDER BY a;
@ -573,7 +573,7 @@ SET debug_sync='now WAIT_FOR t2_killed';
# Now we can allow T1 to proceed.
SET debug_sync='now SIGNAL t1_cont';
--let $slave_sql_errno= 1317,1964
--let $slave_sql_errno= 1317,1927,1964
--source include/wait_for_slave_sql_error.inc
# Now we have to disable the debug_sync statements, so they do not trigger
@ -712,7 +712,7 @@ SET debug_sync='now WAIT_FOR t2_killed';
# Now we can allow T1 to proceed.
SET debug_sync='now SIGNAL t1_cont';
--let $slave_sql_errno= 1317,1964
--let $slave_sql_errno= 1317,1927,1964
--source include/wait_for_slave_sql_error.inc
SELECT * FROM t3 WHERE a >= 50 ORDER BY a;
@ -1246,10 +1246,78 @@ SET debug_sync='RESET';
--connection server_2
--source include/start_slave.inc
--sync_with_master
--source include/stop_slave.inc
SELECT * FROM t4 ORDER BY a;
# MDEV-6549, failing to update gtid_slave_pos for a transaction that was retried.
# The problem was that when a transaction updates the mysql.gtid_slave_pos
# table, it clears the flag that marks that there is a GTID position that
# needs to be updated. Then, if the transaction got killed after that due
# to a deadlock, the subsequent retry would fail to notice that the GTID needs
# to be recorded in gtid_slave_pos.
#
# (In the original bug report, the symptom was an assertion; this was however
# just a side effect of the missing update of gtid_slave_pos, which also
# happened to cause a missing clear of OPTION_GTID_BEGIN).
--connection server_1
DELETE FROM t4;
INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
# Create two transactions that can run in parallel on the slave but cause
# a deadlock if the second runs before the first.
--connection con1
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1';
send UPDATE t4 SET b=NULL WHERE a=6;
--connection server_1
SET debug_sync='now WAIT_FOR master_queued1';
--connection con2
# Must use statement-based binlogging. Otherwise the transaction will not be
# binlogged at all, as it modifies no rows.
SET @old_format= @@SESSION.binlog_format;
SET binlog_format='statement';
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2';
send DELETE FROM t4 WHERE b <= 1;
--connection server_1
SET debug_sync='now WAIT_FOR master_queued2';
SET debug_sync='now SIGNAL master_cont1';
--connection con1
REAP;
--connection con2
REAP;
SET @old_format=@@GLOBAL.binlog_format;
SET debug_sync='RESET';
--save_master_pos
--let $last_gtid= `SELECT @@last_gtid`
--connection server_2
# Disable the usual skip of gap locks for transactions that are run in
# parallel, using DBUG. This allows the deadlock to occur, and this in turn
# triggers a retry of the second transaction, and the code that was buggy and
# caused the gtid_slave_pos update to be skipped in the retry.
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with";
--source include/start_slave.inc
--sync_with_master
SET GLOBAL debug_dbug=@old_dbug;
SELECT * FROM t4 ORDER BY a;
# Check that the GTID of the second transaction was correctly recorded in
# gtid_slave_pos, in the variable as well as in the table.
--replace_result $last_gtid GTID
eval SET @last_gtid= '$last_gtid';
SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok",
CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos))
AS result;
SELECT "ROW FOUND" AS `Is the row found?`
FROM mysql.gtid_slave_pos
WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid;
--echo *** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication ***
--connection server_2
--source include/stop_slave.inc
@ -1277,6 +1345,7 @@ eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS t
--connection server_1
FLUSH LOGS;
--source include/wait_for_binlog_checkpoint.inc
--save_master_pos
--connection server_2
@ -1291,6 +1360,112 @@ eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS t
--enable_query_log
--echo *** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error ***
--connection server_1
CREATE TABLE t6 (a INT) ENGINE=MyISAM;
CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1;
--connection con1
SET @old_format= @@binlog_format;
SET binlog_format= statement;
--let $conid = `SELECT CONNECTION_ID()`
SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont';
send INSERT INTO t6 VALUES (1), (2), (3);
--connection server_1
SET debug_sync='now WAIT_FOR ready';
--replace_result $conid CONID
eval KILL QUERY $conid;
SET debug_sync='now SIGNAL cont';
--connection con1
--error ER_QUERY_INTERRUPTED
--reap
SET binlog_format= @old_format;
SET debug_sync='RESET';
--let $after_error_gtid_pos= `SELECT @@gtid_binlog_pos`
--connection server_1
SET debug_sync='RESET';
--connection server_2
--let $slave_sql_errno= 1317
--source include/wait_for_slave_sql_error.inc
STOP SLAVE IO_THREAD;
--replace_result $after_error_gtid_pos AFTER_ERROR_GTID_POS
eval SET GLOBAL gtid_slave_pos= '$after_error_gtid_pos';
--source include/start_slave.inc
--connection server_1
INSERT INTO t6 VALUES (4);
SELECT * FROM t6 ORDER BY a;
--save_master_pos
--connection server_2
--sync_with_master
SELECT * FROM t6 ORDER BY a;
--echo *** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 ***
--connection server_1
INSERT INTO t2 VALUES (31);
--source include/save_master_gtid.inc
--connection server_2
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads= 0;
--source include/start_slave.inc
# Force a duplicate key error on the slave.
SET sql_log_bin= 0;
INSERT INTO t2 VALUES (32);
SET sql_log_bin= 1;
--connection server_1
INSERT INTO t2 VALUES (32);
# Rotate the binlog; the bug is triggered when the master binlog file changes
# after the event group that causes the duplicate key error.
FLUSH LOGS;
INSERT INTO t2 VALUES (33);
INSERT INTO t2 VALUES (34);
SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--let $slave_sql_errno= 1062
--source include/wait_for_slave_sql_error.inc
--connection server_2
--source include/stop_slave_io.inc
SET GLOBAL slave_parallel_threads=10;
START SLAVE;
--let $slave_sql_errno= 1062
--source include/wait_for_slave_sql_error.inc
# Note: IO thread is still running at this point.
# The bug seems to have been that restarting the SQL thread after an error with
# the IO thread still running, somehow picks up a later relay log position and
# thus ends up skipping the failing event, rather than re-executing.
START SLAVE SQL_THREAD;
--let $slave_sql_errno= 1062
--source include/wait_for_slave_sql_error.inc
SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
# Skip the duplicate error, so we can proceed.
SET sql_slave_skip_counter= 1;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
@ -1299,7 +1474,7 @@ SET DEBUG_SYNC= 'RESET';
--connection server_1
DROP function foo;
DROP TABLE t1,t2,t3,t4,t5;
DROP TABLE t1,t2,t3,t4,t5,t6;
SET DEBUG_SYNC= 'RESET';
--source include/rpl_end.inc

View File

@ -0,0 +1,220 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
--echo *** Test retry of transactions that fail to replicate due to deadlock or similar temporary error. ***
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1);
--save_master_pos
# Use a stored function to inject a debug_sync into the appropriate THD.
# The function does nothing on the master, and on the slave it injects the
# desired debug_sync action(s).
SET sql_log_bin=0;
--delimiter ||
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
RETURNS INT DETERMINISTIC
BEGIN
RETURN x;
END
||
--delimiter ;
SET sql_log_bin=1;
--connection server_2
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
--source include/start_slave.inc
--sync_with_master
SET sql_log_bin=0;
--delimiter ||
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
RETURNS INT DETERMINISTIC
BEGIN
IF d1 != '' THEN
SET debug_sync = d1;
END IF;
IF d2 != '' THEN
SET debug_sync = d2;
END IF;
RETURN x;
END
||
--delimiter ;
SET sql_log_bin=1;
--source include/stop_slave.inc
--connection server_1
SET gtid_seq_no = 100;
BEGIN;
INSERT INTO t1 VALUES (2,1);
UPDATE t1 SET b=b+1 WHERE a=1;
INSERT INTO t1 VALUES (3,1);
COMMIT;
SELECT * FROM t1 ORDER BY a;
--save_master_pos
--connection server_2
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100";
let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
--source include/start_slave.inc
--sync_with_master
SET GLOBAL debug_dbug=@old_dbug;
let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
--disable_query_log
eval SELECT $new_retry - $old_retry AS retries;
--enable_query_log
SELECT * FROM t1 ORDER BY a;
--echo *** Test that double retry works when the first retry also fails with temp error ***
--source include/stop_slave.inc
--connection server_1
SET gtid_seq_no = 100;
SET @old_server_id = @@server_id;
SET server_id = 10;
BEGIN;
INSERT INTO t1 VALUES (4,1);
UPDATE t1 SET b=b+1 WHERE a=1;
INSERT INTO t1 VALUES (5,1);
INSERT INTO t1 VALUES (6,1);
COMMIT;
SET server_id = @old_server_id;
SELECT * FROM t1 ORDER BY a;
--save_master_pos
--connection server_2
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100,rpl_parallel_simulate_double_temp_err_gtid_0_x_100";
let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
--source include/start_slave.inc
--sync_with_master
SET GLOBAL debug_dbug=@old_dbug;
let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
--disable_query_log
eval SELECT $new_retry - $old_retry AS retries;
--enable_query_log
SELECT * FROM t1 ORDER BY a;
--echo *** Test too many retries, eventually causing failure. ***
--source include/stop_slave.inc
--connection server_1
SET gtid_seq_no = 100;
SET @old_server_id = @@server_id;
SET server_id = 11;
BEGIN;
INSERT INTO t1 VALUES (7,1);
UPDATE t1 SET b=b+1 WHERE a=1;
INSERT INTO t1 VALUES (8,1);
INSERT INTO t1 VALUES (9,1);
COMMIT;
SET server_id = @old_server_id;
SELECT * FROM t1 ORDER BY a;
--save_master_pos
--connection server_2
SET sql_log_bin=0;
CALL mtr.add_suppression("Slave worker thread retried transaction 10 time\\(s\\) in vain, giving up");
CALL mtr.add_suppression("Slave: Deadlock found when trying to get lock; try restarting transaction");
SET sql_log_bin=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100,rpl_parallel_simulate_infinite_temp_err_gtid_0_x_100";
let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
START SLAVE;
--let $slave_sql_errno= 1213
--let $slave_timeout= 10
--source include/wait_for_slave_sql_error.inc
SET GLOBAL debug_dbug=@old_dbug;
let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
--disable_query_log
eval SELECT $new_retry - $old_retry AS retries;
--enable_query_log
SELECT * FROM t1 ORDER BY a;
STOP SLAVE IO_THREAD;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 ORDER BY a;
--echo *** Test retry of event group that spans multiple relay log files. ***
--connection server_1
CREATE TABLE t2 (a int PRIMARY KEY, b BLOB) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,"Hulubullu");
--save_master_pos
--connection server_2
--sync_with_master
--source include/stop_slave.inc
SET @old_max= @@GLOBAL.max_relay_log_size;
SET GLOBAL max_relay_log_size=4096;
--connection server_1
--let $big= `SELECT REPEAT("*", 5000)`
SET gtid_seq_no = 100;
SET @old_server_id = @@server_id;
SET server_id = 12;
BEGIN;
--disable_query_log
eval INSERT INTO t2 VALUES (2, CONCAT("Hello ", "$big"));
eval INSERT INTO t2 VALUES (3, CONCAT("Long data: ", "$big"));
--enable_query_log
INSERT INTO t1 VALUES (10, 4);
COMMIT;
SET server_id = @old_server_id;
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
SELECT a, LENGTH(b) FROM t2 ORDER BY a;
--save_master_pos
--connection server_2
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100";
let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
--source include/start_slave.inc
--sync_with_master
SET GLOBAL debug_dbug=@old_dbug;
let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
--disable_query_log
eval SELECT $new_retry - $old_retry AS retries;
--enable_query_log
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
SELECT a, LENGTH(b) FROM t2 ORDER BY a;
--connection server_1
INSERT INTO t1 VALUES (11,11);
--disable_query_log
eval INSERT INTO t2 VALUES (4, "$big");
--enable_query_log
--save_master_pos
--connection server_2
--sync_with_master
SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
SELECT a, LENGTH(b) FROM t2 ORDER BY a;
SET GLOBAL max_relay_log_size=@old_max;
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_1
DROP TABLE t1, t2;
DROP function foo;
--source include/rpl_end.inc

View File

@ -0,0 +1 @@
--skip-stack-trace --skip-core-file

View File

@ -0,0 +1,222 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_binlog_format_statement.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
--echo *** MDEV-6321: close_temporary_tables() in format description event not serialised correctly ***
--connection server_2
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
CHANGE MASTER TO master_use_gtid= current_pos;
--source include/start_slave.inc
--connection server_1
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(100) CHARACTER SET utf8);
--save_master_pos
--connection server_2
--sync_with_master
--source include/stop_slave.inc
--connection server_1
SET gtid_domain_id= 1;
INSERT INTO t1 VALUES (1, 0);
CREATE TEMPORARY TABLE t2 (a int);
--connection default
SET gtid_domain_id= 2;
CREATE TEMPORARY TABLE t3 (a INT PRIMARY KEY);
CREATE TEMPORARY TABLE t4 (a int);
INSERT INTO t3 VALUES (100);
INSERT INTO t4 SELECT a+1 FROM t3;
--connection server_1
INSERT INTO t2 VALUES (2), (4), (6), (8), (10), (12), (14), (16), (18), (20);
INSERT INTO t2 VALUES (3), (6), (9), (12), (15), (18);
INSERT INTO t2 VALUES (4), (8), (12), (16), (20);
--connection default
INSERT INTO t3 SELECT a+2 FROM t4;
INSERT INTO t4 SELECT a+4 FROM t3;
--connection server_1
INSERT INTO t2 VALUES (5), (10), (15), (20);
INSERT INTO t2 VALUES (6), (12), (18);
INSERT INTO t2 VALUES (7), (14);
INSERT INTO t2 VALUES (8), (16);
INSERT INTO t2 VALUES (9), (18);
INSERT INTO t2 VALUES (10), (20);
--connection default
INSERT INTO t3 SELECT a+8 FROM t4;
INSERT INTO t4 SELECT a+16 FROM t3;
--connection server_1
INSERT INTO t2 VALUES (11);
INSERT INTO t2 VALUES (12);
INSERT INTO t2 VALUES (13);
--connection default
INSERT INTO t3 SELECT a+32 FROM t4;
--connection server_1
INSERT INTO t2 VALUES (14);
INSERT INTO t2 VALUES (15);
INSERT INTO t2 VALUES (16);
--connection default
INSERT INTO t4 SELECT a+64 FROM t3;
--connection server_1
INSERT INTO t2 VALUES (17);
INSERT INTO t2 VALUES (18);
INSERT INTO t2 VALUES (19);
--connection default
INSERT INTO t3 SELECT a+128 FROM t4;
--connection server_1
INSERT INTO t2 VALUES (20);
--connection default
INSERT INTO t1 SELECT a, a MOD 7 FROM t3;
INSERT INTO t1 SELECT a, a MOD 7 FROM t4;
--connection server_1
INSERT INTO t1 SELECT a, COUNT(*) FROM t2 GROUP BY a;
# Crash the master server, so that temporary tables are implicitly dropped.
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
FLUSH TABLES;
SET SESSION debug_dbug="+d,crash_dispatch_command_before";
--error 2006,2013
SELECT 1;
--source include/wait_until_disconnected.inc
--connection default
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
--connection default
--enable_reconnect
--source include/wait_until_connected_again.inc
--connection server_1
--enable_reconnect
--source include/wait_until_connected_again.inc
INSERT INTO t1 VALUES (0, 1);
--save_master_pos
--connection server_2
# Start the slave replicating the events.
# The bug was that the format description event written after the crash could
# be fetched ahead of the execution of the temporary table events and executed
# out-of-band. This would cause drop of all temporary tables and thus failure
# for execution of remaining events.
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 WHERE a <= 20 ORDER BY a;
SELECT COUNT(*) FROM t1 WHERE a BETWEEN 100+0 AND 100+256;
SHOW STATUS LIKE 'Slave_open_temp_tables';
--echo *** Test that if master logged partial event group before crash, we finish that group correctly before executing format description event ***
--source include/stop_slave.inc
--connection server_1
CALL mtr.add_suppression("Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them");
SET gtid_domain_id= 1;
DELETE FROM t1;
ALTER TABLE t1 ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY);
INSERT INTO t2 VALUES (1);
INSERT INTO t2 VALUES (2);
--connection default
SET gtid_domain_id= 2;
CREATE TEMPORARY TABLE t3 (a INT PRIMARY KEY);
INSERT INTO t3 VALUES (10);
INSERT INTO t3 VALUES (20);
--connection server_1
INSERT INTO t1 SELECT a, 'server_1' FROM t2;
--connection default
INSERT INTO t1 SELECT a, 'default' FROM t3;
--connection server_1
INSERT INTO t1 SELECT a+2, '+server_1' FROM t2;
# Crash the master server in the middle of writing an event group.
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
FLUSH TABLES;
SET SESSION debug_dbug="+d,crash_before_writing_xid";
--error 2006,2013
INSERT INTO t1 SELECT a+4, '++server_1' FROM t2;
--source include/wait_until_disconnected.inc
--connection default
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
--connection default
--enable_reconnect
--source include/wait_until_connected_again.inc
--connection server_1
--enable_reconnect
--source include/wait_until_connected_again.inc
INSERT INTO t1 VALUES (0, 1);
#--save_master_pos
--source include/save_master_gtid.inc
--connection server_2
# Start the slave replicating the events.
# The main thing to test here is that the slave will know that it
# needs to abort the partially received event group, so that the
# execution of format_description event will not wait infinitely
# for a commit of the incomplete group that never happens.
--source include/start_slave.inc
#--sync_with_master
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
SHOW STATUS LIKE 'Slave_open_temp_tables';
--connection server_1
# This FLUSH can be removed once MDEV-6608 is fixed.
FLUSH LOGS;
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_1
DROP TABLE t1;
--source include/rpl_end.inc

View File

@ -0,0 +1,43 @@
# ==== Purpose ====
#
# - Verify that the post-WL#344 format of relay_log.info can be parsed.
--source include/master-slave.inc
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
--sync_slave_with_master
--echo ==== Check that we can understand the new format of relay-log.info ====
--source include/stop_slave.inc
RESET SLAVE;
--let $MYSQLD_DATADIR= `select @@datadir`
# the new version of relay_log.info comes in two versions: with path
# separator '/' (most systems) and with path separator '\' (windows)
if ($SYSTEM_PATH_SEPARATOR != /) {
--let $file_suffix= -win
}
--copy_file $MYSQL_TEST_DIR/std_data/new-format-relay-log$file_suffix.info $MYSQLD_DATADIR/relay-log.info
--echo # Read relay-log.info
START SLAVE IO_THREAD;
--source include/wait_for_slave_io_to_start.inc
--echo # Check that relay log coordinates are equal to those saved in new-format_relay-log.info
--let $master_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
--let $master_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
--let $relay_log_pos= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1)
--echo $master_file= $master_file, $master_pos, $relay_log_file, $relay_log_pos
if (`SELECT "$master_file" != "" OR
"$master_pos" != "0" OR
"$relay_log_file" != "slave-relay-bin.000001" OR
"$relay_log_pos" != "4"`) {
--echo ERROR: log coordinates changed
--die log coordinates changed
}
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

View File

@ -0,0 +1,44 @@
# ==== Purpose ====
#
# - Verify that the pre-WL#344 format of relay_log.info can still be
# parsed.
--source include/master-slave.inc
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
--sync_slave_with_master
--echo ==== Check that we still understand the old format of relay-log.info ====
--source include/stop_slave.inc
RESET SLAVE;
--let $MYSQLD_DATADIR= `select @@datadir`
# the old version of relay_log.info comes in two versions: with path
# separator '/' (most systems) and with path separator '\' (windows)
if ($SYSTEM_PATH_SEPARATOR != /) {
--let $file_suffix= -win
}
--copy_file $MYSQL_TEST_DIR/std_data/old-format-relay-log$file_suffix.info $MYSQLD_DATADIR/relay-log.info
--echo # Read relay-log.info
START SLAVE IO_THREAD;
--source include/wait_for_slave_io_to_start.inc
--echo # Check that relay log coordinates are equal to those we saved in old-format_relay-log.info
--let $master_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
--let $master_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
--let $relay_log_pos= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1)
--echo $master_file= $master_file, $master_pos, $relay_log_file, $relay_log_pos
if (`SELECT "$master_file" != "" OR
"$master_pos" != "0" OR
"$relay_log_file" != "slave-relay-bin.000001" OR
"$relay_log_pos" != "4"`) {
--echo ERROR: log coordinates changed
--die log coordinates changed
}
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

View File

@ -0,0 +1,138 @@
###############################################################################
# Bug#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK
# Problem: Uninstallation of Semi sync plugin should be blocked when it is
# in use.
# Test case: Uninstallation of semi sync should be allowed
# On Master:
# 1) When there is no dump thread
# 2) When there are no semi sync slaves (i.e., async replication).
# On Slave:
# 1) When there is no I/O thread
# 2) When there are no semi sync enabled I/O thread (i.e.,async replication).
###############################################################################
--source include/have_semisync_plugin.inc
--source include/not_embedded.inc
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
call mtr.add_suppression("Read semi-sync reply network error");
call mtr.add_suppression("Timeout waiting for reply of binlog");
###############################################################################
# Case 1: Uninstallation of semi sync plugins should be allowed when it is
# not in use i.e., when asynchronous replication is active.
###############################################################################
# Step 1.1: Install semi sync master plugin on master
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
# Step 1.2: Install semi sync slave plugin on slave
--connection slave
--echo [connection slave]
INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave';
# Step 1.3: Uninstallation of semisync plugin on master and slave should be
# allowed at this state as there is no semi sync replication enabled between
# master and slave.
UNINSTALL PLUGIN rpl_semi_sync_slave;
--connection master
--echo [connection master]
UNINSTALL PLUGIN rpl_semi_sync_master;
# Step 1.4: Check that replication is working fine at the end of the test case.
CREATE TABLE t1(i int);
INSERT INTO t1 values (1);
DROP TABLE t1;
--sync_slave_with_master
--echo [connection slave]
###############################################################################
# Case 2: Uninstallation of semi sync plugins should be disallowed
# when it is in use i.e., when semi sync replication is active
###############################################################################
# Step 2.1: Install and enable semi sync replication between master and slave
--source include/install_semisync.inc
# Step 2.2: Check that rpl_semi_sync_slave uninstallation on Slave is not
# possible at this state
--connection slave
--echo [connection slave]
UNINSTALL PLUGIN rpl_semi_sync_slave;
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
# Step 2.3: Check that rpl_semi_sync_master uninstallation on Master is not
# possible at this state
--connection master
--echo [connection master]
UNINSTALL PLUGIN rpl_semi_sync_master;
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
# Step 2.4: Check that replication is working fine at the end of the test case.
CREATE TABLE t1(i int);
INSERT INTO t1 values (2);
DROP TABLE t1;
--sync_slave_with_master
--echo [connection slave]
# Step 2.5: Make sure rpl_semi_sync_master_status on Master and
# rpl_semi_sync_slave_staus on Slave are ON
show status like "Rpl_semi_sync_slave_status";
###############################################################################
# Case 3: Uninstallation of semi sync plugin should be disallowed when there
# are semi sync slaves even though rpl_semi_sync_master_enabled= OFF;.
###############################################################################
# Step 3.1: Disable semi sync on master
--connection master
--echo [connection master]
show status like "Rpl_semi_sync_master_status";
# Step 3.2: Check that still Rpl_semi_sync_master_clients is 1
show status like "Rpl_semi_sync_master_clients";
# Step 3.3: Since Rpl_semi_sync_master_clients is 1, uninstallation of
# rpl_semi_sync_master should be disallowed.
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
###############################################################################
# Case 4: Uninstallation of semi sync plugin should be allowed when it is not
# in use. Same as Case 1 but this case is to check the case after enabling and
# disabling semi sync replication.
###############################################################################
# Step 4.1: Stop IO thread on slave.
--connection slave
--echo [connection slave]
--source include/stop_slave.inc
# Step 4.2: Disable semi sync on slave.
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
--connection master
--echo [connection master]
# Send something to the slave so that the master would notice that nobody's listening.
create table t2 (a int); drop table t2;
# and wait for plugin to be unloaded automatically
let $wait_condition=select count(*) = 0 from information_schema.plugins where plugin_name like 'rpl_%';
--source include/wait_condition.inc
--connection slave
--echo [connection slave]
# Step 4.3: Start IO thread on slave.
--source include/start_slave.inc
# Step 4.4: Uninstall semi sync plugin, it should be successful now.
select plugin_name,plugin_status from information_schema.plugins where plugin_name like 'rpl_%';
# Step 4.7: Check that replication is working fine at the end of the test case
--connection master
--echo [connection master]
CREATE TABLE t1(i int);
INSERT INTO t1 values (3);
DROP TABLE t1;
--sync_slave_with_master
--echo [connection slave]
# Cleanup
source include/rpl_end.inc;

View File

@ -0,0 +1 @@
--loose-debug=+d,incident_database_resync_on_replace

View File

@ -0,0 +1 @@
--slave-skip-error=1590

View File

@ -0,0 +1,28 @@
--source include/master-slave.inc
--source include/have_debug.inc
--echo **** On Master ****
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
# This will generate an incident log event and store it in the binary
# log before the replace statement.
REPLACE INTO t1 VALUES (4);
--sync_slave_with_master
# Now, we should have inserted the row into the table and the slave
# should be running. We should also have rotated to a new binary log.
SELECT * FROM t1;
source include/check_slave_is_running.inc;
connection master;
--echo Should have two binary logs here
--source include/show_binary_logs.inc
DROP TABLE t1;
--sync_slave_with_master
--source include/rpl_end.inc

View File

@ -614,7 +614,7 @@ show function status like '%mysqltestbug36570%';
connection master;
flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_regex s/$MYSQL_TEST_DIR/MYSQL_TEST_DIR/ s/TIMESTAMP=[0-9]*/TIMESTAMP=t/
--replace_regex /$MYSQL_TEST_DIR/MYSQL_TEST_DIR/ /TIMESTAMP=[0-9]*/TIMESTAMP=t/
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
use test;
drop procedure mysqltestbug36570_p1;

View File

@ -74,14 +74,17 @@ CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
sync_slave_with_master;
--source include/stop_slave.inc
--source include/rpl_connection_master.inc
# make sure that there are no zombie threads
--source include/stop_dump_threads.inc
let $debug_save= `SELECT @@GLOBAL.debug`;
SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*';
--source include/rpl_connection_slave.inc
source include/restart_slave_sql.inc;
--source include/start_slave.inc
BEGIN;
UPDATE t1 SET c2 = 2 WHERE c1 = 1;
@ -93,6 +96,10 @@ INSERT INTO t2 VALUES(1);
UPDATE t1 SET c2 = 3 WHERE c1 = 1;
COMMIT;
# wait for the dump thread reach the sync point
--let $wait_condition= select count(*)=1 from information_schema.processlist where state LIKE '%debug sync point%' and command='Binlog Dump'
--source include/wait_condition.inc
--source include/rpl_connection_slave1.inc
let $show_statement= SHOW PROCESSLIST;
let $field= Info;
@ -105,6 +112,7 @@ send STOP SLAVE;
ROLLBACK;
--source include/rpl_connection_master.inc
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
@ -113,12 +121,25 @@ source include/wait_for_slave_to_stop.inc;
--source include/rpl_connection_slave1.inc
reap;
# Slave has stopped, thence lets make sure that
# we kill the zombie dump threads. Also, make
# sure that we disable the DBUG_EXECUTE_IF
# that would set the dump thread to wait
--source include/rpl_connection_master.inc
--disable_query_log
eval SET GLOBAL debug_dbug= '$debug_save';
--enable_query_log
# make sure that there are no zombie threads
--source include/stop_dump_threads.inc
--source include/rpl_connection_slave1.inc
# now the dump thread on the master will start
# from a clean slate, i.e. without the
# DBUG_EXECUTE_IF set
source include/start_slave.inc;
--source include/rpl_connection_master.inc
DROP TABLE t1, t2;
--disable_query_log
eval SET GLOBAL debug_dbug= '$debug_save';
--enable_query_log
--source include/rpl_end.inc
SET DEBUG_SYNC= 'RESET';

View File

@ -23,6 +23,8 @@ show create table t1;
sync_slave_with_master;
connection slave;
show create table t1;
set sql_mode=ignore_bad_table_options;
show create table t1;
connection master;
drop table t1;