mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.2 to 10.3
This commit is contained in:
20
mysql-test/suite/rpl/r/rpl_create_or_replace_fail.result
Normal file
20
mysql-test/suite/rpl/r/rpl_create_or_replace_fail.result
Normal file
@@ -0,0 +1,20 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
CREATE TEMPORARY TABLE t1 (a INT NOT NULL);
|
||||
LOAD DATA INFILE 'x' INTO TABLE x;
|
||||
ERROR 42S02: Table 'test.x' doesn't exist
|
||||
CREATE OR REPLACE TEMPORARY TABLE t1 (x INT) PARTITION BY HASH(x);
|
||||
ERROR HY000: Cannot create temporary table with partitions
|
||||
"************** DROP TEMPORARY TABLE Should be present in Binary log **************"
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t1 (a INT NOT NULL)
|
||||
master-bin.000001 # Gtid # # GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TEMPORARY TABLE t1 (x INT) PARTITION BY HASH(x)
|
||||
CREATE TABLE t1 (b INT);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
connection slave;
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
include/rpl_end.inc
|
@@ -41,7 +41,7 @@ START SLAVE;
|
||||
.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
|
||||
...==== BEGIN include/wait_for_slave_param.inc [Slave_IO_Running] ====
|
||||
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
|
||||
Waiting until 'Slave_IO_Running' = 'Yes' [timeout='300', $slave_error_param='Last_IO_Errno']
|
||||
Waiting until 'Slave_IO_Running' = 'Yes' [$slave_error_param='Last_IO_Errno']
|
||||
[connection slave]
|
||||
...==== END include/wait_for_slave_param.inc [Slave_IO_Running] ====
|
||||
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
|
||||
@@ -52,7 +52,7 @@ Waiting until 'Slave_IO_Running' = 'Yes' [timeout='300', $slave_error_param='Las
|
||||
.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
|
||||
...==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ====
|
||||
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
|
||||
Waiting until 'Slave_SQL_Running' = 'Yes' [timeout='300', $slave_error_param='1']
|
||||
Waiting until 'Slave_SQL_Running' = 'Yes' [$slave_error_param='1']
|
||||
[connection slave]
|
||||
...==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ====
|
||||
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
|
||||
|
@@ -1,31 +1,5 @@
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
|
||||
UNIQUE(b));
|
||||
connection slave;
|
||||
connection master;
|
||||
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 10
|
||||
2 2
|
||||
connection slave;
|
||||
call mtr.add_suppression("Slave SQL.*suffer.*http:..bugs.mysql.com.bug.php.id=24432");
|
||||
include/wait_for_slave_sql_error.inc [errno=1105]
|
||||
Last_SQL_Error = 'Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10''
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
stop slave;
|
||||
include/wait_for_slave_to_stop.inc
|
||||
reset slave;
|
||||
connection master;
|
||||
reset master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
start slave;
|
||||
include/wait_for_slave_to_start.inc
|
||||
connection master;
|
||||
CREATE TABLE t1 (
|
||||
id bigint(20) unsigned NOT NULL auto_increment,
|
||||
|
129
mysql-test/suite/rpl/r/rpl_mdev_17614.result
Normal file
129
mysql-test/suite/rpl/r/rpl_mdev_17614.result
Normal file
@@ -0,0 +1,129 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY , b INT,
|
||||
UNIQUE(b), c int) engine=innodb;
|
||||
connection slave;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, 1, 1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (2, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
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
|
||||
connection master1;
|
||||
INSERT INTO t1 VALUES(2, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
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
|
||||
connection master;
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
1 1 2
|
||||
2 2 3
|
||||
connection slave;
|
||||
include/wait_for_slave_sql_error.inc [errno=1062]
|
||||
Last_SQL_Error = 'Error 'Duplicate entry '1' for key 'b'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (2, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c)''
|
||||
#Different value from server
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
1 1 1
|
||||
2 2 3
|
||||
stop slave;
|
||||
include/wait_for_slave_to_stop.inc
|
||||
reset slave;
|
||||
connection master;
|
||||
reset master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
start slave;
|
||||
include/wait_for_slave_to_start.inc
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT,
|
||||
UNIQUE(b), c int) engine=innodb;
|
||||
connection slave;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (default, 1, 1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (default, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
connection master1;
|
||||
INSERT INTO t1 VALUES(default, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
connection master;
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
1 1 2
|
||||
3 2 3
|
||||
connection slave;
|
||||
#same data as master
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
1 1 2
|
||||
3 2 3
|
||||
connection master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT,
|
||||
UNIQUE(b), c int, d int ) engine=innodb;
|
||||
connection slave;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, 1, 1, 1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (2, NULL, 2, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
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
|
||||
connection master1;
|
||||
INSERT INTO t1 VALUES(3, NULL, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
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
|
||||
connection master;
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
a b c d
|
||||
1 1 1 1
|
||||
2 NULL 2 2
|
||||
3 NULL 2 3
|
||||
connection slave;
|
||||
#same data as master
|
||||
SELECT * FROM t1;
|
||||
a b c d
|
||||
1 1 1 1
|
||||
2 NULL 2 2
|
||||
3 NULL 2 3
|
||||
connection master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT,
|
||||
UNIQUE(b), c int) engine=innodb;
|
||||
connection slave;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, 1, 1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (2, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
connection master1;
|
||||
INSERT INTO t1 VALUES(2, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
connection master;
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
1 1 2
|
||||
2 2 3
|
||||
connection slave;
|
||||
include/wait_for_slave_sql_error.inc [errno=1062]
|
||||
Last_SQL_Error = 'Error 'Duplicate entry '1' for key 'b'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (2, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c)''
|
||||
#Different value from server
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
1 1 1
|
||||
2 2 3
|
||||
stop slave;
|
||||
include/wait_for_slave_to_stop.inc
|
||||
reset slave;
|
||||
connection master;
|
||||
reset master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
start slave;
|
||||
include/wait_for_slave_to_start.inc
|
||||
include/rpl_end.inc
|
18
mysql-test/suite/rpl/r/rpl_sync_with_innodb_thd_conc.result
Normal file
18
mysql-test/suite/rpl/r/rpl_sync_with_innodb_thd_conc.result
Normal file
@@ -0,0 +1,18 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
connection slave;
|
||||
SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency;
|
||||
SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay;
|
||||
SET GLOBAL innodb_thread_concurrency = 100;
|
||||
connection master;
|
||||
CREATE TABLE t(f INT) ENGINE=INNODB;
|
||||
INSERT INTO t VALUES (10);
|
||||
connection slave;
|
||||
include/diff_tables.inc [master:t, slave:t]
|
||||
"===== Clean up======="
|
||||
connection master;
|
||||
DROP TABLE t;
|
||||
connection slave;
|
||||
SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
|
||||
SET GLOBAL innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay;
|
||||
include/rpl_end.inc
|
@@ -1,5 +1,6 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
CREATE TABLE t1(id INT AUTO_INCREMENT, i INT, PRIMARY KEY (id)) ENGINE=INNODB;
|
||||
CREATE TABLE t2(id INT AUTO_INCREMENT, i INT, PRIMARY KEY (id)) ENGINE=INNODB;
|
||||
CREATE TRIGGER trig1 AFTER INSERT ON t1
|
||||
@@ -49,9 +50,13 @@ connection master;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(i INT, j INT, UNIQUE KEY(i), UNIQUE KEY(j)) ENGINE=INNODB;
|
||||
INSERT INTO t1 (i,j) VALUES (1,2) ON DUPLICATE KEY UPDATE j=j+1;
|
||||
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
|
||||
START TRANSACTION;
|
||||
LOCK TABLES t1 WRITE;
|
||||
INSERT INTO t1 (i,j) VALUES (1,2) ON DUPLICATE KEY UPDATE j=j+1;
|
||||
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
|
||||
UNLOCK TABLES;
|
||||
COMMIT;
|
||||
connection slave;
|
||||
|
56
mysql-test/suite/rpl/t/rpl_create_or_replace_fail.test
Normal file
56
mysql-test/suite/rpl/t/rpl_create_or_replace_fail.test
Normal file
@@ -0,0 +1,56 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test verifies that failed CREATE OR REPLACE TEMPORARY TABLE statement which
|
||||
# dropped the table but failed at a later stage of creation of temporary table
|
||||
# is written to binarylog in row based replication.
|
||||
#
|
||||
# ==== Implementation ====
|
||||
#
|
||||
# Steps:
|
||||
# 0 - Have mixed based replication mode.
|
||||
# 1 - Create a temporary table. It will be replicated as mixed replication
|
||||
# mode is in use.
|
||||
# 2 - Execute an unsafe statement which will switch current statement
|
||||
# binlog format to 'ROW'. i.e If binlog_format=MIXED, there are open
|
||||
# temporary tables, and an unsafe statement is executed, then subsequent
|
||||
# statements are logged in row format.
|
||||
# 3 - Execute a CREATE OR REPLACE TEMPORARY TABLE statement which tries to
|
||||
# create partitions on temporary table. Since it is not supported it will
|
||||
# fail.
|
||||
# 4 - Check the binary log output to ensure that the failed statement is
|
||||
# written to the binary log.
|
||||
# 5 - Slave should be up and running and in sync with master.
|
||||
#
|
||||
# ==== References ====
|
||||
#
|
||||
# MDEV-18930: Failed CREATE OR REPLACE TEMPORARY not written into binary log
|
||||
# makes data on master and slave diverge
|
||||
#
|
||||
|
||||
--source include/have_partition.inc
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
CREATE TEMPORARY TABLE t1 (a INT NOT NULL);
|
||||
|
||||
# Execute an unsafe statement which switches replication mode internally from
|
||||
# "STATEMENT" to "ROW".
|
||||
--error ER_NO_SUCH_TABLE
|
||||
LOAD DATA INFILE 'x' INTO TABLE x;
|
||||
|
||||
--error ER_PARTITION_NO_TEMPORARY
|
||||
CREATE OR REPLACE TEMPORARY TABLE t1 (x INT) PARTITION BY HASH(x);
|
||||
|
||||
--echo "************** DROP TEMPORARY TABLE Should be present in Binary log **************"
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
CREATE TABLE t1 (b INT);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
--sync_slave_with_master
|
||||
|
||||
# Cleanup
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
@@ -14,45 +14,6 @@ source include/have_binlog_checksum_off.inc;
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
|
||||
|
||||
#
|
||||
# This is to test that slave properly detects if
|
||||
# master may suffer from:
|
||||
# BUG#24432 "INSERT... ON DUPLICATE KEY UPDATE skips auto_increment values"
|
||||
# (i.e. on master, INSERT ON DUPLICATE KEY UPDATE is used and manipulates
|
||||
# an auto_increment column, and is binlogged statement-based).
|
||||
#
|
||||
|
||||
# testcase with INSERT VALUES
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
|
||||
UNIQUE(b));
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
|
||||
SELECT * FROM t1;
|
||||
connection slave;
|
||||
|
||||
# show the error message
|
||||
#1105 = ER_UNKNOWN_ERROR
|
||||
--let $slave_sql_errno= 1105
|
||||
--let $show_slave_sql_error= 1
|
||||
call mtr.add_suppression("Slave SQL.*suffer.*http:..bugs.mysql.com.bug.php.id=24432");
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
# show that it was not replicated
|
||||
SELECT * FROM t1;
|
||||
|
||||
# restart replication for the next testcase
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
reset slave;
|
||||
connection master;
|
||||
reset master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
# testcase with INSERT SELECT
|
||||
connection master;
|
||||
CREATE TABLE t1 (
|
||||
|
121
mysql-test/suite/rpl/t/rpl_mdev_17614.test
Normal file
121
mysql-test/suite/rpl/t/rpl_mdev_17614.test
Normal file
@@ -0,0 +1,121 @@
|
||||
source include/have_debug.inc;
|
||||
source include/have_innodb.inc;
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
source include/master-slave.inc;
|
||||
# MDEV-17614
|
||||
# INSERT on dup key update is replication unsafe
|
||||
# There can be three case
|
||||
# 1. 2 unique key, Replication is unsafe.
|
||||
# 2. 2 unique key , with one auto increment key, Safe to replicate because Innodb will acquire gap lock
|
||||
# 3. n no of unique keys (n>1) but insert is only in 1 unique key
|
||||
# 4. 2 unique key , with one auto increment key(but user gives auto inc value), unsafe to replicate
|
||||
|
||||
# Case 1
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY , b INT,
|
||||
UNIQUE(b), c int) engine=innodb;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, 1, 1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (2, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
--connection master1
|
||||
INSERT INTO t1 VALUES(2, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
--connection master
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
--connection slave
|
||||
# show the error message
|
||||
--let $slave_sql_errno= 1062
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
--echo #Different value from server
|
||||
SELECT * FROM t1;
|
||||
|
||||
# restart replication for the next testcase
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
reset slave;
|
||||
connection master;
|
||||
reset master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
# Case 2
|
||||
--connection master
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT,
|
||||
UNIQUE(b), c int) engine=innodb;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (default, 1, 1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (default, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
--connection master1
|
||||
INSERT INTO t1 VALUES(default, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
--connection master
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
--sync_slave_with_master
|
||||
--echo #same data as master
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
--sync_slave_with_master
|
||||
|
||||
# Case 3
|
||||
--connection master
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT,
|
||||
UNIQUE(b), c int, d int ) engine=innodb;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, 1, 1, 1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (2, NULL, 2, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
--connection master1
|
||||
INSERT INTO t1 VALUES(3, NULL, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
--connection master
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
--sync_slave_with_master
|
||||
--echo #same data as master
|
||||
SELECT * FROM t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
--sync_slave_with_master
|
||||
|
||||
# Case 4
|
||||
--connection master
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY auto_increment, b INT,
|
||||
UNIQUE(b), c int) engine=innodb;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, 1, 1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (2, 1, 2) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
--connection master1
|
||||
INSERT INTO t1 VALUES(2, 2, 3) ON DUPLICATE KEY UPDATE b=VALUES(b), c=VALUES(c);
|
||||
--connection master
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
--connection slave
|
||||
# show the error message
|
||||
--let $slave_sql_errno= 1062
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
--echo #Different value from server
|
||||
SELECT * FROM t1;
|
||||
|
||||
# restart replication for the next testcase
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
reset slave;
|
||||
connection master;
|
||||
reset master;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
--source include/rpl_end.inc
|
41
mysql-test/suite/rpl/t/rpl_sync_with_innodb_thd_conc.test
Normal file
41
mysql-test/suite/rpl/t/rpl_sync_with_innodb_thd_conc.test
Normal file
@@ -0,0 +1,41 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test verifies that replication shouldn't hang when number of active threads
|
||||
# on the slave server are less than the allowed innodb_thread_concurrency value.
|
||||
#
|
||||
# ==== Implementation ====
|
||||
#
|
||||
# Steps:
|
||||
# 0 - Have master slave replication setup with engine being Innodb.
|
||||
# 1 - Configure innodb_thread_concurrency = 100.
|
||||
# 2 - Do some DML on master and sync the slave with master.
|
||||
# 3 - Ensure replication doesn't hang.
|
||||
#
|
||||
# ==== References ====
|
||||
#
|
||||
# MDEV-20247: Replication hangs with "preparing" and never starts
|
||||
#
|
||||
|
||||
--source include/master-slave.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--connection slave
|
||||
SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency;
|
||||
SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay;
|
||||
SET GLOBAL innodb_thread_concurrency = 100;
|
||||
|
||||
--connection master
|
||||
CREATE TABLE t(f INT) ENGINE=INNODB;
|
||||
INSERT INTO t VALUES (10);
|
||||
--sync_slave_with_master
|
||||
|
||||
--let $diff_tables=master:t, slave:t
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo "===== Clean up======="
|
||||
--connection master
|
||||
DROP TABLE t;
|
||||
--sync_slave_with_master
|
||||
SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
|
||||
SET GLOBAL innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay;
|
||||
--source include/rpl_end.inc
|
@@ -24,7 +24,7 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
# Case-1: BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS
|
||||
# Statement is unsafe because it invokes a trigger or a
|
||||
# stored function that inserts into an AUTO_INCREMENT column.
|
||||
|
Reference in New Issue
Block a user