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

MDEV-31003: Second execution for ps-protocol

This patch adds for "--ps-protocol" second execution
of queries "SELECT".
Also in this patch it is added ability to disable/enable
(--disable_ps2_protocol/--enable_ps2_protocol) second
execution for "--ps-prototocol" in testcases.
This commit is contained in:
Lena Startseva
2023-05-31 11:57:45 +07:00
parent 23dae6173c
commit 9854fb6fa7
400 changed files with 1339 additions and 42 deletions

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

@@ -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

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

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

@@ -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;
@@ -90,7 +92,9 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf());
--sync_slave_with_master
# Dump table on slave
--disable_ps2_protocol
select * from t1 into outfile "../../tmp/t1_slave.txt";
--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

@@ -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="";

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

@@ -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

@@ -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_",UUID()));
--enable_ps2_protocol
prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
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;