mariadb/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
Andrei Elkin e972125f11 MDEV-13073 This part merges the Ali semisync related changes
and specifically the ack receiving functionality.
Semisync is turned to be static instead of plugin so its functions
are invoked at the same points as RUN_HOOKS.
The RUN_HOOKS and the observer interface remain to be removed by later
patch.

Todo:
  React on killed status by repl_semisync_master.wait_after_sync(). Currently
  Repl_semi_sync_master::commit_trx does not check the killed status.

  There were few bugfixes found that are present in mysql and its unclear
  whether/how they are covered. Those include:

  Bug#15985893: GTID SKIPPED EVENTS ON MASTER CAUSE SEMI SYNC TIME-OUTS
  Bug#17932935 CALLING IS_SEMI_SYNC_SLAVE() IN EACH FUNCTION CALL
                 HAS BAD PERFORMANCE
  Bug#20574628: SEMI-SYNC REPLICATION PERFORMANCE DEGRADES WITH A HIGH NUMBER OF THREADS
2017-12-18 13:43:37 +02:00

90 lines
2.4 KiB
Text

source include/not_embedded.inc;
source include/have_innodb.inc;
source include/master-slave.inc;
let $engine_type= InnoDB;
# Suppress warnings that might be generated during the test
connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog");
call mtr.add_suppression("Semi-sync master .* waiting for slave reply");
call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
connection master;
set global rpl_semi_sync_master_enabled = 1;
connection slave;
source include/stop_slave.inc;
set global rpl_semi_sync_slave_enabled = 1;
source include/start_slave.inc;
connection master;
SET GLOBAL event_scheduler = ON;
replace_result $engine_type ENGINE_TYPE;
eval CREATE TABLE t1 (i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f varchar(8)) ENGINE=$engine_type;
INSERT INTO t1 (f) VALUES ('a'),('a'),('a'),('a'),('a');
--disable_warnings
INSERT INTO t1 SELECT i+5, f FROM t1;
INSERT INTO t1 SELECT i+10, f FROM t1;
--enable_warnings
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
DO INSERT INTO t1 VALUES (SLEEP(5),CONCAT('ev1_',CONNECTION_ID()));
CREATE EVENT ev2 ON SCHEDULE EVERY 1 SECOND
DO INSERT INTO t1 VALUES (SLEEP(5),CONCAT('ev2_',CONNECTION_ID()));
connection slave;
STOP SLAVE IO_THREAD;
connection master;
let $run = 20;
while ($run)
{
connect (m$run,localhost,root,,);
connection m$run;
send;
eval UPDATE t1 SET f = CONCAT('up_',CONNECTION_ID()) WHERE i = $run;
connection master;
dec $run;
}
connection master;
SET GLOBAL event_scheduler = OFF;
let $run = 20;
while ($run)
{
connection m$run;
reap;
disconnect m$run;
dec $run;
}
#
# Clean up
#
connection slave;
source include/stop_slave.inc;
set global rpl_semi_sync_slave_enabled = 0;
connection master;
set global rpl_semi_sync_master_enabled = 0;
connection slave;
source include/start_slave.inc;
connection master;
DROP EVENT ev1;
DROP EVENT ev2;
DROP TABLE t1;
sync_slave_with_master;
--source include/rpl_end.inc