1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge branch '10.6' into 10.11

This commit is contained in:
Sergei Golubchik
2024-04-22 11:00:03 +02:00
418 changed files with 7074 additions and 2930 deletions

View File

@@ -125,7 +125,7 @@ include/save_master_gtid.inc
connection slave;
SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout;
SET @sav_slave_transaction_retries = @@global.slave_transaction_retries;
SET @@global.innodb_lock_wait_timeout =1;
SET @@global.innodb_lock_wait_timeout =5;
SET @@global.slave_transaction_retries=0;
include/start_slave.inc
connection aux_slave;
@@ -168,7 +168,7 @@ include/save_master_gtid.inc
connection slave;
SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout;
SET @sav_slave_transaction_retries = @@global.slave_transaction_retries;
SET @@global.innodb_lock_wait_timeout =1;
SET @@global.innodb_lock_wait_timeout =5;
SET @@global.slave_transaction_retries=0;
include/start_slave.inc
connection aux_slave;

View File

@@ -128,7 +128,7 @@ include/save_master_gtid.inc
connection slave;
SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout;
SET @sav_slave_transaction_retries = @@global.slave_transaction_retries;
SET @@global.innodb_lock_wait_timeout =1;
SET @@global.innodb_lock_wait_timeout =5;
SET @@global.slave_transaction_retries=0;
include/start_slave.inc
connection aux_slave;
@@ -171,7 +171,7 @@ include/save_master_gtid.inc
connection slave;
SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout;
SET @sav_slave_transaction_retries = @@global.slave_transaction_retries;
SET @@global.innodb_lock_wait_timeout =1;
SET @@global.innodb_lock_wait_timeout =5;
SET @@global.slave_transaction_retries=0;
include/start_slave.inc
connection aux_slave;

View File

@@ -128,7 +128,7 @@ include/save_master_gtid.inc
connection slave;
SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout;
SET @sav_slave_transaction_retries = @@global.slave_transaction_retries;
SET @@global.innodb_lock_wait_timeout =1;
SET @@global.innodb_lock_wait_timeout =5;
SET @@global.slave_transaction_retries=0;
include/start_slave.inc
connection aux_slave;
@@ -171,7 +171,7 @@ include/save_master_gtid.inc
connection slave;
SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout;
SET @sav_slave_transaction_retries = @@global.slave_transaction_retries;
SET @@global.innodb_lock_wait_timeout =1;
SET @@global.innodb_lock_wait_timeout =5;
SET @@global.slave_transaction_retries=0;
include/start_slave.inc
connection aux_slave;

View File

@@ -21,8 +21,9 @@ INSERT INTO t2 VALUES(1);
SELECT * FROM t2;
i
1
include/save_master_gtid.inc
connection slave;
connection slave;
include/sync_with_master_gtid.inc
SELECT * FROM t1;
i
1

View File

@@ -0,0 +1,122 @@
include/master-slave.inc
[connection master]
#
# Initialize test data
connection master;
create table t1 (a int) engine=innodb;
include/save_master_gtid.inc
set @@SESSION.debug_dbug= "+d,binlog_force_commit_id";
connection slave;
set SQL_LOG_BIN= 0;
call mtr.add_suppression('Found invalid event in binary log');
call mtr.add_suppression('Slave SQL.*Relay log read failure: Could not parse relay log event entry.* 1594');
set SQL_LOG_BIN= 1;
include/sync_with_master_gtid.inc
include/stop_slave.inc
include/start_slave.inc
#
# Test FL_PREPARED_XA
connection master;
set @@SESSION.debug_dbug= "+d,negate_xid_from_gtid";
set @commit_id= 100;
XA START 'x1';
insert into t1 values (1);
XA END 'x1';
XA PREPARE 'x1';
set @@SESSION.debug_dbug= "-d,negate_xid_from_gtid";
XA COMMIT 'x1';
include/save_master_gtid.inc
# Waiting for slave to find invalid event..
connection slave;
include/wait_for_slave_sql_error.inc [errno=1594]
STOP SLAVE IO_THREAD;
# Reset master binlogs (as there is an invalid event) and slave state
connection master;
RESET MASTER;
connection slave;
RESET MASTER;
RESET SLAVE;
set @@global.gtid_slave_pos="";
include/start_slave.inc
#
# Test FL_COMPLETED_XA
connection master;
set @commit_id= 101;
XA START 'x1';
insert into t1 values (2);
XA END 'x1';
XA PREPARE 'x1';
set @@SESSION.debug_dbug= "+d,negate_xid_from_gtid";
XA COMMIT 'x1';
set @@SESSION.debug_dbug= "-d,negate_xid_from_gtid";
include/save_master_gtid.inc
# Waiting for slave to find invalid event..
connection slave;
include/wait_for_slave_sql_error.inc [errno=1594]
STOP SLAVE IO_THREAD;
# Cleanup hanging XA PREPARE on slave
set statement SQL_LOG_BIN=0 for XA COMMIT 'x1';
# Reset master binlogs (as there is an invalid event) and slave state
connection master;
RESET MASTER;
connection slave;
RESET MASTER;
RESET SLAVE;
set @@global.gtid_slave_pos="";
include/start_slave.inc
#
# Test Missing xid.data (but has format id and length description parts)
connection master;
set @commit_id= 101;
XA START 'x1';
insert into t1 values (1);
XA END 'x1';
XA PREPARE 'x1';
set @@SESSION.debug_dbug= "+d,negate_xid_data_from_gtid";
XA COMMIT 'x1';
set @@SESSION.debug_dbug= "-d,negate_xid_data_from_gtid";
include/save_master_gtid.inc
# Waiting for slave to find invalid event..
connection slave;
include/wait_for_slave_sql_error.inc [errno=1594]
STOP SLAVE IO_THREAD;
# Cleanup hanging XA PREPARE on slave
set statement SQL_LOG_BIN=0 for XA COMMIT 'x1';
# Reset master binlogs (as there is an invalid event) and slave state
connection master;
RESET MASTER;
connection slave;
RESET MASTER;
RESET SLAVE;
set @@global.gtid_slave_pos="";
include/start_slave.inc
#
# Test FL_EXTRA_MULTI_ENGINE
connection master;
set @old_dbug= @@SESSION.debug_dbug;
set @@SESSION.debug_dbug= "+d,inject_fl_extra_multi_engine_into_gtid";
set @commit_id= 102;
insert into t1 values (3);
include/save_master_gtid.inc
set @@SESSION.debug_dbug=@old_dbug;
connection slave;
# Waiting for slave to find invalid event..
include/wait_for_slave_sql_error.inc [errno=1594]
STOP SLAVE IO_THREAD;
# Reset master binlogs (as there is an invalid event) and slave state
connection master;
RESET MASTER;
connection slave;
RESET SLAVE;
RESET MASTER;
set @@global.gtid_slave_pos="";
include/start_slave.inc
#
# Cleanup
connection master;
drop table t1;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/rpl_end.inc
# End of rpl_gtid_header_valid.test

View File

@@ -17,6 +17,36 @@ include/sync_with_master_gtid.inc
include/rpl_restart_server.inc [server_number=2 parameters: --debug_dbug="+d,delay_start_handle_manager"]
include/start_slave.inc
#
# MDEV-33799
# Ensure that when the binary log is used for recovery (as tc log), that
# the recovery process cannot start the binlog background thread before
# the mysql handle manager has started.
connection slave;
# Add test suppresssions so crash recovery messages don't fail the test
set session sql_log_bin=0;
call mtr.add_suppression("mariadbd: Got error '145.*");
call mtr.add_suppression("Checking table:.*");
call mtr.add_suppression("mysql.gtid_slave_pos:.*hasn't closed the table properly");
call mtr.add_suppression("Can't init tc log");
call mtr.add_suppression("Aborting");
set session sql_log_bin=1;
# Create slave-side only table
create table t2 (a int) engine=innodb;
# Crash mariadbd when binlogging transaction to corrupt database state
connection slave1;
set @@session.debug_dbug="+d,crash_before_writing_xid";
insert into t2 values (1);
connection slave;
connection slave1;
Got one of the listed errors
# Restart mariadbd in recovery mode. Note --tc-heuristic-recover
# forces mysqld to exit with error, so we run mariadbd via CLI
# MYSQLD_LAST_CMD --debug_dbug="+d,delay_start_handle_manager" --tc-heuristic-recover=COMMIT
connection server_2;
connection slave1;
connection slave;
include/start_slave.inc
#
# Cleanup
#
connection master;
@@ -24,4 +54,5 @@ drop table t1;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
drop table t2;
include/rpl_end.inc

View File

@@ -0,0 +1,55 @@
include/master-slave.inc
[connection master]
call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
call mtr.add_suppression("WSREP: handlerton rollback failed");
connection master;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
connection slave;
include/stop_slave.inc
SET @old_parallel_threads = @@GLOBAL.slave_parallel_threads;
SET @old_slave_domain_parallel_threads = @@GLOBAL.slave_domain_parallel_threads;
SET @@global.slave_parallel_threads = 5;
SET @@global.slave_domain_parallel_threads = 3;
SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode;
CHANGE MASTER TO master_use_gtid=slave_pos;
connection master;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 0);
include/save_master_gtid.inc
connection slave;
include/start_slave.inc
include/sync_with_master_gtid.inc
include/stop_slave.inc
SET @@global.slave_parallel_mode ='optimistic';
connection master;
include/save_master_gtid.inc
connection slave;
include/start_slave.inc
include/sync_with_master_gtid.inc
include/stop_slave.inc
connection master;
include/save_master_gtid.inc
connection slave;
SET @@global.slave_parallel_mode ='conservative';
include/start_slave.inc
include/sync_with_master_gtid.inc
include/stop_slave.inc
include/save_master_gtid.inc
connection slave;
SET @@global.slave_parallel_mode = 'optimistic';
include/start_slave.inc
include/sync_with_master_gtid.inc
include/diff_tables.inc [master:t1, slave:t1]
connection slave;
include/stop_slave.inc
SET @@global.slave_parallel_mode = @old_parallel_mode;
SET @@global.slave_parallel_threads = @old_parallel_threads;
SET @@global.slave_domain_parallel_threads = @old_slave_domain_parallel_threads;
include/start_slave.inc
connection master;
DROP TABLE t1;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
connection master;
include/rpl_end.inc

View File

@@ -127,4 +127,14 @@ CREATE SEQUENCE s4;
DROP SEQUENCE s2,s3,s4;
DROP TABLE ti;
connection slave;
connection master;
CREATE SEQUENCE s;
SELECT NEXTVAL(s);
NEXTVAL(s)
1
flush binary logs;
DROP SEQUENCE s;
DROP SEQUENCE s;
connection slave;
connection master;
include/rpl_end.inc

View File

@@ -206,10 +206,12 @@ RETURN x;
END
||
SET sql_log_bin=1;
include/stop_slave_io.inc
connection server_1;
INSERT INTO t3 VALUES (49,0);
connection server_2;
START SLAVE SQL_THREAD;
CHANGE MASTER TO master_use_gtid=no;
include/start_slave.inc
SELECT * FROM t3 WHERE a >= 40 ORDER BY a;
a b
41 41
@@ -239,10 +241,6 @@ SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
include/start_slave.inc
*** 3. Same as (2), but not using gtid mode ***
connection server_2;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=no;
include/start_slave.inc
connection server_1;
connection con_temp3;
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1';

View File

@@ -44,7 +44,9 @@ SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
connection server_2;
include/wait_for_slave_param.inc [Slave_SQL_Running_State]
include/stop_slave.inc
include/assert.inc [Table t1 should have 2 rows.]
select count(*) 'on slave must be 2' from t1;
on slave must be 2
2
SELECT @@GLOBAL.gtid_current_pos;
@@GLOBAL.gtid_current_pos
0-1-4
@@ -52,7 +54,9 @@ SELECT @@GLOBAL.gtid_current_pos;
connection server_1;
# Ensuring variable rpl_semi_sync_slave_enabled is ON..
# Ensuring status rpl_semi_sync_slave_status is OFF..
include/assert.inc [Table t1 should have 1 rows.]
select count(*) 'on master must be 1' from t1;
on master must be 1
1
FOUND 1 /truncated binlog file:.*master.*000001/ in mysqld.1.err
disconnect conn_client;
connection server_2;
@@ -79,9 +83,9 @@ SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value
gtid_slave_pos 0-1-4
connection server_1;
SELECT COUNT(*) = 3 as 'true' FROM t1;
true
1
SELECT COUNT(*) 'must be 3' FROM t1;
must be 3
3
# ... the gtid states on the slave:
SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value
@@ -113,18 +117,22 @@ connection server_2;
#=================================================================
connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_2,;
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go";
SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync WAIT_FOR con1_go1";
SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100));
connect conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,;
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
SET GLOBAL debug_dbug="d,Notify_binlog_EOF";
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL con1_go";
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con2_ready";
INSERT INTO t1 VALUES (5, REPEAT("x", 4100));
connection server_2;
SET DEBUG_SYNC= "now WAIT_FOR eof_reached";
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
# Kill the server
connection server_1;
include/wait_for_slave_param.inc [Slave_SQL_Running_State]
include/stop_slave.inc
include/assert.inc [Table t1 should have 5 rows.]
select count(*) 'on slave must be 5' from t1;
on slave must be 5
5
SELECT @@GLOBAL.gtid_current_pos;
@@GLOBAL.gtid_current_pos
0-2-7
@@ -132,7 +140,9 @@ SELECT @@GLOBAL.gtid_current_pos;
connection server_2;
# Ensuring variable rpl_semi_sync_slave_enabled is ON..
# Ensuring status rpl_semi_sync_slave_status is OFF..
include/assert.inc [Table t1 should have 3 rows.]
select count(*) 'on master must be 3' from t1;
on master must be 3
3
FOUND 1 /truncated binlog file:.*slave.*000002.* to remove transactions starting from GTID 0-1-6/ in mysqld.2.err
disconnect conn_client;
connection server_1;
@@ -159,9 +169,9 @@ SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value
gtid_slave_pos 0-2-7
connection server_2;
SELECT COUNT(*) = 6 as 'true' FROM t1;
true
1
SELECT COUNT(*) 'must be 6 as' FROM t1;
must be 6 as
6
# ... the gtid states on the slave:
SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value
@@ -205,7 +215,9 @@ SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
connection server_2;
include/wait_for_slave_param.inc [Slave_SQL_Running_State]
include/stop_slave.inc
include/assert.inc [Table t1 should have 7 rows.]
select count(*) 'on slave must be 7' from t1;
on slave must be 7
7
SELECT @@GLOBAL.gtid_current_pos;
@@GLOBAL.gtid_current_pos
0-1-9
@@ -213,7 +225,9 @@ SELECT @@GLOBAL.gtid_current_pos;
connection server_1;
# Ensuring variable rpl_semi_sync_slave_enabled is ON..
# Ensuring status rpl_semi_sync_slave_status is OFF..
include/assert.inc [Table t1 should have 6 rows.]
select count(*) 'on master must be 6' from t1;
on master must be 6
6
FOUND 1 /truncated binlog file:.*master.*000002.* to remove transactions starting from GTID 0-1-9/ in mysqld.1.err
disconnect conn_client;
connection server_2;
@@ -242,9 +256,9 @@ Variable_name Value
gtid_slave_pos 0-1-9
connection server_1;
include/sync_with_master_gtid.inc
SELECT COUNT(*) = 8 as 'true' FROM t1;
true
1
SELECT COUNT(*) 'must be 8' FROM t1;
must be 8
8
# ... the gtid states on the slave:
SHOW VARIABLES LIKE 'gtid_slave_pos';
Variable_name Value

View File

@@ -4,7 +4,7 @@ connection master;
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
connection slave;
include/stop_slave.inc
SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1;
SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1;
include/start_slave.inc
connection master;
CREATE TABLE t1 (a INT);
@@ -21,7 +21,6 @@ connection slave;
include/wait_for_slave_sql_to_start.inc
include/wait_for_slave_io_to_start.inc
connection master;
SET @@GLOBAL.debug_dbug="";
SET @@GLOBAL. rpl_semi_sync_master_enabled = 0;
connection master;
DROP TABLE t1;

View File

@@ -505,8 +505,8 @@ disconnect con1;
connection default;
connection con2;
SHUTDOWN WAIT FOR ALL SLAVES;
connection server_2;
include/assert_grep.inc [Ensure the primary waited for the ACK of the killed thread]
# Ensure the primary waited for the ACK of the killed thread
FOUND 5 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err
connection default;
connection server_1;
connection server_2;

View File

@@ -0,0 +1,50 @@
include/master-slave.inc
[connection master]
connection slave;
set statement sql_log_bin=0 for call mtr.add_suppression("Signal handler thread did not exit in a timely manner");
#
# Main test
connection master;
create table t1 (a int);
insert into t1 values (1);
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
set @@global.debug_dbug= "+d,hold_sighup_log_refresh";
# Waiting for sighup to reach reload_acl_and_cache..
set debug_sync="now wait_for in_reload_acl_and_cache";
# Signalling signal handler to proceed to sleep before REFRESH_HOSTS
set debug_sync="now signal refresh_logs";
# Starting shutdown (note this will take 3+ seconds due to DBUG my_sleep in reload_acl_and_cache)
shutdown;
connection server_2;
connection slave;
include/assert_grep.inc [Ensure Mariadbd did not segfault when shutting down]
connection master;
connection slave;
#
# Error testcase to ensure an error message is shown if the signal
# takes longer than the timeout while processing the SIGHUP
connection slave;
set @@global.debug_dbug= "+d,force_sighup_processing_timeout";
set @@global.debug_dbug= "+d,hold_sighup_log_refresh";
connection master;
insert into t1 values (1);
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
# Waiting for sighup to reach reload_acl_and_cache..
set debug_sync="now wait_for in_reload_acl_and_cache";
# Signalling signal handler to proceed to sleep before REFRESH_HOSTS
set debug_sync="now signal refresh_logs";
# Starting shutdown (note this will take 3+ seconds due to DBUG my_sleep in reload_acl_and_cache)
shutdown;
connection server_2;
connection slave;
include/assert_grep.inc [Ensure warning is issued that signal handler thread is still processing]
#
# Cleanup
connection master;
drop table t1;
include/rpl_end.inc
# End of rpl_shutdown_sighup.test

View File

@@ -122,6 +122,31 @@ connection slave;
# Slave_skipped_errros = 5
**** We cannot execute a select as there are differences in the
**** behavior between STMT and RBR.
****
**** Ensure transactions which are skipped due to encountering a
**** non-deadlock error which is present in --slave-skip-errors result
**** in partially committed transactions
connection master;
CREATE TABLE t3 (a INT UNIQUE) ENGINE=InnoDB;
connection slave;
connection slave;
INSERT INTO t3 VALUES (3);
connection master;
BEGIN;
INSERT INTO t3 VALUES (1);
INSERT INTO t3 VALUES (2);
INSERT INTO t3 VALUES (3);
INSERT INTO t3 VALUES (4);
COMMIT;
connection slave;
**** Master and slave tables should have the same data, due to the
**** partially replicated transaction's data overlapping with the data
**** that pre-existed on the slave. That is, despite the transaction
**** consisting of 4 statements, the errored statement should be ignored
**** and the other 3 should commit successfully.
include/diff_tables.inc [master:t3,slave:t3]
connection master;
DROP TABLE t3;
==== Clean Up ====
connection master;
DROP TABLE t1;

View File

@@ -0,0 +1,64 @@
include/master-slave.inc
[connection master]
call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
*** Provoke a deadlock on the slave, check that transaction retry succeeds. ***
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1(a) VALUES (1), (2), (3), (4), (5);
connection slave;
SELECT * FROM t1 ORDER BY a;
a b
1 NULL
2 NULL
3 NULL
4 NULL
5 NULL
SET sql_log_bin=0;
ALTER TABLE t2 ENGINE=MyISAM;
SET sql_log_bin=1;
connect con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,;
connection con_temp1;
BEGIN;
UPDATE t1 SET b=2 WHERE a=4;
INSERT INTO t2 VALUES (2);
DELETE FROM t2 WHERE a=2;
connection master;
BEGIN;
UPDATE t1 SET b=1 WHERE a=2;
INSERT INTO t2 VALUES (1);
UPDATE t1 SET b=1 WHERE a=4;
COMMIT;
connection slave;
connection con_temp1;
UPDATE t1 SET b=2 WHERE a=2;
SELECT * FROM t1 WHERE a<10 ORDER BY a;
a b
1 NULL
2 2
3 NULL
4 2
5 NULL
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
connection slave;
SELECT * FROM t1 ORDER BY a;
a b
1 NULL
2 NULL
3 NULL
4 NULL
5 NULL
* There will be one row in t2 because the ignored deadlock does not retry.
SELECT * FROM t2 ORDER BY a;
a
1
retries
0
Last_SQL_Errno = '0'
Last_SQL_Error = ''
connection master;
DROP TABLE t1;
DROP TABLE t2;
include/rpl_end.inc

View File

@@ -41,7 +41,7 @@ if ($slave_ooo_error)
{
SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout;
SET @sav_slave_transaction_retries = @@global.slave_transaction_retries;
SET @@global.innodb_lock_wait_timeout =1;
SET @@global.innodb_lock_wait_timeout =5;
SET @@global.slave_transaction_retries=0;
}
--source include/start_slave.inc

View File

@@ -42,7 +42,7 @@ insert into ti set a=null;
insert into tm set a=null;
set @@global.debug_dbug="+d,crash_before_send_xid";
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
connection slave;
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
@@ -64,7 +64,7 @@ connection master;
--enable_reconnect
--let $rpl_server_number=1
--source include/rpl_start_server.inc
#--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--echo # Master has restarted successfully
save_master_pos;

View File

@@ -35,9 +35,10 @@ SET @@session.gtid_domain_id= 1;
INSERT INTO t2 VALUES(1);
SELECT * FROM t2;
sync_slave_with_master;
source include/save_master_gtid.inc;
connection slave;
source include/sync_with_master_gtid.inc;
SELECT * FROM t1;
SELECT * FROM t2;

View File

@@ -1 +1 @@
--master-retry-count=100
--master-retry-count=100 --slave-net-timeout=10

View File

@@ -0,0 +1,181 @@
#
# This test ensures that, when a GTID event is constructed by reading its
# content from a binlog file, the reader (e.g. replica, in this test) cannot
# read beyond the length of the GTID event. That is, we ensure that the
# structure indicated by its flags and extra_flags are consistent with the
# actual content of the event.
#
# To spoof a broken GTID log event, we use the DEBUG_DBUG mechanism to inject
# the master to write invalid GTID events for each flag. The transaction is
# given a commit id to ensure the event is not shorter than GTID_HEADER_LEN,
# which would result in zero padding up to GTID_HEADER_LEN.
#
#
# References:
# MDEV-33672: Gtid_log_event Construction from File Should Ensure Event
# Length When Using Extra Flags
#
--source include/have_debug.inc
# GTID event extra_flags are format independent
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
--source include/master-slave.inc
--echo #
--echo # Initialize test data
--connection master
create table t1 (a int) engine=innodb;
--source include/save_master_gtid.inc
set @@SESSION.debug_dbug= "+d,binlog_force_commit_id";
--connection slave
set SQL_LOG_BIN= 0;
call mtr.add_suppression('Found invalid event in binary log');
call mtr.add_suppression('Slave SQL.*Relay log read failure: Could not parse relay log event entry.* 1594');
set SQL_LOG_BIN= 1;
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
--source include/start_slave.inc
--let $cid_ctr= 100
--echo #
--echo # Test FL_PREPARED_XA
--connection master
set @@SESSION.debug_dbug= "+d,negate_xid_from_gtid";
--eval set @commit_id= $cid_ctr
XA START 'x1';
insert into t1 values (1);
XA END 'x1';
XA PREPARE 'x1';
set @@SESSION.debug_dbug= "-d,negate_xid_from_gtid";
XA COMMIT 'x1';
--source include/save_master_gtid.inc
--echo # Waiting for slave to find invalid event..
--connection slave
let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
source include/wait_for_slave_sql_error.inc;
STOP SLAVE IO_THREAD;
--echo # Reset master binlogs (as there is an invalid event) and slave state
--connection master
RESET MASTER;
--connection slave
RESET MASTER;
RESET SLAVE;
set @@global.gtid_slave_pos="";
--source include/start_slave.inc
--echo #
--echo # Test FL_COMPLETED_XA
--connection master
--inc $cid_ctr
--eval set @commit_id= $cid_ctr
XA START 'x1';
--let $next_val = `SELECT max(a)+1 FROM t1`
--eval insert into t1 values ($next_val)
XA END 'x1';
XA PREPARE 'x1';
set @@SESSION.debug_dbug= "+d,negate_xid_from_gtid";
XA COMMIT 'x1';
set @@SESSION.debug_dbug= "-d,negate_xid_from_gtid";
--source include/save_master_gtid.inc
--echo # Waiting for slave to find invalid event..
--connection slave
let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
source include/wait_for_slave_sql_error.inc;
STOP SLAVE IO_THREAD;
--echo # Cleanup hanging XA PREPARE on slave
set statement SQL_LOG_BIN=0 for XA COMMIT 'x1';
--echo # Reset master binlogs (as there is an invalid event) and slave state
--connection master
RESET MASTER;
--connection slave
RESET MASTER;
RESET SLAVE;
set @@global.gtid_slave_pos="";
--source include/start_slave.inc
--echo #
--echo # Test Missing xid.data (but has format id and length description parts)
--connection master
--eval set @commit_id= $cid_ctr
XA START 'x1';
insert into t1 values (1);
XA END 'x1';
XA PREPARE 'x1';
set @@SESSION.debug_dbug= "+d,negate_xid_data_from_gtid";
XA COMMIT 'x1';
set @@SESSION.debug_dbug= "-d,negate_xid_data_from_gtid";
--source include/save_master_gtid.inc
--echo # Waiting for slave to find invalid event..
--connection slave
let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
source include/wait_for_slave_sql_error.inc;
STOP SLAVE IO_THREAD;
--echo # Cleanup hanging XA PREPARE on slave
set statement SQL_LOG_BIN=0 for XA COMMIT 'x1';
--echo # Reset master binlogs (as there is an invalid event) and slave state
--connection master
RESET MASTER;
--connection slave
RESET MASTER;
RESET SLAVE;
set @@global.gtid_slave_pos="";
--source include/start_slave.inc
--echo #
--echo # Test FL_EXTRA_MULTI_ENGINE
--connection master
set @old_dbug= @@SESSION.debug_dbug;
set @@SESSION.debug_dbug= "+d,inject_fl_extra_multi_engine_into_gtid";
--inc $cid_ctr
--eval set @commit_id= $cid_ctr
--let $next_val = `SELECT max(a)+1 FROM t1`
--eval insert into t1 values ($next_val)
--source include/save_master_gtid.inc
set @@SESSION.debug_dbug=@old_dbug;
--connection slave
--echo # Waiting for slave to find invalid event..
let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
source include/wait_for_slave_sql_error.inc;
STOP SLAVE IO_THREAD;
--echo # Reset master binlogs (as there is an invalid event) and slave state
--connection master
RESET MASTER;
--connection slave
RESET SLAVE;
RESET MASTER;
set @@global.gtid_slave_pos="";
--source include/start_slave.inc
--echo #
--echo # Cleanup
--connection master
drop table t1;
--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_header_valid.test

View File

@@ -18,8 +18,14 @@
# associated with this test should enforce that the binlog background thread is
# not created before the handle manager is initialized.
#
# Addendum 1) This test is extended for MDEV-33799, as the original fix
# left out the possibility that the binlog background thread can be
# started during recovery if the binary log is used as the transaction
# coordinator. This resulted in similar segfaults as seen by MDEV-26473.
#
# References:
# MDEV-26473 mysqld got exception 0xc0000005 (rpl_slave_state/rpl_load_gtid_slave_state)
# MDEV-33799 mysql_manager_submit Segfault at Startup Still Possible During Recovery
#
--source include/have_debug.inc
@@ -53,6 +59,63 @@ create table t1 (a int);
--source include/start_slave.inc
--echo #
--echo # MDEV-33799
--echo # Ensure that when the binary log is used for recovery (as tc log), that
--echo # the recovery process cannot start the binlog background thread before
--echo # the mysql handle manager has started.
--connection slave
--echo # Add test suppresssions so crash recovery messages don't fail the test
set session sql_log_bin=0;
call mtr.add_suppression("mariadbd: Got error '145.*");
call mtr.add_suppression("Checking table:.*");
call mtr.add_suppression("mysql.gtid_slave_pos:.*hasn't closed the table properly");
call mtr.add_suppression("Can't init tc log");
call mtr.add_suppression("Aborting");
set session sql_log_bin=1;
--echo # Create slave-side only table
create table t2 (a int) engine=innodb;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--echo # Crash mariadbd when binlogging transaction to corrupt database state
--connection slave1
set @@session.debug_dbug="+d,crash_before_writing_xid";
--send insert into t2 values (1)
--connection slave
--source include/wait_until_disconnected.inc
--connection slave1
--error 2013,ER_CONNECTION_KILLED
--reap
--echo # Restart mariadbd in recovery mode. Note --tc-heuristic-recover
--echo # forces mysqld to exit with error, so we run mariadbd via CLI
--echo # MYSQLD_LAST_CMD --debug_dbug="+d,delay_start_handle_manager" --tc-heuristic-recover=COMMIT
--error 1
--exec $MYSQLD_LAST_CMD --debug_dbug="+d,delay_start_handle_manager" --tc-heuristic-recover=COMMIT
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart
EOF
--connection server_2
--enable_reconnect
--source include/wait_until_connected_again.inc
--connection slave1
--enable_reconnect
--source include/wait_until_connected_again.inc
--connection slave
--enable_reconnect
--source include/wait_until_connected_again.inc
--source include/start_slave.inc
--echo #
--echo # Cleanup
--echo #
@@ -63,5 +126,6 @@ drop table t1;
--connection slave
--source include/sync_with_master_gtid.inc
drop table t2;
--source include/rpl_end.inc

View File

@@ -0,0 +1,173 @@
# Similar to rpl_parallel_optimistic_xa to verify XA
# parallel execution with multiple gtid domain.
# References:
# MDEV-33668 Adapt parallel slave's round-robin scheduling to XA events
--source include/have_innodb.inc
--source include/have_perfschema.inc
--source include/master-slave.inc
# Tests' global declarations
--let $trx = _trx_
call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
call mtr.add_suppression("WSREP: handlerton rollback failed");
--connection master
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--save_master_pos
# Prepare to restart slave into optimistic parallel mode
--connection slave
--sync_with_master
--source include/stop_slave.inc
SET @old_parallel_threads = @@GLOBAL.slave_parallel_threads;
SET @old_slave_domain_parallel_threads = @@GLOBAL.slave_domain_parallel_threads;
SET @@global.slave_parallel_threads = 5;
SET @@global.slave_domain_parallel_threads = 3;
SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode;
CHANGE MASTER TO master_use_gtid=slave_pos;
--connection master
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 0);
--source include/save_master_gtid.inc
--connection slave
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
--let $mode = 2
# mode = 2 is optimistic
SET @@global.slave_parallel_mode ='optimistic';
while ($mode)
{
--connection master
#
# create XA events alternating gtid domains to run them in parallel on slave.
#
--let $domain_num = 3
--let $trx_num = 777
--let $i = $trx_num
--let $conn = master
--disable_query_log
while($i > 0)
{
--let $domain_id = `SELECT $i % $domain_num`
--eval set @@gtid_domain_id = $domain_id
# 'decision' to commit 0, or rollback 1
--let $decision = `SELECT $i % 2`
--eval XA START '$conn$trx$i'
--eval UPDATE t1 SET b = 1 - 2 * $decision WHERE a = 1
--eval XA END '$conn$trx$i'
--eval XA PREPARE '$conn$trx$i'
--let $term = COMMIT
if ($decision)
{
--let $term = ROLLBACK
}
--eval XA $term '$conn$trx$i'
--dec $i
}
--enable_query_log
--source include/save_master_gtid.inc
--connection slave
if (`select $mode = 1`)
{
SET @@global.slave_parallel_mode ='conservative';
}
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
--dec $mode
}
# Generations test.
# Create few ranges of XAP groups length of greater than
# 3 * slave_parallel_threads + 1
# terminated upon each range.
--let $iter = 3
--let $generation_len = @@global.slave_parallel_threads
--let $domain_num = 3
--disable_query_log
--connection master
while ($iter)
{
--let $k = `select 3 * 3 * $generation_len`
--let $_k = $k
while ($k)
{
--source include/count_sessions.inc
--connect(con$k,localhost,root,,)
#
# create XA events alternating gtid domains to run them in parallel on slave.
#
--let $domain_id = `SELECT $k % $domain_num`
--eval set @@gtid_domain_id = $domain_id
--eval XA START '$trx$k'
--eval INSERT INTO t1 VALUES ($k + 1, $iter)
--eval XA END '$trx$k'
--eval XA PREPARE '$trx$k'
--disconnect con$k
--connection master
--source include/wait_until_count_sessions.inc
--dec $k
}
--connection master
--let $k = $_k
while ($k)
{
--let $term = COMMIT
--let $decision = `SELECT $k % 2`
if ($decision)
{
--let $term = ROLLBACK
}
--eval XA $term '$trx$k'
}
--dec $iter
}
--enable_query_log
--source include/save_master_gtid.inc
--connection slave
SET @@global.slave_parallel_mode = 'optimistic';
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
#
# Overall consistency check
#
--let $diff_tables= master:t1, slave:t1
--source include/diff_tables.inc
#
# Clean up.
#
--connection slave
--source include/stop_slave.inc
SET @@global.slave_parallel_mode = @old_parallel_mode;
SET @@global.slave_parallel_threads = @old_parallel_threads;
SET @@global.slave_domain_parallel_threads = @old_slave_domain_parallel_threads;
--source include/start_slave.inc
--connection master
DROP TABLE t1;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--connection master
--source include/rpl_end.inc

View File

@@ -195,4 +195,22 @@ DROP TABLE ti;
--sync_slave_with_master
# MDEV-31779 server crash in Rows_log_event::update_sequence at replaying binlog
--connection master
--let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
CREATE SEQUENCE s;
--disable_ps2_protocol
SELECT NEXTVAL(s);
--enable_ps2_protocol
flush binary logs;
DROP SEQUENCE s;
--exec $MYSQL_BINLOG $datadir/$binlog_file | $MYSQL test
DROP SEQUENCE s;
--sync_slave_with_master
--connection master
--source include/rpl_end.inc

View File

@@ -295,13 +295,14 @@ CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
||
--delimiter ;
SET sql_log_bin=1;
--source include/stop_slave_io.inc
--connection server_1
INSERT INTO t3 VALUES (49,0);
--save_master_pos
--connection server_2
START SLAVE SQL_THREAD;
CHANGE MASTER TO master_use_gtid=no;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t3 WHERE a >= 40 ORDER BY a;
# Restore the foo() function.
@@ -334,11 +335,6 @@ SET GLOBAL slave_parallel_threads=10;
--echo *** 3. Same as (2), but not using gtid mode ***
--connection server_2
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=no;
--source include/start_slave.inc
--connection server_1
# Set up three transactions on the master that will be group-committed
# together so they can be replicated in parallel on the slave.

View File

@@ -47,7 +47,7 @@ RESET SLAVE;
--echo #
--let $datadir = `select @@datadir`
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -64,7 +64,7 @@ RESET SLAVE;
--echo # Restart slave server
--echo #
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;

View File

@@ -34,14 +34,16 @@ if ($case == 1)
if ($case == 2)
{
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go";
SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync WAIT_FOR con1_go1";
--send_eval $query_to_crash
--connect (conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
# use the same signal with $query_to_crash
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
SET GLOBAL debug_dbug="d,Notify_binlog_EOF";
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL con1_go";
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con2_ready";
--send_eval $query2_to_crash
--connection server_$server_to_crash
SET DEBUG_SYNC= "now WAIT_FOR eof_reached";
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
--source include/kill_mysqld.inc
}
@@ -68,9 +70,7 @@ source include/wait_for_slave_param.inc;
--error 2003
--source include/stop_slave.inc
--let $assert_cond= COUNT(*) = $expected_rows_on_slave FROM t1
--let $assert_text= Table t1 should have $expected_rows_on_slave rows.
--source include/assert.inc
--eval select count(*) 'on slave must be $expected_rows_on_slave' from t1
SELECT @@GLOBAL.gtid_current_pos;
@@ -95,9 +95,7 @@ if (`SELECT strcmp("OFF", "$slave_semi_sync_status") != 0`)
--die Slave started with skip-slave-start yet started with rpl_semi_sync_slave_status=ON
}
--let $assert_cond= COUNT(*) = $expected_rows_on_master FROM t1
--let $assert_text= Table t1 should have $expected_rows_on_master rows.
--source include/assert.inc
--eval select count(*) 'on master must be $expected_rows_on_master' from t1
# Check error log for correct messages.
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.$server_to_crash.err;

View File

@@ -83,7 +83,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos';
--connection server_1
--sync_with_master
--eval SELECT COUNT(*) = $rows_so_far as 'true' FROM t1
--eval SELECT COUNT(*) 'must be $rows_so_far' FROM t1
--echo # ... the gtid states on the slave:
SHOW VARIABLES LIKE 'gtid_slave_pos';
SHOW VARIABLES LIKE 'gtid_binlog_pos';
@@ -134,7 +134,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos';
--connection server_2
--sync_with_master
--eval SELECT COUNT(*) = $rows_so_far as 'true' FROM t1
--eval SELECT COUNT(*) 'must be $rows_so_far as' FROM t1
--echo # ... the gtid states on the slave:
SHOW VARIABLES LIKE 'gtid_slave_pos';
SHOW VARIABLES LIKE 'gtid_binlog_pos';
@@ -185,7 +185,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos';
--connection server_1
--source include/sync_with_master_gtid.inc
--eval SELECT COUNT(*) = $rows_so_far as 'true' FROM t1
--eval SELECT COUNT(*) 'must be $rows_so_far' FROM t1
--echo # ... the gtid states on the slave:
SHOW VARIABLES LIKE 'gtid_slave_pos';
SHOW VARIABLES LIKE 'gtid_binlog_pos';

View File

@@ -4,19 +4,17 @@
# finishes off as specified in particular trying to connect even to a shut down
# master for a semisync firewell routine.
source include/not_embedded.inc;
source include/have_debug.inc;
source include/master-slave.inc;
--connection master
--let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled `
--let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled`
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
--connection slave
source include/stop_slave.inc;
--let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled `
SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1;
--let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1;
source include/start_slave.inc;
--connection master
@@ -52,7 +50,6 @@ source include/rpl_start_server.inc;
#--source include/start_slave.inc
--connection master
SET @@GLOBAL.debug_dbug="";
--eval SET @@GLOBAL. rpl_semi_sync_master_enabled = $sav_enabled_master
--connection master

View File

@@ -206,7 +206,6 @@ SET GLOBAL debug_dbug="+d,simulate_delay_semisync_slave_reply";
--echo # Wait for thd to begin semi-sync wait..
--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = 'Waiting for semi-sync ACK from slave'
--source include/wait_condition.inc
--source include/wait_condition.inc
--echo # ..done
--disconnect con1
@@ -220,15 +219,10 @@ EOF
SHUTDOWN WAIT FOR ALL SLAVES;
--source include/wait_until_disconnected.inc
# Run assert_grep on server_2 as it uses SQL commands for verification, but
# server_1 has gone away
--connection server_2
--let $assert_text= Ensure the primary waited for the ACK of the killed thread
--let $assert_select= Delaying shutdown to await semi-sync ACK
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count= 5
--let $assert_only_after=CURRENT_TEST
--source include/assert_grep.inc
--echo # Ensure the primary waited for the ACK of the killed thread
--let $SEARCH_PATTERN= Delaying shutdown to await semi-sync ACK
--let $SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err
--source include/search_pattern_in_file.inc
--connection default
--source include/wait_until_disconnected.inc

View File

@@ -0,0 +1,154 @@
#
# The signal handler thread can use various different runtime resources when
# processing a SIGHUP (e.g. master-info information), as the logic calls into
# reload_acl_and_cache(). This test ensures that SIGHUP processing, when
# concurrent with server shutdown, the shutdown logic must wait for the SIGHUP
# processing to finish before cleaning up any resources.
#
# Additionally, the error case is tested such that the signal handler thread
# takes too long processing a SIGHUP, and the main mysqld thread must skip its
# wait and output a warning.
#
# Note the SIGHUP is sent via the command-line kill program via a perl script.
#
# References:
# MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown
#
--source include/not_windows.inc
--source include/not_embedded.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Binlog format doesn't matter
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
# For error test case which forces timeout
--connection slave
set statement sql_log_bin=0 for call mtr.add_suppression("Signal handler thread did not exit in a timely manner");
--echo #
--echo # Main test
--connection master
create table t1 (a int);
insert into t1 values (1);
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
# Make signal handler handle SIGHUP..
set @@global.debug_dbug= "+d,hold_sighup_log_refresh";
--let KILL_NODE_PIDFILE = `SELECT @@pid_file`
--perl
my $kill_sig = $ENV{'KILL_SIGNAL_VALUE'};
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -HUP $mysqld_pid");
exit(0);
EOF
--echo # Waiting for sighup to reach reload_acl_and_cache..
set debug_sync="now wait_for in_reload_acl_and_cache";
--echo # Signalling signal handler to proceed to sleep before REFRESH_HOSTS
set debug_sync="now signal refresh_logs";
# ..while we are shutting down
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--echo # Starting shutdown (note this will take 3+ seconds due to DBUG my_sleep in reload_acl_and_cache)
shutdown;
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0
EOF
--connection server_2
--enable_reconnect
--source include/wait_until_connected_again.inc
--connection slave
--enable_reconnect
--source include/wait_until_connected_again.inc
--let $assert_text= Ensure Mariadbd did not segfault when shutting down
--let $assert_select= got signal 11
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
--let $assert_count= 0
--let $assert_only_after = CURRENT_TEST: rpl.rpl_shutdown_sighup
--source include/assert_grep.inc
--connection master
--sync_slave_with_master
--echo #
--echo # Error testcase to ensure an error message is shown if the signal
--echo # takes longer than the timeout while processing the SIGHUP
--connection slave
set @@global.debug_dbug= "+d,force_sighup_processing_timeout";
set @@global.debug_dbug= "+d,hold_sighup_log_refresh";
--connection master
insert into t1 values (1);
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
# Make signal handler handle SIGHUP..
--let KILL_NODE_PIDFILE = `SELECT @@pid_file`
--perl
my $kill_sig = $ENV{'KILL_SIGNAL_VALUE'};
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -HUP $mysqld_pid");
exit(0);
EOF
--echo # Waiting for sighup to reach reload_acl_and_cache..
set debug_sync="now wait_for in_reload_acl_and_cache";
--echo # Signalling signal handler to proceed to sleep before REFRESH_HOSTS
set debug_sync="now signal refresh_logs";
# ..while we are shutting down
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--echo # Starting shutdown (note this will take 3+ seconds due to DBUG my_sleep in reload_acl_and_cache)
shutdown;
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart: --skip-slave-start=0
EOF
--connection server_2
--enable_reconnect
--source include/wait_until_connected_again.inc
--connection slave
--enable_reconnect
--source include/wait_until_connected_again.inc
--let $assert_text= Ensure warning is issued that signal handler thread is still processing
--let $assert_select= Signal handler thread did not exit in a timely manner.
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
--let $assert_count= 1
--let $assert_only_after = CURRENT_TEST: rpl.rpl_shutdown_sighup
--source include/assert_grep.inc
--echo #
--echo # Cleanup
--connection master
drop table t1;
--source include/rpl_end.inc
--echo # End of rpl_shutdown_sighup.test

View File

@@ -3,7 +3,11 @@
# Verify that --slave-skip-errors works correctly. The error messages
# specified by --slave-skip-errors on slave should be ignored. If
# such errors occur, they should not be reported and not cause the
# slave to stop.
# slave to stop. If a skipped-due-to-error statement is a part of a
# larger transaction, and the error is not a deadlock error, the rest
# of the transaction should still commit, with just the errored statement
# ignored (note transactions which are skipped due to deadlocks are
# rolled back fully, see rpl_temporary_error2_skip_all.test).
#
# ==== Method ====
#
@@ -164,6 +168,42 @@ let $current_skipped_error= query_get_value(show global status like "Slave_skipp
--echo **** We cannot execute a select as there are differences in the
--echo **** behavior between STMT and RBR.
--echo ****
--echo **** Ensure transactions which are skipped due to encountering a
--echo **** non-deadlock error which is present in --slave-skip-errors result
--echo **** in partially committed transactions
# Slave will insert 3 first, and master will insert 3 within a larger trx
--let $value_preexisting_on_slave= 3
--connection master
CREATE TABLE t3 (a INT UNIQUE) ENGINE=InnoDB;
--sync_slave_with_master
--connection slave
--eval INSERT INTO t3 VALUES ($value_preexisting_on_slave)
--connection master
BEGIN;
INSERT INTO t3 VALUES (1);
INSERT INTO t3 VALUES (2);
--eval INSERT INTO t3 VALUES ($value_preexisting_on_slave)
INSERT INTO t3 VALUES (4);
COMMIT;
--sync_slave_with_master
--echo **** Master and slave tables should have the same data, due to the
--echo **** partially replicated transaction's data overlapping with the data
--echo **** that pre-existed on the slave. That is, despite the transaction
--echo **** consisting of 4 statements, the errored statement should be ignored
--echo **** and the other 3 should commit successfully.
let $diff_tables=master:t3,slave:t3;
source include/diff_tables.inc;
--connection master
DROP TABLE t3;
--echo ==== Clean Up ====
connection master;

View File

@@ -82,7 +82,7 @@ print FILE "failure";
close ($file);
EOF
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
--error 2013
FLUSH LOGS;
@@ -130,7 +130,7 @@ print FILE @content;
close FILE;
EOF
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
--error 2013
FLUSH LOGS;

View File

@@ -64,7 +64,14 @@ ROLLBACK;
--connection slave
--sync_with_master
SELECT * FROM t1 ORDER BY a;
--echo * There will be two rows in t2 due to the retry.
if (!$ignored_db_deadlock)
{
--echo * There will be two rows in t2 due to the retry.
}
if ($ignored_db_deadlock)
{
--echo * There will be one row in t2 because the ignored deadlock does not retry.
}
SELECT * FROM t2 ORDER BY a;
let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
--disable_query_log

View File

@@ -0,0 +1 @@
--slave-skip-errors=all

View File

@@ -0,0 +1,3 @@
--source include/have_binlog_format_row.inc
--let $ignored_db_deadlock= 1
--source rpl_temporary_error2.test