1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2024-10-03 09:31:39 +03:00
482 changed files with 4427 additions and 623 deletions

View File

@ -43,7 +43,9 @@ connection master;
eval INSERT INTO t1 VALUES(1, $source_value);
if ($can_convert) {
sync_slave_with_master;
--disable_cursor_protocol
eval SELECT a = $target_value into @compare FROM t1;
--enable_cursor_protocol
eval INSERT INTO type_conversions SET
Source = "$source_type",
Target = "$target_type",

View File

@ -5,6 +5,7 @@
# Requirements: Having @[master|slave]_[system_]rows_[read|inserted|deleted|updated] counters already created
#########################################
--disable_cursor_protocol
--connection master
select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
@ -46,3 +47,4 @@ select variable_value into @system_rows_inserted from information_schema.global_
select @system_rows_inserted - @slave_system_rows_inserted;
--connection master
--enable_cursor_protocol

View File

@ -37,9 +37,11 @@ source include/wait_for_slave_sql_to_stop.inc;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
--disable_cursor_protocol
--disable_query_log
eval SELECT $read = $exec into @check;
--enable_query_log
--enable_cursor_protocol
eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
select count(*) as one from tm;
select count(*) as one from ti;
@ -91,9 +93,11 @@ source include/wait_for_slave_sql_error.inc;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
--disable_cursor_protocol
--disable_query_log
eval SELECT $read - $exec > 0 into @check;
--enable_query_log
--enable_cursor_protocol
eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
select count(*) as one from tm;
select count(*) as zero from ti;
@ -130,9 +134,11 @@ source include/wait_for_slave_sql_error.inc;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
--disable_cursor_protocol
--disable_query_log
eval SELECT $read - $exec > 0 into @check;
--enable_query_log
--enable_cursor_protocol
eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
select max(a) as two from tm;
select max(a) as one from ti;

View File

@ -0,0 +1,82 @@
# ==== Purpose ====
#
# If using DEBUG_SYNC to coordinate a slave's SQL DELAY via the DEBUG_DBUG
# identifier "sql_delay_by_debug_sync", this helper file will help synchronize
# a slave with the master for statements which don't need to be delayed. This
# can be helpful, for example, for setup/cleanup statements, if they must be
# run in the same lifetime as the statements used for the test.
#
# The actual synchronization will take place based on the input parameter
# slave_sync_method, which can be "gtid", "file_coord", or "none"; and will use
# the helper files sync_with_master_gtid.inc or sync_with_master.inc (or none
# at all), respectively.
#
#
# ==== Requirements ====
#
# --source include/have_debug.inc
# --source include/have_debug_sync.inc
# set @@GLOBAL.debug_dbug= "+d,sql_delay_by_debug_sync";
#
#
# ==== Usage ====
#
# --let $slave_sync_method= gtid|file_coord|none
# [--let $num_event_groups= NUMBER]
# --source include/sync_with_master_sql_delay_debug_sync.inc
#
#
# Parameters:
# $slave_sync_method
# Value can be gtid, file_coord, or none; and will synchronize the slave
# with the master via this method (i.e. using sync_with_master_gtid.inc
# or sync_with_master.inc, respectively), after synchronizing the SQL
# delay
#
# $num_event_groups
# Number of event groups to synchronize the SQL delay for. If unset, will
# be default to 1.
#
--let $include_filename= sync_with_master_sql_delay_debug_sync.inc
--source include/begin_include_file.inc
if (!$slave_sync_method)
{
--die Parameter slave_sync_method must be set
}
if (`select "$slave_sync_method" not like "gtid" and "$slave_sync_method" not like "file_coord" and "$slave_sync_method" not like "none"`)
{
--die Parameter slave_sync_method must have value "gtid", "file_coord" or "none"
}
if (`select "$slave_sync_method" not like "none" and strcmp("$master_pos", "") = 0`)
{
--die sync_with_master.inc or sync_with_master_gtid.inc was not called to populate variable master_pos
}
if (!$num_event_groups)
{
--let $num_event_groups= 1
}
while ($num_event_groups)
{
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
--dec $num_event_groups
}
if (`select "$slave_sync_method" LIKE "gtid"`)
{
--source include/sync_with_master_gtid.inc
}
if (`select "$slave_sync_method" LIKE "file_coord"`)
{
--source include/sync_with_master.inc
}
--let $include_filename= sync_with_master_sql_delay_debug_sync.inc
--source include/end_include_file.inc

View File

@ -5,14 +5,20 @@ include/master-slave.inc
#
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.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync";
change master to master_delay=1, master_use_gtid=Slave_Pos;
include/start_slave.inc
connection master;
create table t1 (a int);
create table t2 (a int);
include/sync_slave_sql_with_master.inc
include/save_master_gtid.inc
connection slave;
include/sync_with_master_sql_delay_debug_sync.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
#
# Pt 1) Ensure SBM is updated immediately upon arrival of the next event
connection master;
@ -21,12 +27,23 @@ insert into t1 values (0);
include/save_master_gtid.inc
connection slave;
# Waiting for transaction to arrive on slave and begin SQL Delay..
set debug_sync= "now WAIT_FOR at_sql_delay";
# Validating SBM is updated on event arrival..
# ..done
# MDEV-32265. At time of STOP SLAVE, if the SQL Thread is currently
# delaying a transaction; then when the reciprocal START SLAVE occurs,
# if the event is still to be delayed, SBM should resume accordingly
include/stop_slave.inc
connection server_2;
# Ensure the kill from STOP SLAVE will be received before continuing the
# SQL thread
set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill";
STOP SLAVE;
connection slave;
set debug_sync= "now WAIT_FOR slave_notified_of_kill";
set debug_sync= "now SIGNAL continue_sql_thread";
connection server_2;
include/wait_for_slave_to_stop.inc
set debug_sync="RESET";
# Lock t1 on slave to ensure the event can't finish (and thereby update
# Seconds_Behind_Master) so slow running servers don't accidentally
# catch up to the master before checking SBM.
@ -34,6 +51,10 @@ connection server_2;
LOCK TABLES t1 WRITE;
include/start_slave.inc
connection slave;
# SQL delay has no impact for the rest of the test case, so ignore it
include/sync_with_master_sql_delay_debug_sync.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
# Waiting for replica to get blocked by the table lock
# Sleeping 1s to increment SBM
# Ensuring Seconds_Behind_Master increases after sleeping..
@ -54,6 +75,13 @@ insert into t1 values (2);
include/save_master_pos.inc
connection slave;
# Wait for first transaction to complete SQL delay and begin execution..
include/sync_with_master_sql_delay_debug_sync.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
# Wait for second transaction to complete SQL delay..
include/sync_with_master_sql_delay_debug_sync.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
# 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
@ -63,6 +91,8 @@ include/wait_for_slave_param.inc [Relay_Master_Log_File]
include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
# Cleanup
include/stop_slave.inc
set debug_sync= "RESET";
set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync";
CHANGE MASTER TO master_delay=0;
include/start_slave.inc
#

View File

@ -58,9 +58,11 @@ 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_cursor_protocol
--disable_ps2_protocol
-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file'
--enable_ps2_protocol
--enable_cursor_protocol
### ACTION: create a small file (< 4096 bytes) that will be later used
### in LOAD DATA INFILE to check for absence of binlog errors
@ -69,9 +71,11 @@ 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_cursor_protocol
--disable_ps2_protocol
-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2'
--enable_ps2_protocol
--enable_cursor_protocol
RESET MASTER;

View File

@ -1,6 +1,6 @@
if (`SELECT $PS_PROTOCOL != 0`)
if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`)
{
--skip Need regular protocol but ps-protocol was specified
--skip Need regular protocol but ps-protocol and cursor-protocol were specified
}
source include/have_binlog_format_mixed_or_row.inc;

View File

@ -119,7 +119,9 @@ let $1=100;
begin;
while ($1)
{
--disable_cursor_protocol
eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size;
--enable_cursor_protocol
set @data = repeat('a', @act_size);
insert into t2 set data = @data;
dec $1;
@ -162,7 +164,9 @@ let $1= 300;
begin;
while ($1)
{
--disable_cursor_protocol
eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size;
--enable_cursor_protocol
insert into t3 set data= repeat('a', @act_size);
dec $1;
}

View File

@ -343,7 +343,9 @@ SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
--connection master
DROP USER user_bug27606@localhost;
--disable_cursor_protocol
select priv into @root_priv from mysql.global_priv where user='root' and host='127.0.0.1';
--enable_cursor_protocol
update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';

View File

@ -10,11 +10,13 @@ drop database if exists mysqltest1;
create database mysqltest1;
create table mysqltest1.t1 (n int);
insert into mysqltest1.t1 values (1);
--disable_cursor_protocol
--enable_prepare_warnings
--disable_ps2_protocol
select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
--disable_prepare_warnings
--enable_ps2_protocol
--enable_cursor_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

@ -4,9 +4,9 @@
# Purpose: To test that event effects are replicated. #
##################################################################
if (`SELECT $PS_PROTOCOL != 0`)
if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`)
{
--skip Need regular protocol but ps-protocol was specified
--skip Need regular protocol but ps-protocol and cursor-protocol were specified
}
--source include/master-slave.inc

View File

@ -229,15 +229,19 @@ SET INSERT_ID=2;
SET @c=2;
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
INSERT INTO t5 VALUES (NULL, RAND(), @c); # to be ignored
--disable_cursor_protocol
SELECT b into @b FROM test.t5;
--enable_cursor_protocol
--let $b_master=`select @b`
UPDATE test.t1 SET a=2; # to run trigger on slave
--sync_slave_with_master
# The proof:
--disable_cursor_protocol
SELECT a AS 'ONE' into @a FROM test.t_slave;
SELECT c AS 'NULL' into @c FROM test.t_slave;
--enable_cursor_protocol
let $count= 1;
let $table= test.t_slave;
@ -249,7 +253,9 @@ if (`SELECT @a != 2 and @c != NULL`)
--die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context.
}
--disable_cursor_protocol
SELECT b into @b FROM test.t_slave;
--enable_cursor_protocol
--let $b_slave=`select @b`
--let $assert_text= Random values from master and slave must be different

View File

@ -67,8 +67,10 @@ EOF
# Since we injected error in the cleanup code, the rows should remain in
# mysql.gtid_slave_pos. Check that we have at least 20 (more robust against
# non-deterministic cleanup and future changes than checking for exact number).
--disable_cursor_protocol
SELECT COUNT(*), MAX(seq_no) INTO @pre_count, @pre_max_seq_no
FROM mysql.gtid_slave_pos;
--disable_cursor_protocol
SELECT IF(@pre_count >= 20, "OK", CONCAT("Error: too few rows seen while errors injected: ", @pre_count));
SET GLOBAL debug_dbug= @old_dbug;

View File

@ -1,6 +1,6 @@
if (`SELECT $PS_PROTOCOL != 0`)
if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`)
{
--skip Test temporarily disabled for ps-protocol
--skip Test temporarily disabled for ps-protocol and cursor-protocol
}
--source include/no_valgrind_without_big.inc
--let $rpl_topology=1->2

View File

@ -7,6 +7,7 @@
#
# created all the base variables at the beginning at the test
--disable_cursor_protocol
--connection master
select variable_value into @master_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
select variable_value into @master_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
@ -26,6 +27,7 @@ select variable_value into @slave_system_rows_read from information_schema.globa
select variable_value into @slave_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
select variable_value into @slave_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
select variable_value into @slave_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
--enable_cursor_protocol
--connection master
CREATE DATABASE testdb;

View File

@ -27,9 +27,11 @@ set SQL_LOG_BIN=1;
enable_query_log;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_cursor_protocol
--disable_ps2_protocol
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
--enable_ps2_protocol
--enable_cursor_protocol
#This will generate a 20KB file, now test LOAD DATA LOCAL
truncate table t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
@ -52,9 +54,11 @@ connection master;
create table t1(a int);
insert into t1 values (1), (2), (2), (3);
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_cursor_protocol
--disable_ps2_protocol
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
--enable_ps2_protocol
--enable_cursor_protocol
drop table t1;
create table t1(a int primary key);
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
@ -83,9 +87,11 @@ 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_cursor_protocol
--disable_ps2_protocol
eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
--enable_ps2_protocol
--enable_cursor_protocol
truncate table t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
@ -109,7 +115,9 @@ sync_slave_with_master;
connection master;
let $MYSQLD_DATADIR= `select @@datadir`;
--disable_cursor_protocol
SELECT @@SESSION.sql_mode INTO @old_mode;
--enable_cursor_protocol
SET sql_mode='ignore_space';
@ -117,9 +125,11 @@ CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2), (3), (4);
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_cursor_protocol
--disable_ps2_protocol
eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
TRUNCATE TABLE t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
@ -167,9 +177,11 @@ sync_slave_with_master;
connection master;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--disable_cursor_protocol
--disable_ps2_protocol
eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug59267.sql' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
TRUNCATE TABLE t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
@ -214,9 +226,11 @@ 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_cursor_protocol
--disable_ps2_protocol
eval SELECT 1 INTO OUTFILE '$MYSQLD_DATADIR/bug60580.csv' FROM DUAL;
--enable_ps2_protocol
--enable_cursor_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,9 +37,11 @@ while($rows)
eval insert into t1 values (null);
dec $rows;
}
--disable_cursor_protocol
--disable_ps2_protocol
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' from t1;
--enable_ps2_protocol
--enable_cursor_protocol
DROP TABLE t1;
SET @@sql_log_bin= 1;

View File

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

View File

@ -278,8 +278,10 @@ EOF
--enable_reconnect
--enable_prepare_warnings
--source include/wait_until_connected_again.inc
--disable_cursor_protocol
SELECT max(seq_no) FROM mysql.gtid_slave_pos_InnoDB into @seq_no;
--disable_prepare_warnings
--enable_cursor_protocol
--connection server_1
INSERT INTO t2(a) SELECT 1+MAX(a) FROM t2;

View File

@ -26,9 +26,11 @@ 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_cursor_protocol
--disable_ps2_protocol
select * into outfile 'rpl_misc_functions.outfile' from t1;
--enable_ps2_protocol
--enable_cursor_protocol
let $MYSQLD_DATADIR= `select @@datadir`;
sync_slave_with_master;
create temporary table t2 like t1;
@ -93,10 +95,12 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf());
--enable_prepare_warnings
# Dump table on slave
--disable_cursor_protocol
--disable_ps2_protocol
select * from t1 into outfile "../../tmp/t1_slave.txt";
--disable_prepare_warnings
--enable_ps2_protocol
--enable_cursor_protocol
# Load data from slave into temp table on master
connection master;
@ -108,8 +112,10 @@ load data infile '../../tmp/t1_slave.txt' into table t1_slave;
# Compare master and slave temp table, use subtraction
# for floating point comparison of "double"
--disable_cursor_protocol
select count(*) into @aux from t1 join t1_slave using (id)
where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ;
--enable_cursor_protocol
SELECT @aux;
if (`SELECT @aux <> 12 OR @aux IS NULL`)
{

View File

@ -3,6 +3,7 @@
#
--source include/have_log_bin.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc
--echo #
@ -16,14 +17,23 @@
# Seconds_Behind_Master is based on the timestamp of the new transaction,
# rather than the last committed transaction.
#
# Note that the test doesn't actually use the value of MASTER_DELAY, but
# rather uses debug_sync to coordinate the end of the delay. This is to ensure
# that on slow machines, a delay doesn't pass before the test gets a chance to
# validate results. Additionally, it lets us continue testing after validation
# so we don't have to wait out a full delay unnecessarily. The debug_sync point
# is enabled via sql_delay_by_debug_sync, which will delay transactions based
# only on GTID events, so only one synchronization is needed per transaction.
#
--connection slave
--source include/stop_slave.inc
--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
set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync";
--let $master_delay= 1
--eval change master to master_delay=$master_delay, master_use_gtid=Slave_Pos
--source include/start_slave.inc
@ -31,7 +41,11 @@ set @@GLOBAL.slave_parallel_mode= CONSERVATIVE;
--let insert_ctr= 0
create table t1 (a int);
create table t2 (a int);
--source include/sync_slave_sql_with_master.inc
--source include/save_master_gtid.inc
--connection slave
--let $slave_sync_method= gtid
--let $num_event_groups= 2
--source include/sync_with_master_sql_delay_debug_sync.inc
--echo #
--echo # Pt 1) Ensure SBM is updated immediately upon arrival of the next event
@ -48,8 +62,7 @@ sleep 2;
--connection slave
--echo # Waiting for transaction to arrive on slave and begin SQL Delay..
--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting until MASTER_DELAY seconds after master executed event';
--source include/wait_condition.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
--echo # Validating SBM is updated on event arrival..
--let $sbm_trx1_arrive= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1)
@ -66,7 +79,20 @@ if (`SELECT $sbm_trx1_arrive > ($seconds_since_idling + 1)`)
--echo # delaying a transaction; then when the reciprocal START SLAVE occurs,
--echo # if the event is still to be delayed, SBM should resume accordingly
--source include/stop_slave.inc
--connection server_2
--echo # Ensure the kill from STOP SLAVE will be received before continuing the
--echo # SQL thread
set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill";
--send STOP SLAVE
--connection slave
set debug_sync= "now WAIT_FOR slave_notified_of_kill";
set debug_sync= "now SIGNAL continue_sql_thread";
--connection server_2
--reap
--source include/wait_for_slave_to_stop.inc
set debug_sync="RESET";
--echo # Lock t1 on slave to ensure the event can't finish (and thereby update
--echo # Seconds_Behind_Master) so slow running servers don't accidentally
@ -77,6 +103,11 @@ LOCK TABLES t1 WRITE;
--source include/start_slave.inc
--connection slave
--echo # SQL delay has no impact for the rest of the test case, so ignore it
--let $slave_sync_method= none
--source include/sync_with_master_sql_delay_debug_sync.inc
--echo # Waiting for replica to get blocked by the table lock
--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock';
--source include/wait_condition.inc
@ -120,9 +151,14 @@ sleep 3;
--connection slave
--echo # Wait for first transaction to complete SQL delay and begin execution..
--let $slave_sync_method= none
--source include/sync_with_master_sql_delay_debug_sync.inc
--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 # Wait for second transaction to complete SQL delay..
--source include/sync_with_master_sql_delay_debug_sync.inc
--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()`
@ -147,6 +183,8 @@ UNLOCK TABLES;
--echo # Cleanup
--source include/stop_slave.inc
set debug_sync= "RESET";
set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync";
--eval CHANGE MASTER TO master_delay=0
--source include/start_slave.inc

View File

@ -147,7 +147,9 @@ if (`select $iter = 1`)
--connection master
CREATE OR REPLACE SEQUENCE s3 ENGINE=innodb;
# select may return non-deterministically, don't print its result
--disable_cursor_protocol
SELECT NEXT VALUE FOR s3 into @tmpvar;
--enable_cursor_protocol
--source include/save_master_gtid.inc
--connection slave

View File

@ -25,6 +25,11 @@
# Note that due to the sleep() command the insert is written to the binary
# log in row format.
if (`SELECT $CURSOR_PROTOCOL != 0`)
{
--skip Test requires: cursor-protocol disabled
}
source include/have_binlog_format_statement.inc;
source include/master-slave.inc;

View File

@ -35,18 +35,22 @@ 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_cursor_protocol
--disable_ps2_protocol
SELECT FOUND_ROWS() INTO @a;
--enable_ps2_protocol
--enable_cursor_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_cursor_protocol
--disable_ps2_protocol
SELECT FOUND_ROWS() INTO @a;
--enable_ps2_protocol
--enable_cursor_protocol
INSERT INTO logtbl VALUES(1,2,@a);
SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
@ -82,9 +86,11 @@ END $$
--delimiter ;
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
--disable_cursor_protocol
--disable_ps2_protocol
SELECT FOUND_ROWS() INTO @found_rows;
--enable_ps2_protocol
--enable_cursor_protocol
CALL just_log(2,3,@found_rows);
SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
@ -105,7 +111,9 @@ END $$
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
--disable_ps2_protocol
--disable_cursor_protocol
SELECT FOUND_ROWS() INTO @found_rows;
--enable_cursor_protocol
SELECT log_rows(3,1,@found_rows), log_rows(3,2,@found_rows);
--enable_ps2_protocol

View File

@ -342,7 +342,9 @@ GRANT PROCESS ON *.* TO user43748@127.0.0.1;
connect (cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,);
connection cont43748;
--disable_cursor_protocol
SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1;
--enable_cursor_protocol
--error ER_KILL_DENIED_ERROR,ER_NO_SUCH_THREAD
KILL @id;

View File

@ -94,7 +94,9 @@ while ($p_trx)
--connection master
--let $xid=ro_$p_trx
--let $query=`SELECT @query$p_trx`
--disable_cursor_protocol
--source rpl_create_xa_prepared.inc
--enable_cursor_protocol
--let $complete=`select if(floor(rand()*10)%2,'COMMIT','ROLLBACK')`
--error 0
--disable_query_log
@ -117,8 +119,9 @@ while ($p_trx)
--connection master
--let $xid=ro_$p_trx
--let $query=`SELECT @query$p_trx`
--disable_cursor_protocol
--source rpl_create_xa_prepared.inc
--enable_cursor_protocol
--disconnect master_$xid
--source include/wait_until_disconnected.inc