mariadb/mysql-test/suite/sql_sequence/slave_nextval.test
Lena Startseva 9854fb6fa7 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.
2023-07-26 17:15:00 +07:00

134 lines
2.2 KiB
Text

--source include/master-slave.inc
--source include/have_binlog_format_row.inc
#
# MDEV-14092 NEXTVAL() fails on slave
#
--disable_ps2_protocol
CREATE SEQUENCE s;
INSERT INTO s VALUES (1,1,4,1,1,1,0,0);
show create sequence s;
SELECT NEXTVAL(s);
--sync_slave_with_master
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
--connection master
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
select * from s;
--sync_slave_with_master
select * from s;
--connection master
DROP SEQUENCE s;
#
# Same as above, but with cycles
#
CREATE SEQUENCE s;
INSERT INTO s VALUES (1,1,3,1,1,1,1,0);
show create sequence s;
SELECT NEXTVAL(s);
--sync_slave_with_master
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
--connection master
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
select * from s;
--sync_slave_with_master
select * from s;
--connection master
DROP SEQUENCE s;
# Here is a bit more complicated concurrent scenario that
# causes the same effect without any updates on the slave. You might
# need to replace 100 with a bigger value if it doesn't happen on your
# machine right away.
CREATE SEQUENCE s;
INSERT INTO s VALUES (1,1,3,1,1,1,1,0);
SELECT NEXTVAL(s);
--delimiter $
CREATE PROCEDURE pr(n INT)
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < n
DO
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
SELECT NEXTVAL(s);
SET i= i+1;
END WHILE;
END $
--delimiter ;
--connect (con1,localhost,root,,)
--send CALL pr(100)
--connect (con2,localhost,root,,)
--send CALL pr(100)
--connect (con3,localhost,root,,)
--send CALL pr(100)
--connect (con4,localhost,root,,)
--send CALL pr(100)
--connect (con5,localhost,root,,)
--send CALL pr(100)
--connect (con6,localhost,root,,)
--send CALL pr(100)
--connect (con7,localhost,root,,)
--send CALL pr(100)
--connect (con8,localhost,root,,)
--send CALL pr(100)
--disable_query_log
--disable_result_log
--connection con1
--reap
--connection con2
--reap
--connection con3
--reap
--connection con4
--reap
--connection con5
--reap
--connection con6
--reap
--connection con7
--reap
--connection con8
--reap
--enable_query_log
--enable_result_log
--connection master
--sync_slave_with_master
--connection master
DROP SEQUENCE s;
DROP PROCEDURE pr;
--enable_ps2_protocol
#
# Cleanup
#
--source include/rpl_end.inc