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.9

This commit is contained in:
Oleksandr Byelkin
2023-08-04 08:01:06 +02:00
858 changed files with 12277 additions and 6177 deletions

View File

@@ -0,0 +1,68 @@
--connection master
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=innodb;
insert into t1 values (1);
--source include/save_master_gtid.inc
--connection slave
call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit on which this one depends");
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
set @save.slave_parallel_threads= @@global.slave_parallel_threads;
set @save.slave_parallel_mode= @@global.slave_parallel_mode;
set @@global.slave_parallel_threads= 3;
set @@global.slave_parallel_mode= CONSERVATIVE;
--connection slave1
BEGIN;
update t1 set a=2 where a=1;
--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;
# T2
insert into t2 values (1);
# GCO 2
SET @commit_id= 10001;
# T3
insert into t1 values (3);
--connection slave
--source include/start_slave.inc
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--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
--let $t3_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for prior transaction to start commit%'`
--evalp kill $t3_tid
--connection slave1
commit;
--connection slave
--let $slave_timeout=1032
--source include/wait_for_slave_sql_to_stop.inc
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
--source include/start_slave.inc
--echo #
--echo # Cleanup
--connection master
DROP TABLE t1, t2;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc

View File

@@ -0,0 +1,94 @@
--echo # MDEV-31448 OOO finish event group by killed worker
# The test demonstrates how a killed worker access gco lists
# in finish_event_group() out-of-order to fire
# DBUG_ASSERT(!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id);
# in the buggy version.
--echo # Initialize test data
--connection master
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=innodb;
insert into t1 values (1);
--source include/save_master_gtid.inc
--connection slave
call mtr.add_suppression("Connection was killed");
call mtr.add_suppression("Can.t find record");
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
set @save.slave_parallel_threads= @@global.slave_parallel_threads;
set @save.slave_parallel_mode= @@global.slave_parallel_mode;
set @@global.slave_parallel_threads= 3;
set @@global.slave_parallel_mode= OPTIMISTIC;
--connection slave1
begin;
update t1 set a=2 where a=1;
--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;
if (!$killed_trx_commits)
{
set @commit_id= 10001;
# T2
set statement skip_parallel_replication=1 for insert into t2 values (1);
}
if ($killed_trx_commits)
{
insert into t2 values (1);
}
# GCO 2
# T3
drop table t2;
--connection slave
--source include/start_slave.inc
--echo # wait for T1
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--echo # wait for T2
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--let $t2_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker'`
--echo # wait for T3
--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
--evalp kill $t2_tid
# give some little time for T2 to re-sink into the same state
--let $slave_param=Last_Errno
--let $slave_param_value=1927
--source include/wait_for_slave_param.inc
--connection slave1
commit;
--connection slave
--let $slave_timeout=1032
--source include/wait_for_slave_sql_to_stop.inc
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
--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

View File

@@ -182,9 +182,11 @@ drop trigger t1_bi;
# Check that nested call doesn't affect outer context.
select last_insert_id();
--disable_ps2_protocol
--disable_warnings ONCE
select bug15728_insert();
select last_insert_id();
--enable_ps2_protocol
insert into t1 (last_id) values (bug15728());
# This should be exactly one greater than in the previous call.
select last_insert_id();
@@ -440,8 +442,10 @@ delimiter ;|
INSERT INTO t1 VALUES (NULL, -1);
CALL p1();
--disable_ps2_protocol
--disable_warnings ONCE
SELECT f1();
--enable_ps2_protocol
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
INSERT INTO t1 VALUES (NULL, f2());
@@ -458,7 +462,9 @@ connection master1;
INSERT INTO t1 (i) VALUES (NULL);
connection master;
--disable_ps2_protocol
SELECT f3();
--enable_ps2_protocol
SELECT * FROM t1 ORDER BY i;
SELECT * FROM t2 ORDER BY i;
@@ -510,8 +516,10 @@ insert into t2 (id) values(1),(2),(3);
delete from t2;
set sql_log_bin=1;
#inside SELECT, then inside INSERT
--disable_ps2_protocol
--disable_warnings ONCE
select insid();
--enable_ps2_protocol
set sql_log_bin=0;
insert into t2 (id) values(5),(6),(7);
delete from t2 where id>=5;

View File

@@ -213,6 +213,7 @@ if ($commands == 'clean')
--let $commands=
}
--disable_ps2_protocol
while ($commands != '')
{
--disable_query_log
@@ -633,5 +634,6 @@ while ($commands != '')
inc $trans_id;
}
}
--enable_ps2_protocol
--let $commands= $rme_initial_commands

View File

@@ -40,7 +40,9 @@ end|
delimiter ;|
# test both in SELECT and in INSERT
--disable_ps2_protocol
select fn1(0);
--enable_ps2_protocol
eval create table t2 (a int) engine=$engine_type;
insert into t2 values(fn1(2));

View File

@@ -54,7 +54,9 @@ FLUSH LOGS;
--echo # Pt.2 Ensure NEXTVAL replicates and binlogs correctly
--connection server_1
--disable_ps2_protocol
SELECT NEXTVAL(s1);
--enable_ps2_protocol
--source include/save_master_gtid.inc
--echo # Validate NEXTVAL replicated correctly to other servers

View File

@@ -14,6 +14,7 @@ DROP TABLE IF EXISTS test.t1;
# Begin test section 1
--disable_ps2_protocol
eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type;
delimiter |;
@@ -70,6 +71,7 @@ connection slave;
SELECT * FROM test.t1;
connection master;
#show binlog events from 720;
--enable_ps2_protocol
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;

View File

@@ -0,0 +1,52 @@
include/master-slave.inc
[connection master]
# MDEV-31448 OOO finish event group by killed worker
# Initialize test data
connection master;
call mtr.add_suppression("Slave: Connection was killed");
call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit on which this one depends");
create table t1 (a int) engine=innodb;
create table t2 (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
set @@global.slave_parallel_threads= 4;
set @@global.slave_parallel_mode= OPTIMISTIC;
set @@global.innodb_lock_wait_timeout= 30;
set @@global.slave_transaction_retries= 0;
connection slave1;
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 statement skip_parallel_replication=1 for insert into t2 values (1);
drop table t2;
connection slave;
include/start_slave.inc
# wait for T1
# wait for T2
# wait for T3
kill T2_TID;
connection slave1;
ROLLBACK;
connection master;
DROP TABLE t1;
include/save_master_gtid.inc
connection slave;
#
# Cleanup
include/stop_slave.inc
set @@global.slave_parallel_threads= 0;
set @@global.slave_parallel_mode= optimistic;
set @@global.innodb_lock_wait_timeout= 50;
set @@global.slave_transaction_retries= 10;
include/start_slave.inc
include/sync_with_master_gtid.inc
include/rpl_end.inc

View File

@@ -554,6 +554,62 @@ a
32
33
34
*** MDEV-31723: Crash on SET SESSION gtid_seq_no= DEFAULT
connection server_1;
SET SESSION gtid_seq_no= 2000;
SELECT @@SESSION.gtid_seq_no;
@@SESSION.gtid_seq_no
2000
INSERT INTO t1 VALUES (40);
SELECT @@SESSION.gtid_seq_no;
@@SESSION.gtid_seq_no
0
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2000
INSERT INTO t1 VALUES (41);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2001
SET SESSION gtid_seq_no= 2010;
INSERT INTO t1 VALUES (42);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2010
SET @old_strict= @@GLOBAL.gtid_strict_mode;
SET GLOBAL gtid_strict_mode= 1;
SET SESSION gtid_seq_no= 0;
INSERT INTO t1 VALUES (43);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2011
SET GLOBAL gtid_strict_mode= @old_strict;
INSERT INTO t1 VALUES (44);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2012
SET SESSION gtid_seq_no= 2020;
SET SESSION gtid_seq_no= 2030;
INSERT INTO t1 VALUES (45);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2030
SET SESSION gtid_seq_no= 2040;
SET SESSION gtid_seq_no= DEFAULT;
INSERT INTO t1 VALUES (46);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2031
INSERT INTO t1 VALUES (47);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2032
SET SESSION gtid_seq_no= 2050;
SET SESSION gtid_seq_no= 0;
INSERT INTO t1 VALUES (48);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
dom0_pos
0-1-2033
connection server_1;
DROP TABLE t1;
include/rpl_end.inc

View File

@@ -168,7 +168,7 @@ SELECT * from t1 WHERE a > 10 ORDER BY a;
a
gtid_check
Binlog pos ok
# Wait 30 seconds for SQL thread to catch up with IO thread
# Wait 60 seconds for SQL thread to catch up with IO thread
connection server_2;
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
@@ -224,7 +224,7 @@ gtid_check
Binlog pos ok
gtid_check
Current pos ok
# Wait 30 seconds for SQL thread to catch up with IO thread
# Wait 60 seconds for SQL thread to catch up with IO thread
connection server_2;
SELECT * from t1 WHERE a > 10 ORDER BY a;
a
@@ -275,7 +275,7 @@ COMMIT;
Got one of the listed errors
connection server_1;
connection server_2;
# Wait 30 seconds for IO thread to connect and SQL thread to catch up
# Wait 60 seconds for IO thread to connect and SQL thread to catch up
# with IO thread.
include/stop_slave.inc
connection server_1;

View File

@@ -8,7 +8,7 @@ FLUSH LOGS;
call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
connection slave;
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000002' at XXX, the last byte read from 'master-bin.000002' at XXX.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the first event 'FILE' at XXX, the last event read from 'master-bin.000002' at XXX, the last byte read from 'master-bin.000002' at XXX.''
connection master;
CREATE TABLE t2(c1 INT);
FLUSH LOGS;

View File

@@ -0,0 +1,105 @@
include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=3;
SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode=aggressive;
SET @old_dbug= @@GLOBAL.debug_dbug;
CHANGE MASTER TO master_use_gtid=slave_pos;
include/start_slave.inc
*** MDEV-31509: Lost data with FTWRL and STOP SLAVE
connection master;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (0,0);
INSERT INTO t2 VALUES (0,0);
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
connection slave;
*** Arrange for T1 to delay before entering GCO wait.
SET GLOBAL debug_dbug="+d,gco_wait_delay_gtid_0_x_99";
*** Arrange for T2 to wait for FTWRL to start.
SET GLOBAL debug_dbug="+d,hold_worker_on_schedule";
*** Arrange for T2 to delay wakeup from FTWRL pause.
SET GLOBAL debug_dbug="+d,delay_ftwrl_wait_gtid_0_x_100";
connection master;
*** Event group T1
SET SESSION gtid_seq_no=99;
INSERT INTO t1 VALUES (1,1);
connection slave;
*** 1a. Wait for T1 to be queued.
SET debug_sync="now WAIT_FOR gco_wait_paused";
connection master;
*** Event group T2
SET SESSION gtid_seq_no=100;
INSERT INTO t2 VALUES (2,2);
connection slave;
*** 1b. Wait for T2 to be queued.
SET debug_sync= "now WAIT_FOR reached_pause";
connection slave1;
*** 2. Run FTWRL
SET GLOBAL debug_dbug= "+d,pause_for_ftwrl_wait";
FLUSH TABLES WITH READ LOCK;
connection slave;
SET debug_sync= "now WAIT_FOR pause_ftwrl_waiting";
*** 3. Wait for T2 to be waiting for FTWRL pause
SET debug_sync= "now SIGNAL continue_worker";
*** 4. FTWRL completes, UNLOCK TABLES.
SET debug_sync="now SIGNAL pause_ftwrl_cont";
connection slave1;
UNLOCK TABLES;
connection slave;
*** T2 is now ready to proceed after FTWRL pause, but did not wake up yet.
SET debug_sync="now WAIT_FOR pause_wait_started";
*** 5. STOP SLAVE is run.
connection slave1;
SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger";
STOP SLAVE;
connection slave;
SET debug_sync="now WAIT_FOR wait_for_done_waiting";
*** 5. T2 wakes up after FTWRL pause, reaches wait_for_prior_commit().
SET debug_sync="now SIGNAL pause_wait_continue";
*** 6. T1 starts.
SET debug_sync="now SIGNAL gco_wait_cont";
connection slave1;
connection slave;
include/wait_for_slave_to_stop.inc
connection master;
SELECT * FROM t1 ORDER BY a;
a b
0 0
1 1
SELECT * FROM t2 ORDER BY a;
a b
0 0
2 2
include/save_master_gtid.inc
connection slave;
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT @@GLOBAL.gtid_slave_pos;
@@GLOBAL.gtid_slave_pos
0-1-100
SELECT * FROM t1 ORDER BY a;
a b
0 0
1 1
SELECT * FROM t2 ORDER BY a;
a b
0 0
2 2
*** Clean up.
connection slave;
include/stop_slave.inc
SET DEBUG_SYNC= "RESET";
SET GLOBAL slave_parallel_threads= @old_parallel_threads;
SET GLOBAL slave_parallel_mode= @old_parallel_mode;
SET GLOBAL debug_dbug=@old_dbug;
include/start_slave.inc
connection master;
DROP TABLE t1, t2;
include/rpl_end.inc

View File

@@ -0,0 +1,142 @@
include/master-slave.inc
[connection master]
connection master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=innodb;
insert into t1 values (1);
include/save_master_gtid.inc
connection slave;
call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit on which this one depends");
include/sync_with_master_gtid.inc
include/stop_slave.inc
set @save.slave_parallel_threads= @@global.slave_parallel_threads;
set @save.slave_parallel_mode= @@global.slave_parallel_mode;
set @@global.slave_parallel_threads= 3;
set @@global.slave_parallel_mode= CONSERVATIVE;
connection slave1;
BEGIN;
update t1 set a=2 where 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;
insert into t2 values (1);
SET @commit_id= 10001;
insert into t1 values (3);
connection slave;
include/start_slave.inc
kill $t3_tid;
connection slave1;
commit;
connection slave;
include/wait_for_slave_sql_to_stop.inc
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
include/start_slave.inc
#
# Cleanup
connection master;
DROP TABLE t1, t2;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
# MDEV-31448 OOO finish event group by killed worker
# Initialize test data
connection master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=innodb;
insert into t1 values (1);
include/save_master_gtid.inc
connection slave;
call mtr.add_suppression("Connection was killed");
call mtr.add_suppression("Can.t find record");
include/sync_with_master_gtid.inc
include/stop_slave.inc
set @save.slave_parallel_threads= @@global.slave_parallel_threads;
set @save.slave_parallel_mode= @@global.slave_parallel_mode;
set @@global.slave_parallel_threads= 3;
set @@global.slave_parallel_mode= OPTIMISTIC;
connection slave1;
begin;
update t1 set a=2 where 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;
insert into t2 values (1);
drop table t2;
connection slave;
include/start_slave.inc
# wait for T1
# wait for T2
# wait for T3
kill $t2_tid;
include/wait_for_slave_param.inc [Last_Errno]
connection slave1;
commit;
connection slave;
include/wait_for_slave_sql_to_stop.inc
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
include/start_slave.inc
#
# Cleanup
connection master;
drop table t1;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
# MDEV-31448 OOO finish event group by killed worker
# Initialize test data
connection master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=innodb;
insert into t1 values (1);
include/save_master_gtid.inc
connection slave;
call mtr.add_suppression("Connection was killed");
call mtr.add_suppression("Can.t find record");
include/sync_with_master_gtid.inc
include/stop_slave.inc
set @save.slave_parallel_threads= @@global.slave_parallel_threads;
set @save.slave_parallel_mode= @@global.slave_parallel_mode;
set @@global.slave_parallel_threads= 3;
set @@global.slave_parallel_mode= OPTIMISTIC;
connection slave1;
begin;
update t1 set a=2 where 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;
set statement skip_parallel_replication=1 for insert into t2 values (1);
drop table t2;
connection slave;
include/start_slave.inc
# wait for T1
# wait for T2
# wait for T3
kill $t2_tid;
include/wait_for_slave_param.inc [Last_Errno]
connection slave1;
commit;
connection slave;
include/wait_for_slave_sql_to_stop.inc
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
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

View File

@@ -1,12 +1,17 @@
include/master-slave.inc
[connection master]
#
# MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel Replicas
#
connection slave;
include/stop_slave.inc
set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master";
set @@GLOBAL.slave_parallel_mode= CONSERVATIVE;
change master to master_delay=3, master_use_gtid=Slave_Pos;
set @@GLOBAL.slave_parallel_threads=2;
include/start_slave.inc
connection master;
create table t1 (a int);
create table t2 (a int);
include/sync_slave_sql_with_master.inc
#
# Pt 1) Ensure SBM is updated immediately upon arrival of the next event
@@ -25,11 +30,10 @@ connection slave;
UNLOCK TABLES;
include/sync_with_master_gtid.inc
#
# Pt 2) If the SQL thread has not entered an idle state, ensure
# Pt 2) If the worker threads have not entered an idle state, ensure
# following events do not update SBM
# Stop slave IO thread so it receives both events together on restart
connection slave;
include/stop_slave_io.inc
LOCK TABLES t1 WRITE;
connection master;
# Sleep 2 to allow a buffer between events for SBM check
insert into t1 values (1);
@@ -37,36 +41,49 @@ insert into t1 values (1);
insert into t1 values (2);
include/save_master_pos.inc
connection slave;
LOCK TABLES t1 WRITE;
SET @@global.debug_dbug="+d,pause_sql_thread_on_next_event";
START SLAVE IO_THREAD;
# Before we start processing the events, we ensure both transactions
# were written into the relay log. Otherwise, if the IO thread takes too
# long to queue the events, the sql thread can think it has caught up
# too quickly.
SET DEBUG_SYNC='now WAIT_FOR paused_on_event';
include/sync_io_with_master.inc
SET @@global.debug_dbug="-d,pause_sql_thread_on_next_event";
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
# Wait for first transaction to complete SQL delay and begin execution..
# Validate SBM calculation doesn't use the second transaction because SQL thread shouldn't have gone idle..
# Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle..
# ..and that SBM wasn't calculated using prior committed transactions
# ..done
connection slave;
UNLOCK TABLES;
#
include/wait_for_slave_param.inc [Relay_Master_Log_File]
include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
# Cleanup
# Reset master_delay
include/stop_slave.inc
CHANGE MASTER TO master_delay=0;
set @@GLOBAL.slave_parallel_threads=4;
SET @@global.debug_dbug="";
SET DEBUG_SYNC='RESET';
include/start_slave.inc
#
# MDEV-30619: Parallel Slave SQL Thread Can Update Seconds_Behind_Master with Active Workers
#
connection slave;
# Ensure the replica is fully idle before starting transactions
# Lock t1 on slave so the first received transaction does not complete/commit
LOCK TABLES t1 WRITE;
connection master;
DROP TABLE t1;
insert into t1 values (3);
include/save_master_gtid.inc
connection slave;
# Waiting for first transaction to begin..
connection master;
# Sleep 2 sec to create a gap between events
INSERT INTO t2 VALUES (1);
include/save_master_gtid.inc
connection slave;
# Waiting for second transaction to begin..
connection slave;
UNLOCK TABLES;
include/sync_with_master_gtid.inc
#
# Cleanup
connection master;
DROP TABLE t1, t2;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/stop_slave.inc
set @@GLOBAL.debug_dbug= "";
set @@GLOBAL.slave_parallel_mode= "$save_parallel_mode";
include/start_slave.inc
include/rpl_end.inc
# End of rpl_delayed_parallel_slave_sbm.test
# End of rpl_parallel_sbm.test

View File

@@ -47,11 +47,21 @@ Warnings:
Note 1255 Slave already has been stopped
RESET MASTER;
SET @@global.gtid_slave_pos="";
SET @@global.gtid_strict_mode=1;
connection master;
RESET MASTER;
CREATE TABLE ti (a INT) ENGINE=innodb;
CREATE SEQUENCE s2 ENGINE=innodb;
include/save_master_gtid.inc
connection slave;
include/start_slave.inc
include/sync_with_master_gtid.inc
include/stop_slave.inc
include/rpl_restart_server.inc [server_number=2]
SET @@global.slave_parallel_threads=2;
SET @@global.slave_parallel_mode=optimistic;
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
SET @@global.gtid_strict_mode=1;
connection master;
SET @@gtid_seq_no=100;
ALTER SEQUENCE s2 restart with 1;
INSERT INTO ti SET a=1;
@@ -60,6 +70,7 @@ SELECT @@global.gtid_binlog_state "Master gtid state";
Master gtid state
0-1-101
connection slave;
SET STATEMENT sql_log_bin=0 FOR FLUSH TABLES;
include/start_slave.inc
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both";
@@global.gtid_binlog_state no 100,101 yet in both

View File

@@ -139,6 +139,26 @@ insert into t1 values(1006);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
insert into t2 values(2006);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
#
# MDEV-30978: On slave XA COMMIT/XA ROLLBACK fail to return an error in read-only mode
#
# Where a read-only server permits writes through replication, it
# should not permit user connections to commit/rollback XA transactions
# prepared via replication. This test ensure this behavior is prohibited
#
connection master;
xa start '1';
insert into t1 values (1007);
xa end '1';
xa prepare '1';
connection slave;
connection slave2;
xa commit '1';
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
xa rollback '1';
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
connection master;
xa rollback '1';
connection master;
drop user test;
drop table t1;

View File

@@ -1,5 +1,6 @@
connect master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connect slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK;
SET GLOBAL gtid_slave_pos= "";
connection slave;
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
start slave;

View File

@@ -3,7 +3,7 @@ include/master-slave.inc
connection slave;
include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde";
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
include/start_slave.inc
# Future events must be logged at least 2 seconds after
# the slave starts
@@ -34,8 +34,31 @@ SET @@global.debug_dbug="-d,pause_sql_thread_on_fde";
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
# Wait for SQL thread to continue into normal execution
SET DEBUG_SYNC='RESET';
#
# MDEV-29639
# When receiving an event after the SQL Thread idles,
# Seconds_Behind_Master should not update before it updates
# last_master_timestamp
connection slave;
include/stop_slave.inc
set @@global.debug_dbug="+d,pause_sql_thread_on_next_event";
include/start_slave.inc
connection master;
insert into t1 values(2);
include/save_master_gtid.inc
connection slave;
set debug_sync='now wait_for paused_on_event';
connection master;
# Sleeping 1s to create a visible SBM gap between events
insert into t1 values(3);
include/save_master_gtid.inc
connection slave;
set debug_sync='now wait_for paused_on_event';
include/stop_slave.inc
set debug_sync='RESET';
SET @@global.debug_dbug=$save_dbug;
include/start_slave.inc
include/sync_with_master_gtid.inc
connection master;
DROP TABLE t1;
connection slave;
SET @@global.debug_dbug=$save_dbug;
include/rpl_end.inc

View File

@@ -0,0 +1,93 @@
--source include/master-slave.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_binlog_format_row.inc
--echo # MDEV-31448 OOO finish event group by killed worker
# The test demonstrates how a killed worker access gco lists
# in finish_event_group() out-of-order to fire
# DBUG_ASSERT(!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id);
# in the buggy version.
--echo # Initialize test data
--connection master
call mtr.add_suppression("Slave: Connection was killed");
call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit on which this one depends");
create table t1 (a int) engine=innodb;
create table t2 (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
--let $save_slave_parallel_threads= `SELECT @@global.slave_parallel_threads`
--let $save_slave_parallel_mode= `SELECT @@global.slave_parallel_mode`
--let $save_innodb_lock_wait_timeout= `SELECT @@global.innodb_lock_wait_timeout`
--let $save_transaction_retries= `SELECT @@global.slave_transaction_retries`
set @@global.slave_parallel_threads= 4;
set @@global.slave_parallel_mode= OPTIMISTIC;
set @@global.innodb_lock_wait_timeout= 30;
set @@global.slave_transaction_retries= 0;
--connection slave1
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;
# T2
set statement skip_parallel_replication=1 for insert into t2 values (1);
# GCO 2
# T3
drop table t2;
--connection slave
--source include/start_slave.inc
--echo # wait for T1
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--echo # wait for T2
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--let $t2_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker'`
--echo # wait for T3
--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
--replace_result $t2_tid T2_TID
--eval kill $t2_tid
--sleep 1
--connection slave1
# Release the blocked T1
ROLLBACK;
--connection master
DROP TABLE t1;
--source include/save_master_gtid.inc
--connection slave
--echo #
--echo # Cleanup
--source include/stop_slave.inc
eval set @@global.slave_parallel_threads= $save_slave_parallel_threads;
eval set @@global.slave_parallel_mode= $save_slave_parallel_mode;
eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout;
eval set @@global.slave_transaction_retries= $save_transaction_retries;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--source include/rpl_end.inc

View File

@@ -34,7 +34,9 @@ begin
end//
delimiter ;//
--disable_ps2_protocol
select multi_part_pk_with_autoinc (3);
--enable_ps2_protocol
--echo *** autoincrement field is not the first in PK warning must be there: ***
show warnings;

View File

@@ -58,7 +58,9 @@ SET @old_debug= @@global.debug_dbug;
-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data
-- let $MYSQLD_DATADIR= `select @@datadir`
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--disable_ps2_protocol
-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file'
--enable_ps2_protocol
### ACTION: create a small file (< 4096 bytes) that will be later used
### in LOAD DATA INFILE to check for absence of binlog errors
@@ -67,7 +69,9 @@ SET @old_debug= @@global.debug_dbug;
-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data
-- let $MYSQLD_DATADIR= `select @@datadir`
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--disable_ps2_protocol
-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2'
--enable_ps2_protocol
RESET MASTER;

View File

@@ -1 +0,0 @@
--slave-parallel-threads=4

View File

@@ -11,8 +11,10 @@ create database mysqltest1;
create table mysqltest1.t1 (n int);
insert into mysqltest1.t1 values (1);
--enable_prepare_warnings
--disable_ps2_protocol
select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
--disable_prepare_warnings
--enable_ps2_protocol
create table mysqltest1.t2 (n int);
create table mysqltest1.t3 (n int);
--replace_result \\ / 66 39 93 39 17 39 247 39 41 39 "File exists" "Directory not empty"

View File

@@ -211,6 +211,7 @@ SELECT * FROM t1;
--echo *** Test @@LAST_GTID and MASTER_GTID_WAIT() ***
--disable_ps2_protocol
--connection server_1
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
@@ -396,7 +397,7 @@ INSERT INTO t1 VALUES (7);
reap;
--connection s7
reap;
--enable_ps2_protocol
--echo *** Test gtid_slave_pos when used with GTID ***
@@ -564,6 +565,50 @@ SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
--echo *** MDEV-31723: Crash on SET SESSION gtid_seq_no= DEFAULT
--connection server_1
# Setting gtid_seq_no forces the GTID logged, but only once.
SET SESSION gtid_seq_no= 2000;
SELECT @@SESSION.gtid_seq_no;
INSERT INTO t1 VALUES (40);
SELECT @@SESSION.gtid_seq_no;
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
INSERT INTO t1 VALUES (41);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
# Setting to 0 has no effect.
SET SESSION gtid_seq_no= 2010;
INSERT INTO t1 VALUES (42);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
SET @old_strict= @@GLOBAL.gtid_strict_mode;
SET GLOBAL gtid_strict_mode= 1;
SET SESSION gtid_seq_no= 0;
INSERT INTO t1 VALUES (43);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
SET GLOBAL gtid_strict_mode= @old_strict;
INSERT INTO t1 VALUES (44);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
# Setting gtid_seq_no multiple times.
SET SESSION gtid_seq_no= 2020;
SET SESSION gtid_seq_no= 2030;
INSERT INTO t1 VALUES (45);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
# Setting to DEFAULT or 0 disables prior setting.
SET SESSION gtid_seq_no= 2040;
SET SESSION gtid_seq_no= DEFAULT;
INSERT INTO t1 VALUES (46);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
INSERT INTO t1 VALUES (47);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
SET SESSION gtid_seq_no= 2050;
SET SESSION gtid_seq_no= 0;
INSERT INTO t1 VALUES (48);
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos;
# Clean up.
--connection server_1
DROP TABLE t1;

View File

@@ -345,9 +345,9 @@ SELECT * from t1 WHERE a > 10 ORDER BY a;
eval SELECT IF(INSTR(@@gtid_binlog_pos, '$saved_gtid'), "Binlog pos ok", CONCAT("Unexpected binlog pos: ", @@gtid_binlog_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
--enable_query_log
--echo # Wait 30 seconds for SQL thread to catch up with IO thread
--echo # Wait 60 seconds for SQL thread to catch up with IO thread
--connection server_2
--let $wait_timeout= 300
--let $wait_timeout= 600
while ($wait_timeout != 0)
{
--let $read_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
@@ -442,9 +442,9 @@ eval SELECT IF(INSTR(@@gtid_binlog_pos, '$saved_gtid'), "Binlog pos ok", CONCAT(
eval SELECT IF(INSTR(@@gtid_current_pos, '$saved_gtid'), "Current pos ok", CONCAT("Unexpected current pos: ", @@gtid_current_pos, "; does not contain the GTID $saved_gtid.")) AS gtid_check;
--enable_query_log
--echo # Wait 30 seconds for SQL thread to catch up with IO thread
--echo # Wait 60 seconds for SQL thread to catch up with IO thread
--connection server_2
--let $wait_timeout= 300
--let $wait_timeout= 600
while ($wait_timeout != 0)
{
--let $read_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
@@ -533,9 +533,9 @@ EOF
--source include/wait_until_connected_again.inc
--connection server_2
--echo # Wait 30 seconds for IO thread to connect and SQL thread to catch up
--echo # Wait 60 seconds for IO thread to connect and SQL thread to catch up
--echo # with IO thread.
--let $wait_timeout= 300
--let $wait_timeout= 600
while ($wait_timeout != 0)
{
--let $connected=`SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE State = 'Waiting for master to send event'`

View File

@@ -27,7 +27,9 @@ set SQL_LOG_BIN=1;
enable_query_log;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_ps2_protocol
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
--enable_ps2_protocol
#This will generate a 20KB file, now test LOAD DATA LOCAL
truncate table t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
@@ -50,7 +52,9 @@ connection master;
create table t1(a int);
insert into t1 values (1), (2), (2), (3);
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_ps2_protocol
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
--enable_ps2_protocol
drop table t1;
create table t1(a int primary key);
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
@@ -79,7 +83,9 @@ SET sql_mode='ignore_space';
CREATE TABLE t1(a int);
insert into t1 values (1), (2), (3), (4);
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_ps2_protocol
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
--enable_ps2_protocol
truncate table t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
@@ -111,7 +117,9 @@ CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2), (3), (4);
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_ps2_protocol
eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1;
--enable_ps2_protocol
TRUNCATE TABLE t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
@@ -159,7 +167,9 @@ sync_slave_with_master;
connection master;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_ps2_protocol
eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug59267.sql' FROM t1;
--enable_ps2_protocol
TRUNCATE TABLE t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
@@ -204,7 +214,9 @@ CREATE VIEW v1 AS SELECT * FROM t2
WHERE f1 IN (SELECT f1 FROM t3 WHERE (t3.f2 IS NULL));
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_ps2_protocol
eval SELECT 1 INTO OUTFILE '$MYSQLD_DATADIR/bug60580.csv' FROM DUAL;
--enable_ps2_protocol
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug60580.csv' INTO TABLE t1 (@f1) SET f2 = (SELECT f1 FROM v1 WHERE f1=@f1);

View File

@@ -37,7 +37,9 @@ while($rows)
eval insert into t1 values (null);
dec $rows;
}
--disable_ps2_protocol
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' from t1;
--enable_ps2_protocol
DROP TABLE t1;
SET @@sql_log_bin= 1;

View File

@@ -69,7 +69,9 @@ connection master;
let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--disable_ps2_protocol
--eval SELECT repeat('x',20) INTO OUTFILE '$file'
--enable_ps2_protocol
disable_warnings;
DROP TABLE IF EXISTS t1;

View File

@@ -62,7 +62,7 @@ connection slave;
--let $slave_io_errno= 1236
--let $show_slave_io_error= 1
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /the first event '(\.|master-bin.000001)'/the first event 'FILE'/
--source include/wait_for_slave_io_error.inc
connection master;

View File

@@ -26,7 +26,9 @@ insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
--disable_warnings
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
--enable_warnings
--disable_ps2_protocol
select * into outfile 'rpl_misc_functions.outfile' from t1;
--enable_ps2_protocol
let $MYSQLD_DATADIR= `select @@datadir`;
sync_slave_with_master;
create temporary table t2 like t1;
@@ -91,8 +93,10 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf());
--enable_prepare_warnings
# Dump table on slave
--disable_ps2_protocol
select * from t1 into outfile "../../tmp/t1_slave.txt";
--disable_prepare_warnings
--enable_ps2_protocol
# Load data from slave into temp table on master
connection master;

View File

@@ -75,7 +75,9 @@ END $$
--delimiter ;
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
--disable_ps2_protocol
SELECT log_rows(2,1), log_rows(2,2);
--enable_ps2_protocol
CREATE TABLE t2 (a INT, b INT);

View File

@@ -4,6 +4,8 @@
###################################################################################
--source include/have_binlog_format_mixed.inc
--source include/have_innodb.inc
# MDEV-31790 FIXME: This test is extremely slow
--source include/not_msan.inc
--source include/master-slave.inc
let $engine_type=Innodb;

View File

@@ -4,6 +4,8 @@
###################################################################################
--source include/have_binlog_format_mixed.inc
--source include/have_innodb.inc
# MDEV-31790 FIXME: This test is extremely slow
--source include/not_msan.inc
--source include/master-slave.inc
--disable_query_log

View File

@@ -4,6 +4,8 @@
###################################################################################
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
# MDEV-31790 FIXME: This test is extremely slow
--source include/not_msan.inc
--source include/master-slave.inc
--disable_query_log

View File

@@ -4,6 +4,8 @@
###################################################################################
--source include/have_binlog_format_statement.inc
--source include/have_innodb.inc
# MDEV-31790 FIXME: This test is extremely slow
--source include/not_msan.inc
--source include/master-slave.inc
--disable_query_log

View File

@@ -0,0 +1,143 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--connection slave
--source include/stop_slave.inc
SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=3;
SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode=aggressive;
SET @old_dbug= @@GLOBAL.debug_dbug;
CHANGE MASTER TO master_use_gtid=slave_pos;
--source include/start_slave.inc
--echo *** MDEV-31509: Lost data with FTWRL and STOP SLAVE
# The bug was as follows:
# 1. Event groups T1 and T2 are queued but not started yet.
# 2. FLUSH TABLE WITH READ LOCKS starts, sets rpl_parallel_entry::pause_sub_id
# 3. T2 Sees pause_sub_id, goes to wait for the pause to complete.
# 4. FTWRL completes, UNLOCK TABLES is run.
# 5. STOP SLAVE is run, sets rpl_parallel_entry::stop_sub_id.
# 6. T2 wakes up after FTWRL pause, only now sets
# rpl_parallel_entry::largest_started_sub_id. This is the bug,
# largest_started_sub_id is set too late here.
# 7. T1 starts, it sees stop_sub_id<T1, so T1 is skipped due to STOP SLAVE.
# 8. T2 continues, its check for stop_sub_id was before STOP SLAVE. So T2 is
# wrongly applied, silently losing transaction T1.
--connection master
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (0,0);
INSERT INTO t2 VALUES (0,0);
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--connection slave
--echo *** Arrange for T1 to delay before entering GCO wait.
SET GLOBAL debug_dbug="+d,gco_wait_delay_gtid_0_x_99";
--echo *** Arrange for T2 to wait for FTWRL to start.
SET GLOBAL debug_dbug="+d,hold_worker_on_schedule";
--echo *** Arrange for T2 to delay wakeup from FTWRL pause.
SET GLOBAL debug_dbug="+d,delay_ftwrl_wait_gtid_0_x_100";
--connection master
--echo *** Event group T1
SET SESSION gtid_seq_no=99;
INSERT INTO t1 VALUES (1,1);
--connection slave
--echo *** 1a. Wait for T1 to be queued.
SET debug_sync="now WAIT_FOR gco_wait_paused";
--connection master
--echo *** Event group T2
SET SESSION gtid_seq_no=100;
INSERT INTO t2 VALUES (2,2);
--connection slave
--echo *** 1b. Wait for T2 to be queued.
SET debug_sync= "now WAIT_FOR reached_pause";
--connection slave1
--echo *** 2. Run FTWRL
SET GLOBAL debug_dbug= "+d,pause_for_ftwrl_wait";
send FLUSH TABLES WITH READ LOCK;
--connection slave
SET debug_sync= "now WAIT_FOR pause_ftwrl_waiting";
--echo *** 3. Wait for T2 to be waiting for FTWRL pause
SET debug_sync= "now SIGNAL continue_worker";
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "%Waiting due to global read lock%" and command="Slave_worker";
--source include/wait_condition.inc
--echo *** 4. FTWRL completes, UNLOCK TABLES.
SET debug_sync="now SIGNAL pause_ftwrl_cont";
--connection slave1
reap;
UNLOCK TABLES;
--connection slave
--echo *** T2 is now ready to proceed after FTWRL pause, but did not wake up yet.
SET debug_sync="now WAIT_FOR pause_wait_started";
--echo *** 5. STOP SLAVE is run.
--connection slave1
SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger";
send STOP SLAVE;
--connection slave
SET debug_sync="now WAIT_FOR wait_for_done_waiting";
--echo *** 5. T2 wakes up after FTWRL pause, reaches wait_for_prior_commit().
SET debug_sync="now SIGNAL pause_wait_continue";
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "%Waiting for prior transaction to commit%" and command="Slave_worker";
--source include/wait_condition.inc
--echo *** 6. T1 starts.
SET debug_sync="now SIGNAL gco_wait_cont";
--connection slave1
reap;
--connection slave
--source include/wait_for_slave_to_stop.inc
--connection master
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--source include/save_master_gtid.inc
--connection slave
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
# The bug here was that T2 was errorneously replicated while T1 was
# being skipped due to STOP SLAVE. So the @@gtid_slave_pos was at T2,
# but we were missing the data from T1.
SELECT @@GLOBAL.gtid_slave_pos;
SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--echo *** Clean up.
--connection slave
--source include/stop_slave.inc
SET DEBUG_SYNC= "RESET";
SET GLOBAL slave_parallel_threads= @old_parallel_threads;
SET GLOBAL slave_parallel_mode= @old_parallel_mode;
SET GLOBAL debug_dbug=@old_dbug;
--source include/start_slave.inc
--connection master
DROP TABLE t1, t2;
--source include/rpl_end.inc

View File

@@ -0,0 +1,15 @@
--source include/master-slave.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_binlog_format_row.inc
--source include/mdev-31448_conservative.inc
--let $killed_trx_commits=1
--source include/mdev-31448_optimistic.inc
--let $killed_trx_commits=0
--source include/mdev-31448_optimistic.inc
--source include/rpl_end.inc

View File

@@ -0,0 +1 @@
--slave-parallel-threads=2

View File

@@ -1,4 +1,14 @@
#
# Ensure that Seconds_Behind_Master works correctly on the parallel replica.
#
--source include/master-slave.inc
--source include/have_log_bin.inc
--source include/have_debug.inc
--echo #
--echo # MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel Replicas
--echo #
# This test ensures that after a delayed parallel slave has idled, i.e.
# executed everything in its relay log, the next event group that the SQL
# thread reads from the relay log will immediately be used in the
@@ -6,26 +16,21 @@
# Seconds_Behind_Master is based on the timestamp of the new transaction,
# rather than the last committed transaction.
#
# References:
# MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel
# Replicas
#
--source include/master-slave.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--connection slave
--source include/stop_slave.inc
--let $old_debug_dbug= `SELECT @@global.debug_dbug`
--let $save_dbug= `SELECT @@GLOBAL.debug_dbug`
--let $save_parallel_mode= `SELECT @@GLOBAL.slave_parallel_mode`
set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master";
set @@GLOBAL.slave_parallel_mode= CONSERVATIVE;
--let $master_delay= 3
--eval change master to master_delay=$master_delay, master_use_gtid=Slave_Pos
--let $old_slave_threads= `SELECT @@GLOBAL.slave_parallel_threads`
set @@GLOBAL.slave_parallel_threads=2;
--source include/start_slave.inc
--connection master
--let insert_ctr= 0
create table t1 (a int);
create table t2 (a int);
--source include/sync_slave_sql_with_master.inc
--echo #
@@ -40,7 +45,6 @@ LOCK TABLES t1 WRITE;
sleep 2;
--let $ts_trx_before_ins= `SELECT UNIX_TIMESTAMP()`
--let insert_ctr= 0
--eval insert into t1 values ($insert_ctr)
--inc $insert_ctr
--source include/save_master_gtid.inc
@@ -66,15 +70,13 @@ UNLOCK TABLES;
--source include/sync_with_master_gtid.inc
--echo #
--echo # Pt 2) If the SQL thread has not entered an idle state, ensure
--echo # Pt 2) If the worker threads have not entered an idle state, ensure
--echo # following events do not update SBM
--echo # Stop slave IO thread so it receives both events together on restart
--connection slave
--source include/stop_slave_io.inc
LOCK TABLES t1 WRITE;
--connection master
--echo # Sleep 2 to allow a buffer between events for SBM check
sleep 2;
--let $ts_trxpt2_before_ins= `SELECT UNIX_TIMESTAMP()`
@@ -88,29 +90,14 @@ sleep 3;
--source include/save_master_pos.inc
--connection slave
LOCK TABLES t1 WRITE;
SET @@global.debug_dbug="+d,pause_sql_thread_on_next_event";
START SLAVE IO_THREAD;
--echo # Before we start processing the events, we ensure both transactions
--echo # were written into the relay log. Otherwise, if the IO thread takes too
--echo # long to queue the events, the sql thread can think it has caught up
--echo # too quickly.
SET DEBUG_SYNC='now WAIT_FOR paused_on_event';
--source include/sync_io_with_master.inc
SET @@global.debug_dbug="-d,pause_sql_thread_on_next_event";
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
--echo # Wait for first transaction to complete SQL delay and begin execution..
--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock%' AND command LIKE 'Slave_Worker';
--source include/wait_condition.inc
--echo # Validate SBM calculation doesn't use the second transaction because SQL thread shouldn't have gone idle..
--echo # Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle..
--let $sbm_after_trx_no_idle= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1)
--let $timestamp_trxpt2_arrive= `SELECT UNIX_TIMESTAMP()`
if (`SELECT $sbm_after_trx_no_idle < $timestamp_trxpt2_arrive - $ts_trx_after_ins`)
if (`SELECT $sbm_after_trx_no_idle < $timestamp_trxpt2_arrive - $ts_trx_after_ins - 1`)
{
--let $cmpv= `SELECT $timestamp_trxpt2_arrive - $ts_trx_after_ins`
--echo # SBM $sbm_after_trx_no_idle was more recent than time since last transaction ($cmpv seconds)
@@ -127,24 +114,86 @@ if (`SELECT $sbm_after_trx_no_idle > ($seconds_since_idling + 1)`)
--connection slave
UNLOCK TABLES;
--source include/sync_with_master.inc
--echo # Cleanup
--source include/stop_slave.inc
--eval CHANGE MASTER TO master_delay=0
--source include/start_slave.inc
--echo #
--echo # MDEV-30619: Parallel Slave SQL Thread Can Update Seconds_Behind_Master with Active Workers
--echo #
# This test ensures that a parallel slave will not update
# Seconds_Behind_Master after the SQL Thread has idled if the worker threads
# are still executing events. To test this, two events are executed on the
# primary with $sleep seconds in-between them. Once the second event begins
# execution on the replica, Seconds_Behind_Master is queried to ensure it
# reflects the value of the first transaction, rather than the second.
--connection slave
--echo # Ensure the replica is fully idle before starting transactions
--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Slave has read all relay log%';
--source include/wait_condition.inc
--let $wait_condition= SELECT count(*)=2 FROM information_schema.processlist WHERE state LIKE 'Waiting for work from SQL thread';
--source include/wait_condition.inc
--echo # Lock t1 on slave so the first received transaction does not complete/commit
LOCK TABLES t1 WRITE;
--connection master
--let $ts_t1_before_master_ins= `SELECT UNIX_TIMESTAMP()`
--eval insert into t1 values ($insert_ctr)
--inc $insert_ctr
--source include/save_master_gtid.inc
--connection slave
--echo # Waiting for first transaction to begin..
--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock';
--source include/wait_condition.inc
--let $sbm_1= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1)
--connection master
--let $sleep = 2
--echo # Sleep $sleep sec to create a gap between events
sleep $sleep;
INSERT INTO t2 VALUES (1);
--source include/save_master_gtid.inc
--connection slave
--echo # Waiting for second transaction to begin..
--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to start commit%';
--source include/wait_condition.inc
--let $sbm_2= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1)
if (`SELECT $sbm_1 + $sleep > $sbm_2`)
{
--echo # Seconds_Behind_Masters: $sbm_1 $sbm_2_0
--die Two successive Seconds_Behind_Master timestamps must be separated by the sleep parameter value or greater
}
--connection slave
UNLOCK TABLES;
--source include/sync_with_master_gtid.inc
--echo #
--echo # Cleanup
--echo # Reset master_delay
--source include/stop_slave.inc
--eval CHANGE MASTER TO master_delay=0
--eval set @@GLOBAL.slave_parallel_threads=$old_slave_threads
--eval SET @@global.debug_dbug="$old_debug_dbug"
SET DEBUG_SYNC='RESET';
--source include/start_slave.inc
--connection master
DROP TABLE t1;
DROP TABLE t1, t2;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
--eval set @@GLOBAL.debug_dbug= "$save_dbug"
--evalp set @@GLOBAL.slave_parallel_mode= "$save_parallel_mode"
--source include/start_slave.inc
--source include/rpl_end.inc
--echo # End of rpl_delayed_parallel_slave_sbm.test
--echo # End of rpl_parallel_sbm.test

View File

@@ -16,7 +16,9 @@ SET @@session.binlog_row_image=FULL;
SET @@session.debug_dbug="+d,binlog_force_commit_id";
SET @commit_id=7;
SET @@gtid_seq_no=100;
--disable_ps2_protocol
SELECT NEXT VALUE FOR s1;
--enable_ps2_protocol
INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0);
SET @@session.debug_dbug="";
@@ -77,15 +79,28 @@ SET DEBUG_SYNC = 'now SIGNAL continue_worker';
--source include/stop_slave.inc
RESET MASTER;
SET @@global.gtid_slave_pos="";
--let $slave_gtid_strict_mode=`select @@global.gtid_strict_mode`
SET @@global.gtid_strict_mode=1;
--connection master
RESET MASTER;
# Load from master
CREATE TABLE ti (a INT) ENGINE=innodb;
CREATE SEQUENCE s2 ENGINE=innodb;
--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 $rpl_server_number= 2
--source include/rpl_restart_server.inc
# upon restart
SET @@global.slave_parallel_threads=2;
SET @@global.slave_parallel_mode=optimistic;
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
--let $slave_gtid_strict_mode=`select @@global.gtid_strict_mode`
SET @@global.gtid_strict_mode=1;
--connection master
SET @@gtid_seq_no=100;
ALTER SEQUENCE s2 restart with 1;
INSERT INTO ti SET a=1;
@@ -93,6 +108,10 @@ INSERT INTO ti SET a=1;
SELECT @@global.gtid_binlog_state "Master gtid state";
--connection slave
# The following FT complicates the opening table time with committing
# an internal transaction. The rest of the test also proves
# MDEV-31503 "branch" of the OOO error is fixed.
SET STATEMENT sql_log_bin=0 FOR FLUSH TABLES;
--source include/start_slave.inc
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit"

View File

@@ -117,6 +117,33 @@ insert into t1 values(1006);
--error ER_OPTION_PREVENTS_STATEMENT
insert into t2 values(2006);
--echo #
--echo # MDEV-30978: On slave XA COMMIT/XA ROLLBACK fail to return an error in read-only mode
--echo #
--echo # Where a read-only server permits writes through replication, it
--echo # should not permit user connections to commit/rollback XA transactions
--echo # prepared via replication. This test ensure this behavior is prohibited
--echo #
# Note: slave's read_only=1 is set prior to this test case
connection master;
xa start '1';
insert into t1 values (1007);
xa end '1';
xa prepare '1';
sync_slave_with_master;
connection slave2;
--error ER_OPTION_PREVENTS_STATEMENT
xa commit '1';
--error ER_OPTION_PREVENTS_STATEMENT
xa rollback '1';
connection master;
xa rollback '1';
## Cleanup
connection master;
drop user test;

View File

@@ -20,6 +20,9 @@
connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
# Reset the GTID position explicitly (since we're not using rpl_init.inc).
SET GLOBAL gtid_slave_pos= "";
# Create empty file
let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
write_file $MYSQLD_SLAVE_DATADIR/master.info;

View File

@@ -33,8 +33,10 @@ return 0;
end//
delimiter ;//
--disable_ps2_protocol
select test.f1(1);
select test.f1(2);
--enable_ps2_protocol
select * from test.t1;
save_master_pos;

View File

@@ -4,6 +4,8 @@
###################################################################################
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
# MDEV-31790 FIXME: This test is extremely slow
--source include/not_msan.inc
--source include/master-slave.inc
let $engine_type=Innodb;

View File

@@ -27,7 +27,7 @@
--connection slave
--source include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde";
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
--source include/start_slave.inc
--let $sleep_time=2
@@ -93,11 +93,93 @@ SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
# Reset last sql_thread_continue signal
SET DEBUG_SYNC='RESET';
--echo #
--echo # MDEV-29639
--echo # When receiving an event after the SQL Thread idles,
--echo # Seconds_Behind_Master should not update before it updates
--echo # last_master_timestamp
--connection slave
--source include/stop_slave.inc
set @@global.debug_dbug="+d,pause_sql_thread_on_next_event";
--source include/start_slave.inc
--connection master
insert into t1 values(2);
--source include/save_master_gtid.inc
# Each event after starting will trigger a pause, so continually send signal
# sql_thread_continue until caught up
--connection slave
--let $caught_up=0
--let $tries= 0
set debug_sync='now wait_for paused_on_event';
--disable_query_log
while (!$caught_up)
{
set debug_sync='now signal sql_thread_continue';
--let $slave_gtid= `SELECT @@global.gtid_slave_pos`
if (`SELECT strcmp("$master_pos","$slave_gtid") = 0`)
{
--inc $caught_up
}
--inc $tries
# Wait 30s
if (`SELECT $tries > 300`)
{
--die Replica failed to sync with primary
}
sleep 0.1;
}
--enable_query_log
--connection master
--echo # Sleeping 1s to create a visible SBM gap between events
sleep 1;
insert into t1 values(3);
--source include/save_master_gtid.inc
--connection slave
set debug_sync='now wait_for paused_on_event';
--let $sbm= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1)
if ($sbm)
{
--echo # Expected Seconds_Behind_Master to be 0 but was $sbm
--die Seconds_Behind_Master should not show updates before last_master_timestamp is updated
}
# Continually send signal sql_thread_continue until caught up
--let $caught_up=0
--let $tries= 0
--disable_query_log
while (!$caught_up)
{
set debug_sync='now signal sql_thread_continue';
--let $slave_gtid= `SELECT @@global.gtid_slave_pos`
if (`SELECT strcmp("$master_pos","$slave_gtid") = 0`)
{
--inc $caught_up
}
--inc $tries
# Wait 30s
if (`SELECT $tries > 300`)
{
--die Replica failed to sync with primary
}
sleep 0.1;
}
--enable_query_log
# Cleanup
--source include/stop_slave.inc
set debug_sync='RESET';
SET @@global.debug_dbug=$save_dbug;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--connection master
DROP TABLE t1;
--connection slave
SET @@global.debug_dbug=$save_dbug;
--source include/rpl_end.inc

View File

@@ -49,6 +49,7 @@ TRUNCATE mysql.slow_log;
source include/start_slave.inc;
--disable_ps2_protocol
connection master;
CREATE TABLE t1 (a int, b int);
@@ -341,3 +342,4 @@ DROP TABLE t1;
SET @@global.log_output= @old_log_output;
SET @@global.long_query_time= @old_long_query_time;
--source include/rpl_end.inc
--enable_ps2_protocol

View File

@@ -195,7 +195,9 @@ end|
delimiter ;|
delete t1,t2 from t1,t2;
--disable_ps2_protocol
select fn1(20);
--enable_ps2_protocol
insert into t2 values(fn1(21));
--sorted_result
select * from t1;

View File

@@ -91,7 +91,9 @@ SELECT * FROM t1 ORDER BY a;
create table t2(a int);
insert into t2 values (10),(11);
--disable_ps2_protocol
SELECT a,f1(a) FROM t2 ORDER BY a;
--enable_ps2_protocol
# This shouldn't put separate 'call f1(3)' into binlog:
insert into t2 select f1(3);
@@ -110,7 +112,9 @@ delete from t2;
delete from t1;
insert into t2 values(1),(2);
create view v1 as select f1(a) as f from t2;
--disable_ps2_protocol
select * from v1 order by f;
--enable_ps2_protocol
SELECT 'master:',a FROM t1 ORDER BY a;
sync_slave_with_master;
@@ -192,7 +196,9 @@ delimiter ;//
set @x=10;
set @y=20;
set @z=100;
--disable_ps2_protocol
select f1();
--enable_ps2_protocol
set @x=30;
call p1();
@@ -238,10 +244,12 @@ DELIMITER ;//
call sp_bug26199(b'1110');
call sp_bug26199('\0');
--disable_ps2_protocol
select sf_bug26199(b'1111111');
SET STATEMENT sql_mode = '' FOR
select sf_bug26199(b'101111111');
select sf_bug26199('\'');
--enable_ps2_protocol
select hex(b) from t2;
sync_slave_with_master;

View File

@@ -35,14 +35,18 @@ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
# Instead of
# INSERT INTO logtbl VALUES(1, 1, FOUND_ROWS());
# we write
--disable_ps2_protocol
SELECT FOUND_ROWS() INTO @a;
--enable_ps2_protocol
INSERT INTO logtbl VALUES(1,1,@a);
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
# Instead of
# INSERT INTO logtbl VALUES(1, 2, FOUND_ROWS());
# we write
--disable_ps2_protocol
SELECT FOUND_ROWS() INTO @a;
--enable_ps2_protocol
INSERT INTO logtbl VALUES(1,2,@a);
SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
@@ -78,7 +82,9 @@ END $$
--delimiter ;
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
--disable_ps2_protocol
SELECT FOUND_ROWS() INTO @found_rows;
--enable_ps2_protocol
CALL just_log(2,3,@found_rows);
SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
@@ -98,8 +104,10 @@ END $$
--delimiter ;
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
--disable_ps2_protocol
SELECT FOUND_ROWS() INTO @found_rows;
SELECT log_rows(3,1,@found_rows), log_rows(3,2,@found_rows);
--enable_ps2_protocol
SELECT * FROM logtbl WHERE sect = 3 ORDER BY sect,test;
sync_slave_with_master;

View File

@@ -4,6 +4,8 @@
###################################################################################
--source include/have_binlog_format_statement.inc
--source include/have_innodb.inc
# MDEV-31790 FIXME: This test is extremely slow
--source include/not_msan.inc
--source include/master-slave.inc
let $engine_type=Innodb;

View File

@@ -238,7 +238,9 @@ begin
return 100;
end|
delimiter ;|
--disable_ps2_protocol
select foo4();
--enable_ps2_protocol
prepare stmt1 from 'select foo4()';
execute stmt1;
@@ -253,7 +255,9 @@ begin
return 100;
end|
delimiter ;|
--disable_ps2_protocol
select foo5();
--enable_ps2_protocol
prepare stmt1 from 'select foo5()';
execute stmt1;
@@ -268,8 +272,10 @@ begin
return 100;
end|
delimiter ;|
--disable_ps2_protocol
select foo6("foo6_1_");
select foo6(concat("foo6_2_",SYS_GUID()));
--enable_ps2_protocol
prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))';
execute stmt1;
@@ -376,7 +382,9 @@ begin
return 1;
end|
delimiter ;|
--disable_ps2_protocol
select f("try_41_");
--enable_ps2_protocol
# Two operations which compensate each other except that their net
# effect is that they advance the auto_increment counter of t2 on slave:
sync_slave_with_master;
@@ -386,7 +394,9 @@ delete from t2 where a>=2;
connection master;
# this is the call which didn't replicate well
--disable_ps2_protocol
select f("try_42_");
--enable_ps2_protocol
sync_slave_with_master;
# now use prepared statement and test again, just to see that the RBB
@@ -410,7 +420,9 @@ connection master;
create table t12 select * from t1; # save for comparing later
drop table t1;
create table t1 (a int, b varchar(100), key(a));
--disable_ps2_protocol
select f("try_45_");
--enable_ps2_protocol
# restore table's key
create table t13 select * from t1;
@@ -435,7 +447,9 @@ begin
return 1;
end|
delimiter ;|
--disable_ps2_protocol
select f1("try_46_"),f2("try_47_");
--enable_ps2_protocol
sync_slave_with_master;
insert into t2 values(2,null),(3,null),(4,null);
@@ -443,7 +457,9 @@ delete from t2 where a>=2;
connection master;
# Test with SELECT and INSERT
--disable_ps2_protocol
select f1("try_48_"),f2("try_49_");
--enable_ps2_protocol
insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
sync_slave_with_master;
@@ -460,7 +476,9 @@ begin
return y;
end|
delimiter ;|
--disable_ps2_protocol
select f1("try_53_"),f2("try_54_");
--enable_ps2_protocol
sync_slave_with_master;
# And now, a normal statement with a trigger (no stored functions)

View File

@@ -468,8 +468,9 @@ BEGIN
END|
DELIMITER ;|
--disable_ps2_protocol
SELECT func();
--enable_ps2_protocol
--echo ==== Insert variables from a trigger ====

View File

@@ -372,9 +372,11 @@ BEGIN
END|
DELIMITER ;|
--disable_ps2_protocol
--disable_warnings
SELECT func();
--enable_warnings
--enable_ps2_protocol
--echo ==== Insert variables from a trigger ====

View File

@@ -27,6 +27,7 @@ drop view if exists v1;
--echo # Syncing slave with master
--sync_slave_with_master
--disable_ps2_protocol
connect (master2,127.0.0.1,root,,test,$MASTER_MYPORT,);
connection master;
@@ -122,6 +123,7 @@ select * from t2;
--echo # So we have same result on slave.
select * from t1;
select * from t2;
--enable_ps2_protocol
connection master;
drop table t1, t2;

View File

@@ -27,7 +27,9 @@ set @@default_storage_engine="aria";
CREATE SEQUENCE s1 cache=10;
create table t1 select * from s1;
--disable_ps2_protocol
select NEXT VALUE for s1,seq from seq_1_to_20;
--enable_ps2_protocol
insert into t1 select * from s1;
do setval(s1,5, 1, 0);
insert into t1 select * from s1;