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

Merge 11.3 into 11.4

This commit is contained in:
Vladislav Vaintroub
2023-11-21 15:43:20 +01:00
629 changed files with 21967 additions and 30305 deletions

View File

@@ -0,0 +1,375 @@
#
# Helper file to run through test cases to validate that the replica will stop
# at the correct place when running STOP SLAVE UNTIL with options
# SQL_BEFORE_GTIDS and SQL_AFTER_GTIDS.
#
# MTR Parameters:
# ssu_before_gtids (Boolean): Indicates whether to test SQL_BEFORE_GTIDS,
# (when true), or SQL_AFTER_GTIDS (when false).
#
--let $include_filename= rpl_gtid_until_before_after_gtids.inc
--source include/begin_include_file.inc
if ($ssu_before_gtids)
{
--let $ssu_opt=SQL_BEFORE_GTIDS
}
if (!$ssu_before_gtids)
{
--let $ssu_opt=SQL_AFTER_GTIDS
}
--echo #
--echo # Test Setup ($ssu_opt)
--echo # Clean primary and replica states
--connection master
--source include/save_master_gtid.inc
--connection slave
--source include/stop_slave.inc
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
--source include/reset_slave.inc
--connection master
RESET MASTER;
set session gtid_domain_id=0;
--echo # Initialize test data
--connection master
create table t1 (a int);
create table t2 (a int);
# Set the value counters to use on insertions. Note they are only set once per
# test, subsequent invocations of this .inc file continue to increment the
# previous values.
if (!$t1_ctr)
{
--let $t1_ctr= 100
--let $t2_ctr= 200
}
--source include/save_master_gtid.inc
--connection slave
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--echo #
--echo # Test Case 1 ($ssu_opt): For a single-dimensional binlog state and a
--echo # STOP SLAVE UNTIL gtid position with one GTID, the replica should
if ($ssu_before_gtids)
{
--echo # execute events up until the GTID is encountered, and immediately stop
}
if (!$ssu_before_gtids)
{
--echo # execute events up until the GTID is encountered, finish replicating
--echo # that event group, and then stop
}
--connection slave
--source include/stop_slave.inc
--let $initial_slave_pos= query_get_value(SHOW ALL SLAVES STATUS, Exec_Master_Log_Pos, 1)
--connection master
set session gtid_domain_id=0;
--eval INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
if ($ssu_before_gtids)
{
--let $expected_stop_gtid= `SELECT @@gtid_binlog_pos`
}
--eval INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
--let $until_gtid= `SELECT @@gtid_binlog_pos`
if (!$ssu_before_gtids)
{
--let $expected_stop_gtid= `SELECT @@gtid_binlog_pos`
}
--eval INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
--connection slave
--eval START SLAVE UNTIL $ssu_opt="$until_gtid"
--echo # Ensure the slave started
--let $slave_param= Exec_Master_Log_Pos
--let $slave_param_comparison= !=
--let $slave_param_value= $initial_slave_pos
--source include/wait_for_slave_param.inc
--let $slave_param_comparison= =
--source include/wait_for_slave_to_stop.inc
--let $actual_stop_gtid= `SELECT @@gtid_slave_pos`
if (`SELECT strcmp("$expected_stop_gtid","$actual_stop_gtid") != 0`)
{
--echo # Expected stop gtid != actual stop gtid ($expected_stop_gtid != $actual_stop_gtid)
--die Expected stop gtid != actual stop gtid
}
--echo # Clean replica state
--connection master
--source include/save_master_gtid.inc
--connection slave
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--echo #
--echo # Test Case 2 ($ssu_opt): If a provided until GTID doesn't exist in the
--echo # binary log due to a gap, once an event is seen that is beyond the
--echo # until GTID, the slave should immediately stop. Note the behavior of
--echo # this test case should be the same between SQL_BEFORE_GTIDS and
--echo # SQL_AFTER_GTIDS.
--connection slave
--let $initial_slave_pos= query_get_value(SHOW ALL SLAVES STATUS, Exec_Master_Log_Pos, 1)
--source include/stop_slave.inc
--connection master
set session gtid_domain_id=0;
--eval INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
--eval INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
--echo # Skip a seq_no
--let $binlog_pos= `SELECT @@gtid_binlog_pos`
--let $domain_id= `SELECT @@gtid_domain_id`
--let $server_id= `SELECT @@server_id`
--let $last_seq_no= `SELECT REGEXP_SUBSTR('$binlog_pos','[0-9]+\\\$')`
--let $skipped_seq_no= `SELECT ($last_seq_no + 1)`
--let $new_seq_no= `SELECT ($skipped_seq_no + 1)`
--eval set @@session.gtid_seq_no= $new_seq_no
--let $until_gtid= $domain_id-$server_id-$skipped_seq_no
--let $expected_stop_gtid= $binlog_pos
--eval INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
--connection slave
--eval START SLAVE UNTIL $ssu_opt="$until_gtid"
--echo # Ensure the slave started
--let $slave_param= Exec_Master_Log_Pos
--let $slave_param_comparison= !=
--let $slave_param_value= $initial_slave_pos
--source include/wait_for_slave_param.inc
--let $slave_param_comparison= =
--source include/wait_for_slave_to_stop.inc
--let $actual_stop_gtid= `SELECT @@gtid_slave_pos`
if (`SELECT strcmp("$expected_stop_gtid","$actual_stop_gtid") != 0`)
{
--echo # Expected stop gtid != actual stop gtid ($expected_stop_gtid != $actual_stop_gtid)
--die Expected stop gtid != actual stop gtid
}
--connection slave
--source include/start_slave.inc
--connection master
--sync_slave_with_master
--echo #
--echo # Test Case 3 ($ssu_opt): For a multi-dimensional binlog state and a
--echo # STOP SLAVE UNTIL gtid position with one GTID, the replica should
--echo # execute events from only the specified domain until the provided GTID
if ($ssu_before_gtids)
{
--echo # is encountered, and immediately stop
}
if (!$ssu_before_gtids)
{
--echo # is encountered, finish replicating that event group, and then stop
}
--connection slave
--source include/stop_slave.inc
--let $initial_slave_pos= query_get_value(SHOW ALL SLAVES STATUS, Exec_Master_Log_Pos, 1)
--connection master
set session gtid_domain_id=0;
--eval INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
set session gtid_domain_id=1;
--eval INSERT INTO t2 VALUES ($t2_ctr)
--inc $t2_ctr
--eval INSERT INTO t2 VALUES ($t2_ctr)
--inc $t2_ctr
if ($ssu_before_gtids)
{
# Will have GTIDs for both domains 0 and 1
--let $binlog_pos= `SELECT @@gtid_binlog_pos`
--let $expected_stop_gtid= `SELECT REGEXP_SUBSTR('$binlog_pos','0-[0-9]+-[0-9]+')`
}
set session gtid_domain_id=0;
--eval INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
--let $binlog_pos= `SELECT @@gtid_binlog_pos`
# Just the GTID for domain 0
--let $until_gtid= `SELECT REGEXP_SUBSTR('$binlog_pos','0-[0-9]+-[0-9]+')`
if (!$ssu_before_gtids)
{
--let $expected_stop_gtid= $until_gtid
}
set session gtid_domain_id=1;
--eval INSERT INTO t2 VALUES ($t2_ctr)
--inc $t2_ctr
set session gtid_domain_id=0;
--connection slave
--eval START SLAVE UNTIL $ssu_opt="$until_gtid"
--echo # Ensure the slave started
--let $slave_param= Exec_Master_Log_Pos
--let $slave_param_comparison= !=
--let $slave_param_value= $initial_slave_pos
--source include/wait_for_slave_param.inc
--let $slave_param_comparison= =
--source include/wait_for_slave_to_stop.inc
--let $actual_stop_gtid= `SELECT @@gtid_slave_pos`
if (`SELECT strcmp("$expected_stop_gtid","$actual_stop_gtid") != 0`)
{
--echo # Expected stop gtid != actual stop gtid ($expected_stop_gtid != $actual_stop_gtid)
--die Expected stop gtid != actual stop gtid
}
--connection slave
--source include/start_slave.inc
--connection master
--sync_slave_with_master
--echo #
--echo # Test Case 4 ($ssu_opt): For a multi-dimensional binlog state and a
--echo # STOP SLAVE UNTIL gtid position with multiple GTIDs, the replica should
if ($ssu_before_gtids)
{
--echo # for each domain, execute events only up until its provided GTID, and
--echo # once all domains have hit their end point, immediately stop.
}
if (!$ssu_before_gtids)
{
--echo # stop executing events as soon as all listed GTIDs in the UNTIL list
--echo # have been executed.
}
--connection slave
--source include/stop_slave.inc
--let $initial_slave_pos= query_get_value(SHOW ALL SLAVES STATUS, Exec_Master_Log_Pos, 1)
--connection master
--eval SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
if ($ssu_before_gtids)
{
# Save binlog pos for domain 0
--let $expected_stop_gtid_d0= `SELECT REGEXP_SUBSTR(@@global.gtid_binlog_pos,'0-[0-9]+-[0-9]+')`
--echo # Tagging domain 0 stop: $expected_stop_gtid_d0
}
--eval SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
--eval SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES ($t2_ctr)
--inc $t2_ctr
if ($ssu_before_gtids)
{
# Save binlog pos for domain 1
--let $expected_stop_gtid_d1= `SELECT REGEXP_SUBSTR(@@global.gtid_binlog_pos,'1-[0-9]+-[0-9]+')`
--let $expected_stop_gtid= $expected_stop_gtid_d0,$expected_stop_gtid_d1
}
--eval SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES ($t2_ctr)
--inc $t2_ctr
--let $until_gtid= `SELECT @@gtid_binlog_pos`
if (!$ssu_before_gtids)
{
--let $expected_stop_gtid= $until_gtid
}
--eval SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES ($t1_ctr)
--inc $t1_ctr
--eval SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES ($t2_ctr)
--inc $t2_ctr
--connection slave
--eval START SLAVE UNTIL $ssu_opt="$until_gtid"
--echo # Ensure the slave started
--let $slave_param= Exec_Master_Log_Pos
--let $slave_param_comparison= !=
--let $slave_param_value= $initial_slave_pos
--source include/wait_for_slave_param.inc
--let $slave_param_comparison= =
--source include/wait_for_slave_to_stop.inc
--let $actual_stop_gtid= `SELECT @@gtid_slave_pos`
if (`SELECT strcmp("$expected_stop_gtid","$actual_stop_gtid") != 0`)
{
--echo # Expected stop gtid != actual stop gtid ($expected_stop_gtid != $actual_stop_gtid)
--die Expected stop gtid != actual stop gtid
}
--connection slave
--source include/start_slave.inc
--connection master
--sync_slave_with_master
--echo #
--echo # Error Case 1: Not providing a valid GTID should result in a syntax
--echo # error
--connection slave
--source include/stop_slave.inc
--error ER_INCORRECT_GTID_STATE
--eval START SLAVE UNTIL $ssu_opt="a"
--error ER_INCORRECT_GTID_STATE
--eval START SLAVE UNTIL $ssu_opt="0"
--error ER_INCORRECT_GTID_STATE
--eval START SLAVE UNTIL $ssu_opt="0-1"
--error ER_INCORRECT_GTID_STATE
--eval START SLAVE UNTIL $ssu_opt="0-1-"
--error ER_INCORRECT_GTID_STATE
--eval START SLAVE UNTIL $ssu_opt="a-b-c"
--source include/start_slave.inc
--echo #
--echo # Cleanup test data
--connection master
DROP TABLE t1, t2;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--let $include_filename= rpl_gtid_until_before_after_gtids.inc
--source include/end_include_file.inc

View File

@@ -1,8 +1,8 @@
# Use settings from rpl_1slave_base.cnf
# add setting to connect the slave to the master by default
!include rpl_1slave_base.cnf
!include include/default_client.cnf
[mysqld.2]
# Override specific server settings using [mariadb-x.y] option group
# from `test.cnf` file right after including this file.
# E.g. after !include ../my.cnf, in your `test.cnf`, specify your configuration
# in option group e.g [mysqld.x], so that number `x` corresponds to the number
# in the rpl server topology.

View File

@@ -0,0 +1,239 @@
include/master-slave.inc
[connection master]
include/rpl_gtid_until_before_after_gtids.inc
#
# Test Setup (SQL_BEFORE_GTIDS)
# Clean primary and replica states
connection master;
connection slave;
connection master;
RESET MASTER;
set session gtid_domain_id=0;
# Initialize test data
connection master;
create table t1 (a int);
create table t2 (a int);
connection slave;
#
# Test Case 1 (SQL_BEFORE_GTIDS): For a single-dimensional binlog state and a
# STOP SLAVE UNTIL gtid position with one GTID, the replica should
# execute events up until the GTID is encountered, and immediately stop
connection slave;
connection master;
set session gtid_domain_id=0;
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (101);
INSERT INTO t1 VALUES (102);
connection slave;
START SLAVE UNTIL SQL_BEFORE_GTIDS="0-1-4";
# Ensure the slave started
# Clean replica state
connection master;
connection slave;
#
# Test Case 2 (SQL_BEFORE_GTIDS): If a provided until GTID doesn't exist in the
# binary log due to a gap, once an event is seen that is beyond the
# until GTID, the slave should immediately stop. Note the behavior of
# this test case should be the same between SQL_BEFORE_GTIDS and
# SQL_AFTER_GTIDS.
connection slave;
connection master;
set session gtid_domain_id=0;
INSERT INTO t1 VALUES (103);
INSERT INTO t1 VALUES (104);
# Skip a seq_no
set @@session.gtid_seq_no= 9;
INSERT INTO t1 VALUES (105);
connection slave;
START SLAVE UNTIL SQL_BEFORE_GTIDS="0-1-8";
# Ensure the slave started
connection slave;
connection master;
connection slave;
#
# Test Case 3 (SQL_BEFORE_GTIDS): For a multi-dimensional binlog state and a
# STOP SLAVE UNTIL gtid position with one GTID, the replica should
# execute events from only the specified domain until the provided GTID
# is encountered, and immediately stop
connection slave;
connection master;
set session gtid_domain_id=0;
INSERT INTO t1 VALUES (106);
set session gtid_domain_id=1;
INSERT INTO t2 VALUES (200);
INSERT INTO t2 VALUES (201);
set session gtid_domain_id=0;
INSERT INTO t1 VALUES (107);
set session gtid_domain_id=1;
INSERT INTO t2 VALUES (202);
set session gtid_domain_id=0;
connection slave;
START SLAVE UNTIL SQL_BEFORE_GTIDS="0-1-11";
# Ensure the slave started
connection slave;
connection master;
connection slave;
#
# Test Case 4 (SQL_BEFORE_GTIDS): For a multi-dimensional binlog state and a
# STOP SLAVE UNTIL gtid position with multiple GTIDs, the replica should
# for each domain, execute events only up until its provided GTID, and
# once all domains have hit their end point, immediately stop.
connection slave;
connection master;
SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES (108);
# Tagging domain 0 stop: 0-1-12
SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES (109);
SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES (203);
SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES (204);
SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES (110);
SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES (205);
connection slave;
START SLAVE UNTIL SQL_BEFORE_GTIDS="0-1-13,1-1-5";
# Ensure the slave started
connection slave;
connection master;
connection slave;
#
# Error Case 1: Not providing a valid GTID should result in a syntax
# error
connection slave;
START SLAVE UNTIL SQL_BEFORE_GTIDS="a";
ERROR HY000: Could not parse GTID list
START SLAVE UNTIL SQL_BEFORE_GTIDS="0";
ERROR HY000: Could not parse GTID list
START SLAVE UNTIL SQL_BEFORE_GTIDS="0-1";
ERROR HY000: Could not parse GTID list
START SLAVE UNTIL SQL_BEFORE_GTIDS="0-1-";
ERROR HY000: Could not parse GTID list
START SLAVE UNTIL SQL_BEFORE_GTIDS="a-b-c";
ERROR HY000: Could not parse GTID list
#
# Cleanup test data
connection master;
DROP TABLE t1, t2;
connection slave;
include/rpl_gtid_until_before_after_gtids.inc
#
# Test Setup (SQL_AFTER_GTIDS)
# Clean primary and replica states
connection master;
connection slave;
connection master;
RESET MASTER;
set session gtid_domain_id=0;
# Initialize test data
connection master;
create table t1 (a int);
create table t2 (a int);
connection slave;
#
# Test Case 1 (SQL_AFTER_GTIDS): For a single-dimensional binlog state and a
# STOP SLAVE UNTIL gtid position with one GTID, the replica should
# execute events up until the GTID is encountered, finish replicating
# that event group, and then stop
connection slave;
connection master;
set session gtid_domain_id=0;
INSERT INTO t1 VALUES (111);
INSERT INTO t1 VALUES (112);
INSERT INTO t1 VALUES (113);
connection slave;
START SLAVE UNTIL SQL_AFTER_GTIDS="0-1-4";
# Ensure the slave started
# Clean replica state
connection master;
connection slave;
#
# Test Case 2 (SQL_AFTER_GTIDS): If a provided until GTID doesn't exist in the
# binary log due to a gap, once an event is seen that is beyond the
# until GTID, the slave should immediately stop. Note the behavior of
# this test case should be the same between SQL_BEFORE_GTIDS and
# SQL_AFTER_GTIDS.
connection slave;
connection master;
set session gtid_domain_id=0;
INSERT INTO t1 VALUES (114);
INSERT INTO t1 VALUES (115);
# Skip a seq_no
set @@session.gtid_seq_no= 9;
INSERT INTO t1 VALUES (116);
connection slave;
START SLAVE UNTIL SQL_AFTER_GTIDS="0-1-8";
# Ensure the slave started
connection slave;
connection master;
connection slave;
#
# Test Case 3 (SQL_AFTER_GTIDS): For a multi-dimensional binlog state and a
# STOP SLAVE UNTIL gtid position with one GTID, the replica should
# execute events from only the specified domain until the provided GTID
# is encountered, finish replicating that event group, and then stop
connection slave;
connection master;
set session gtid_domain_id=0;
INSERT INTO t1 VALUES (117);
set session gtid_domain_id=1;
INSERT INTO t2 VALUES (206);
INSERT INTO t2 VALUES (207);
set session gtid_domain_id=0;
INSERT INTO t1 VALUES (118);
set session gtid_domain_id=1;
INSERT INTO t2 VALUES (208);
set session gtid_domain_id=0;
connection slave;
START SLAVE UNTIL SQL_AFTER_GTIDS="0-1-11";
# Ensure the slave started
connection slave;
connection master;
connection slave;
#
# Test Case 4 (SQL_AFTER_GTIDS): For a multi-dimensional binlog state and a
# STOP SLAVE UNTIL gtid position with multiple GTIDs, the replica should
# stop executing events as soon as all listed GTIDs in the UNTIL list
# have been executed.
connection slave;
connection master;
SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES (119);
SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES (120);
SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES (209);
SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES (210);
SET STATEMENT gtid_domain_id=0 FOR INSERT INTO t1 VALUES (121);
SET STATEMENT gtid_domain_id=1 FOR INSERT INTO t2 VALUES (211);
connection slave;
START SLAVE UNTIL SQL_AFTER_GTIDS="0-1-13,1-1-5";
# Ensure the slave started
connection slave;
connection master;
connection slave;
#
# Error Case 1: Not providing a valid GTID should result in a syntax
# error
connection slave;
START SLAVE UNTIL SQL_AFTER_GTIDS="a";
ERROR HY000: Could not parse GTID list
START SLAVE UNTIL SQL_AFTER_GTIDS="0";
ERROR HY000: Could not parse GTID list
START SLAVE UNTIL SQL_AFTER_GTIDS="0-1";
ERROR HY000: Could not parse GTID list
START SLAVE UNTIL SQL_AFTER_GTIDS="0-1-";
ERROR HY000: Could not parse GTID list
START SLAVE UNTIL SQL_AFTER_GTIDS="a-b-c";
ERROR HY000: Could not parse GTID list
#
# Cleanup test data
connection master;
DROP TABLE t1, t2;
connection slave;
#
# Error Case 2: Providing both SQL_BEFORE_GTIDS and SQL_AFTER_GTIDS
# should result in a syntax error
connection slave;
START SLAVE UNTIL SQL_AFTER_GTIDS="0-1-1" SQL_BEFORE_GTIDS="0-1-1";
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SQL_BEFORE_GTIDS="0-1-1"' at line 1
#
# Cleanup
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/rpl_end.inc
# End of rpl_gtid_until_before_gtids.test

View File

@@ -45,14 +45,14 @@ BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
CREATE EVENT e1 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
CREATE EVENT e11 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');

View File

@@ -28,8 +28,8 @@ slow_log CREATE TABLE `slow_log` (
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
`rows_sent` int(11) NOT NULL,
`rows_examined` int(11) NOT NULL,
`rows_sent` bigint(20) unsigned NOT NULL,
`rows_examined` bigint(20) unsigned NOT NULL,
`db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL,
@@ -48,15 +48,15 @@ slow_log CREATE TABLE `slow_log` (
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
`rows_sent` int(11) NOT NULL,
`rows_examined` int(11) NOT NULL,
`rows_sent` bigint(20) unsigned NOT NULL,
`rows_examined` bigint(20) unsigned NOT NULL,
`db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`rows_affected` int(11) NOT NULL
`rows_affected` bigint(20) unsigned NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log'
SET GLOBAL general_log = 'OFF';
SET GLOBAL slow_query_log = 'OFF';

View File

@@ -0,0 +1,48 @@
include/master-slave.inc
[connection master]
connection master;
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1);
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/stop_slave.inc
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
set @save_slave_trans_retries= @@global.slave_transaction_retries;
set @@global.innodb_lock_wait_timeout= 1;
set @@global.slave_transaction_retries= 0;
connection master;
update t1 set b=b+10 where a=1;
include/save_master_gtid.inc
connection slave1;
BEGIN;
SELECT * FROM t1 WHERE a=1 FOR UPDATE;
a b
1 1
connection slave;
include/start_slave.inc
include/wait_for_slave_sql_error.inc [errno=1205]
connection slave1;
ROLLBACK;
connection slave;
set @save_dbug = @@global.debug_dbug;
set @@global.debug_dbug= "+d,delay_sql_thread_after_release_run_lock";
include/start_slave.inc
set debug_sync= "now wait_for sql_thread_run_lock_released";
# Validating that the SQL thread is running..
# ..success
# Validating that Last_SQL_Errno is cleared..
# ..success
set debug_sync= "now signal sql_thread_continue";
set @@global.debug_dbug= @saved_dbug;
set debug_sync= "RESET";
# Cleanup
connection master;
drop table t1;
connection slave;
include/stop_slave.inc
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
set @@global.slave_transaction_retries= @save_slave_trans_retries;
include/start_slave.inc
include/rpl_end.inc
# End of rpl_sql_thd_start_errno_cleared.test

View File

@@ -2,14 +2,14 @@ include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
set @save_par_thds= @@global.slave_parallel_threads;
set @save_strict_mode= @@global.gtid_strict_mode;
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
change master to master_use_gtid=slave_pos;
set @@global.slave_parallel_threads= 4;
set @@global.slave_parallel_mode= optimistic;
set @@global.gtid_strict_mode=ON;
set sql_log_bin= 0;
alter table mysql.gtid_slave_pos engine=innodb;
call mtr.add_suppression("Deadlock found.*");
set sql_log_bin= 1;
set statement sql_log_bin=0 for alter table mysql.gtid_slave_pos engine=innodb;
include/start_slave.inc
connection master;
create table t1 (a int primary key, b int) engine=innodb;
@@ -27,25 +27,25 @@ xa end '1';
xa prepare '1';
xa commit '1';
include/save_master_gtid.inc
connection slave;
connection slave1;
BEGIN;
SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=100 FOR UPDATE;
domain_id sub_id server_id seq_no
connection slave;
include/start_slave.inc
include/wait_for_slave_sql_error.inc [errno=1942,1213]
include/wait_for_slave_sql_error.inc [errno=1942]
include/stop_slave_io.inc
connection slave1;
ROLLBACK;
# Cleanup
connection master;
drop table t1;
connection slave;
include/stop_slave.inc
# TODO: Remove after fixing MDEV-21777
set @@global.gtid_slave_pos= "0-1-100";
set @@global.slave_parallel_threads= 0;
set @@global.gtid_strict_mode= 0;
set @@global.innodb_lock_wait_timeout= 50;
set @@global.slave_parallel_threads= @save_par_thds;
set @@global.gtid_strict_mode= @save_strict_mode;
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
include/start_slave.inc
include/rpl_end.inc
# End of rpl_xa_prepare_gtid_fail.test

View File

@@ -0,0 +1,45 @@
#
# This test validates the behavior of SQL_BEFORE_GTIDS and SQL_AFTER_GTIDS
# of a slave's START SLAVE UNTIL command. Notably, it tests the following
# scenarios:
# 1. Single domain id in binary log with a single domain id in the UNTIL
# condition
# 2. Multiple domain ids in binary log with a single domain id in the UNTIL
# condition
# 3. Multiple domain ids in binary log with multiple domain ids in the UNTIL
# condition
# 4. A gap in the binary log with the UNTIL condition GTID pointed to the
# missing transaction
# 5. Syntax errors using the new options
#
#
# References:
# MDEV-27247: Add keywords "exclusive" and "inclusive" for START SLAVE UNTIL
#
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/master-slave.inc
--let $ssu_before_gtids=1
--source include/rpl_gtid_until_before_after_gtids.test
--let $ssu_before_gtids=0
--source include/rpl_gtid_until_before_after_gtids.test
--echo #
--echo # Error Case 2: Providing both SQL_BEFORE_GTIDS and SQL_AFTER_GTIDS
--echo # should result in a syntax error
--connection slave
--error ER_PARSE_ERROR
START SLAVE UNTIL SQL_AFTER_GTIDS="0-1-1" SQL_BEFORE_GTIDS="0-1-1";
--echo #
--echo # Cleanup
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--source include/rpl_end.inc
--echo # End of rpl_gtid_until_before_gtids.test

View File

@@ -102,14 +102,17 @@ BEGIN
UPDATE t13 SET c = '';
END|
# Create events which will run every 1 sec
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
# Create events which will run every 10 sec
# It cannot be much shorter as we have to ensure that a new
# event is not scheduled before the DISABLE has been
# executed.
CREATE EVENT e1 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
CREATE EVENT e11 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');

View File

@@ -0,0 +1,93 @@
#
# Ensure that when the slave restarts, the last error code displayed by
# SHOW SLAVE STATUS is cleared before Slave_SQL_Running is set.
#
# To ensure that, this test uses the debug_sync mechanism to pause an errored
# and restarting slave's SQL thread after it has set its running state to YES,
# and then ensures that Last_SQL_Errno is 0. The slave error is a forced innodb
# row lock timeout.
#
#
# References
# MDEV-31177: SHOW SLAVE STATUS Last_SQL_Errno Race Condition on Errored
# Slave Restart
#
source include/have_binlog_format_row.inc;
source include/have_innodb.inc;
source include/have_debug.inc;
source include/have_debug_sync.inc;
source include/master-slave.inc;
--connection master
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1);
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
set @save_slave_trans_retries= @@global.slave_transaction_retries;
set @@global.innodb_lock_wait_timeout= 1;
set @@global.slave_transaction_retries= 0;
--connection master
update t1 set b=b+10 where a=1;
--source include/save_master_gtid.inc
--connection slave1
BEGIN;
--eval SELECT * FROM t1 WHERE a=1 FOR UPDATE
--connection slave
--source include/start_slave.inc
--let $slave_sql_errno= 1205
--source include/wait_for_slave_sql_error.inc
--connection slave1
ROLLBACK;
--connection slave
set @save_dbug = @@global.debug_dbug;
set @@global.debug_dbug= "+d,delay_sql_thread_after_release_run_lock";
--source include/start_slave.inc
set debug_sync= "now wait_for sql_thread_run_lock_released";
--let $sql_running = query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, 1)
--echo # Validating that the SQL thread is running..
if (`SELECT strcmp("$sql_running", "YES") != 0`)
{
--echo # ..failed
--echo # Slave_SQL_Running: $sql_running
--die Slave SQL thread is not running
}
--echo # ..success
--let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
--echo # Validating that Last_SQL_Errno is cleared..
if ($last_error)
{
--echo # ..failed
--echo # Last_SQL_Errno: $last_error
--die SHOW SLAVE STATUS shows the error from the last session on startup
}
--echo # ..success
set debug_sync= "now signal sql_thread_continue";
set @@global.debug_dbug= @saved_dbug;
set debug_sync= "RESET";
--echo # Cleanup
--connection master
drop table t1;
--connection slave
--source include/stop_slave.inc
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
set @@global.slave_transaction_retries= @save_slave_trans_retries;
--source include/start_slave.inc
--source include/rpl_end.inc
--echo # End of rpl_sql_thd_start_errno_cleared.test

View File

@@ -6,8 +6,8 @@
# GTID slave state, then the slave should immediately quit in error, without
# retry.
#
# This tests validates the above behavior by simulating a deadlock on the
# GTID slave state table during the second part of XA PREPARE's commit, to
# This tests validates the above behavior by forcing a lock-wait timeout on
# the GTID slave state table during the second part of XA PREPARE's commit, to
# ensure that the appropriate error is reported and the transaction was never
# retried.
#
@@ -23,23 +23,19 @@ source include/have_innodb.inc;
--connection slave
--source include/stop_slave.inc
--let $save_par_thds= `SELECT @@global.slave_parallel_threads`
--let $save_strict_mode= `SELECT @@global.gtid_strict_mode`
--let $save_innodb_lock_wait_timeout= `SELECT @@global.innodb_lock_wait_timeout`
set @save_par_thds= @@global.slave_parallel_threads;
set @save_strict_mode= @@global.gtid_strict_mode;
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
change master to master_use_gtid=slave_pos;
set @@global.slave_parallel_threads= 4;
set @@global.slave_parallel_mode= optimistic;
set @@global.gtid_strict_mode=ON;
set sql_log_bin= 0;
alter table mysql.gtid_slave_pos engine=innodb;
call mtr.add_suppression("Deadlock found.*");
set sql_log_bin= 1;
set statement sql_log_bin=0 for alter table mysql.gtid_slave_pos engine=innodb;
--source include/start_slave.inc
--connection master
let $datadir= `select @@datadir`;
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1);
--source include/save_master_gtid.inc
@@ -64,11 +60,6 @@ xa prepare '1';
xa commit '1';
--source include/save_master_gtid.inc
--connection slave
#--eval set statement sql_log_bin=0 for insert into mysql.gtid_slave_pos values ($gtid_domain_id, 5, $gtid_server_id, $xap_seq_no)
--connection slave1
BEGIN;
--eval SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=$xap_seq_no FOR UPDATE
@@ -76,9 +67,14 @@ BEGIN;
--connection slave
--source include/start_slave.inc
--let $slave_sql_errno= 1942,1213
--let $slave_sql_errno= 1942
--source include/wait_for_slave_sql_error.inc
# TODO: Remove after fixing MDEV-21777
# Stop the IO thread too, so the existing relay logs are force purged on slave
# restart, as to not re-execute the already-prepared transaction
--source include/stop_slave_io.inc
--let $retried_tx_test= query_get_value(SHOW ALL SLAVES STATUS, Retried_transactions, 1)
if ($retried_tx_initial != $retried_tx_test)
{
@@ -95,11 +91,11 @@ ROLLBACK;
drop table t1;
--connection slave
--source include/stop_slave.inc
--echo # TODO: Remove after fixing MDEV-21777
--eval set @@global.gtid_slave_pos= "$new_gtid"
--eval set @@global.slave_parallel_threads= $save_par_thds
--eval set @@global.gtid_strict_mode= $save_strict_mode
--eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout
set @@global.slave_parallel_threads= @save_par_thds;
set @@global.gtid_strict_mode= @save_strict_mode;
set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
--source include/start_slave.inc
--source include/rpl_end.inc