1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.11 into 11.0

This commit is contained in:
Marko Mäkelä
2023-12-20 16:05:20 +02:00
75 changed files with 1090 additions and 252 deletions

View File

@@ -0,0 +1,66 @@
include/master-slave.inc
[connection master]
#
# Initialize test data
connection master;
create table t1 (a int) engine=innodb;
insert into t1 values (1);
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/stop_slave.inc
call mtr.add_suppression("Connection was killed");
call mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
set @save_parallel_threads= @@global.slave_parallel_threads;
set @save_parallel_mode= @@global.slave_parallel_mode;
set @save_transaction_retries= @@global.slave_transaction_retries;
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
set @@global.slave_parallel_threads= 2;
set @@global.slave_parallel_mode= CONSERVATIVE;
set @@global.slave_transaction_retries= 0;
set @@global.innodb_lock_wait_timeout= 10;
# Grabbing lock on innodb row to force future replication transaction to wait (and eventually timeout)
BEGIN;
select * from t1 where a=1 for update;
a
1
connection master;
set @old_dbug= @@session.debug_dbug;
set @@session.debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10000;
update t1 set a=2 where a=1;
SET @commit_id= 10001;
insert into t1 values (3);
set @@session.debug_dbug= @old_dbug;
connection slave;
start slave;
# Waiting for first transaction to start (and be held at innodb row lock)..
# Waiting for next transaction to start and hold at do_gco_wait()..
connection slave1;
set @@session.debug_dbug="+d,hold_sss_with_err_lock";
show slave status;
connection slave;
set debug_sync="now wait_for sss_got_err_lock";
kill <TID of worker in do_gco_wait>;
set debug_sync="now signal sss_continue";
connection slave1;
# Waiting for SHOW SLAVE STATUS to complete..
# ..done
connection slave;
ROLLBACK;
include/wait_for_slave_sql_error.inc [errno=1927]
#
# Cleanup
connection master;
drop table t1;
include/save_master_gtid.inc
connection slave;
set debug_sync= "RESET";
set @@global.slave_parallel_threads= @save_parallel_threads;
set @@global.slave_parallel_mode= @save_parallel_mode;
set @@global.slave_transaction_retries= @save_transaction_retries;
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
start slave sql_thread;
include/sync_with_master_gtid.inc
include/rpl_end.inc
# End of rpl_deadlock_show_slave_status.test

View File

@@ -188,6 +188,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
SET sql_log_bin= 0;
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
SELECT BINLOG_GTID_POS(@binlog_file, 4);
BINLOG_GTID_POS(@binlog_file, 4)
NULL
DROP TABLE t1;
SET sql_log_bin= 1;
*** Some tests of @@GLOBAL.gtid_binlog_state ***
connection server_2;
include/sync_with_master_gtid.inc

View File

@@ -0,0 +1,78 @@
include/rpl_init.inc [topology=1->2->3]
*** Test GTID master switch in a topology with filtered events.
*** With --gtid-ignore-duplicate and --gtid-strict-mode, should allow
*** GTID connect at a GTID position that is filtered on the new master.
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);
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1,1);
INSERT INTO t1 VALUES (2,1);
INSERT INTO t3 VALUES (2,1);
include/save_master_gtid.inc
connection server_2;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,2);
include/sync_with_master_gtid.inc
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
*** Promote 3 as new master, demote 2 as slave of 3.
*** GTID position of 2 in domain 0 is filtered on 3.
connection server_2;
include/stop_slave.inc
connection server_3;
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
MASTER_USE_GTID=SLAVE_POS;
connection server_2;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3,
MASTER_USE_GTID=SLAVE_POS;
include/start_slave.inc
connection server_3;
include/start_slave.inc
connection server_1;
INSERT INTO t1 VALUES (3,1);
INSERT INTO t3 VALUES (3,1);
include/save_master_gtid.inc
connection server_3;
INSERT INTO t2 VALUES (2,2);
include/sync_with_master_gtid.inc
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 1
3 1
SELECT * FROM t3 ORDER BY a;
ERROR 42S02: Table 'test.t3' doesn't exist
SELECT * FROM t2 ORDER BY a;
a b
1 2
2 2
*** Restore original topology.
connection server_3;
include/stop_slave.inc
connection server_2;
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
MASTER_USE_GTID=SLAVE_POS;
include/start_slave.inc
connection server_3;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
MASTER_USE_GTID=SLAVE_POS;
include/start_slave.inc
connection server_1;
DROP TABLE t1;
DROP TABLE t3;
include/save_master_gtid.inc
connection server_2;
DROP TABLE t2;
include/sync_with_master_gtid.inc
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
include/rpl_end.inc

View File

@@ -0,0 +1,121 @@
#
# Verify that SHOW SLAVE STATUS will not cause deadlocks on the replica.
# A deadlock has been seen in do_gco_wait if the thread is killed, as it will
# hold the LOCK_parallel_entry, and during error reporting, try to grab the
# err_lock. Prior to MDEV-10653, SHOW SLAVE STATUS would grab these locks in
# the reverse order, as calling workers_idle() used to grab LOCK_parallel_entry
# with the err_lock already grabbed (though the MDEV-10653 patch changed the
# workles_idle() implementation to remove the need for locking the
# parallel_entry).
#
# References:
# MDEV-10653: SHOW SLAVE STATUS Can Deadlock an Errored Slave
#
--source include/master-slave.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_binlog_format_row.inc
--echo #
--echo # Initialize test data
--connection master
create table t1 (a int) engine=innodb;
insert into t1 values (1);
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
call mtr.add_suppression("Connection was killed");
call mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
set @save_parallel_threads= @@global.slave_parallel_threads;
set @save_parallel_mode= @@global.slave_parallel_mode;
set @save_transaction_retries= @@global.slave_transaction_retries;
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
set @@global.slave_parallel_threads= 2;
set @@global.slave_parallel_mode= CONSERVATIVE;
set @@global.slave_transaction_retries= 0;
set @@global.innodb_lock_wait_timeout= 10;
--echo # Grabbing lock on innodb row to force future replication transaction to wait (and eventually timeout)
BEGIN;
select * from t1 where a=1 for update;
--connection master
set @old_dbug= @@session.debug_dbug;
set @@session.debug_dbug="+d,binlog_force_commit_id";
# GCO 1
SET @commit_id= 10000;
# T1
update t1 set a=2 where a=1;
# GCO 2
SET @commit_id= 10001;
# T2
insert into t1 values (3);
set @@session.debug_dbug= @old_dbug;
--connection slave
start slave;
--echo # Waiting for first transaction to start (and be held at innodb row lock)..
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%)%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--echo # Waiting for next transaction to start and hold at do_gco_wait()..
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to start commit%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--connection slave1
set @@session.debug_dbug="+d,hold_sss_with_err_lock";
--send show slave status
--connection slave
set debug_sync="now wait_for sss_got_err_lock";
--let $t2_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for prior transaction to start commit%'`
--replace_result $t2_tid "<TID of worker in do_gco_wait>"
--eval kill $t2_tid
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE command LIKE 'Killed';
--source include/wait_condition.inc
set debug_sync="now signal sss_continue";
--connection slave1
--echo # Waiting for SHOW SLAVE STATUS to complete..
--disable_result_log
--reap
--enable_result_log
--echo # ..done
--connection slave
ROLLBACK;
--let $slave_sql_errno= 1927
--source include/wait_for_slave_sql_error.inc
--echo #
--echo # Cleanup
--connection master
drop table t1;
--source include/save_master_gtid.inc
--connection slave
set debug_sync= "RESET";
set @@global.slave_parallel_threads= @save_parallel_threads;
set @@global.slave_parallel_mode= @save_parallel_mode;
set @@global.slave_transaction_retries= @save_transaction_retries;
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
start slave sql_thread;
--source include/sync_with_master_gtid.inc
--source include/rpl_end.inc
--echo # End of rpl_deadlock_show_slave_status.test

View File

@@ -162,6 +162,13 @@ eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616);
# MDEV-33045: Server crashes in Item_func_binlog_gtid_pos::val_str / Binary_string::c_ptr_safe
SET sql_log_bin= 0;
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
SELECT BINLOG_GTID_POS(@binlog_file, 4);
DROP TABLE t1;
SET sql_log_bin= 1;
--echo *** Some tests of @@GLOBAL.gtid_binlog_state ***
--connection server_2

View File

@@ -0,0 +1,28 @@
!include ../my.cnf
[mysqld.1]
log-slave-updates
loose-innodb
gtid-domain-id=1
gtid-strict-mode=0
gtid-ignore-duplicates=1
[mysqld.2]
log-slave-updates
loose-innodb
gtid-domain-id=0
replicate-ignore-table=test.t3
gtid-strict-mode=0
gtid-ignore-duplicates=1
[mysqld.3]
log-slave-updates
loose-innodb
gtid-domain-id=0
replicate-ignore-table=test.t3
gtid-strict-mode=0
gtid-ignore-duplicates=1
[ENV]
SERVER_MYPORT_3= @mysqld.3.port
SERVER_MYSOCK_3= @mysqld.3.socket

View File

@@ -0,0 +1,109 @@
--source include/have_innodb.inc
--source include/have_binlog_format_mixed.inc
--let $rpl_topology=1->2->3
--source include/rpl_init.inc
--echo *** Test GTID master switch in a topology with filtered events.
--echo *** With --gtid-ignore-duplicate and --gtid-strict-mode, should allow
--echo *** GTID connect at a GTID position that is filtered on the new master.
--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);
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1,1);
INSERT INTO t1 VALUES (2,1);
INSERT INTO t3 VALUES (2,1);
--source include/save_master_gtid.inc
--connection server_2
CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,2);
--let $slave_timeout= 10
--source include/sync_with_master_gtid.inc
--source include/save_master_gtid.inc
--connection server_3
--source include/sync_with_master_gtid.inc
--echo *** Promote 3 as new master, demote 2 as slave of 3.
--echo *** GTID position of 2 in domain 0 is filtered on 3.
--connection server_2
--source include/stop_slave.inc
--connection server_3
--source include/stop_slave.inc
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1,
MASTER_USE_GTID=SLAVE_POS;
--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,
MASTER_USE_GTID=SLAVE_POS;
--source include/start_slave.inc
--connection server_3
--source include/start_slave.inc
--connection server_1
INSERT INTO t1 VALUES (3,1);
INSERT INTO t3 VALUES (3,1);
--source include/save_master_gtid.inc
--connection server_3
INSERT INTO t2 VALUES (2,2);
--source include/sync_with_master_gtid.inc
--source include/save_master_gtid.inc
--connection server_2
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
# Verify that table t3 is being filtered.
--error 1146
SELECT * FROM t3 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--echo *** Restore original topology.
--connection server_3
--source include/stop_slave.inc
--connection server_2
--source include/stop_slave.inc
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1,
MASTER_USE_GTID=SLAVE_POS;
--source include/start_slave.inc
--connection server_3
--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2,
MASTER_USE_GTID=SLAVE_POS;
--source include/start_slave.inc
# Cleanup
--connection server_1
DROP TABLE t1;
DROP TABLE t3;
--source include/save_master_gtid.inc
--connection server_2
DROP TABLE t2;
--source include/sync_with_master_gtid.inc
--source include/save_master_gtid.inc
--connection server_3
--source include/sync_with_master_gtid.inc
--source include/rpl_end.inc