| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection slave; |
| 4 |
include/stop_slave.inc |
| 5 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 6 |
# MDEV-29621 the sequence engine binlog_row_image-full events |
| 7 |
# MDL-deadlock on the parallel slave. |
| 8 |
connection master; |
| 9 |
CREATE SEQUENCE s1; |
| 10 |
SET @@session.binlog_row_image=FULL; |
| 11 |
SET @@session.debug_dbug="+d,binlog_force_commit_id"; |
| 12 |
SET @commit_id=7; |
| 13 |
SET @@gtid_seq_no=100; |
| 14 |
SELECT NEXT VALUE FOR s1; |
| 15 |
NEXT VALUE FOR s1 |
| 16 |
1 |
| 17 |
INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0); |
| 18 |
SET @@session.debug_dbug=""; |
| 19 |
connection slave; |
| 20 |
SET @@global.slave_parallel_threads=2; |
| 21 |
SET @@global.slave_parallel_mode=optimistic; |
| 22 |
SET @@global.debug_dbug="+d,hold_worker_on_schedule"; |
| 23 |
include/start_slave.inc |
| 24 |
SET DEBUG_SYNC = 'now SIGNAL continue_worker'; |
| 25 |
connection master; |
| 26 |
DROP SEQUENCE s1; |
| 27 |
connection slave; |
| 28 |
include/stop_slave.inc |
| 29 |
# Simulate buggy 10.3.36 master to prove the parallel applier |
| 30 |
# does not deadlock now at replaying the above master load. |
| 31 |
connection master; |
| 32 |
include/rpl_stop_server.inc [server_number=1] |
| 33 |
include/rpl_start_server.inc [server_number=1] |
| 34 |
connection slave; |
| 35 |
RESET MASTER; |
| 36 |
SET @@global.gtid_slave_pos=""; |
| 37 |
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos; |
| 38 |
START SLAVE UNTIL MASTER_GTID_POS='0-1-102'; |
| 39 |
SET DEBUG_SYNC = 'now SIGNAL continue_worker'; |
| 40 |
# Normal stop is expected |
| 41 |
include/wait_for_slave_to_stop.inc |
| 42 |
# MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order |
| 43 |
# The test proves ALTER-SEQUENCE binlogs first before the following transaction does so. |
| 44 |
connection slave; |
| 45 |
include/stop_slave.inc |
| 46 |
Warnings: |
| 47 |
Note 1255 Slave already has been stopped |
| 48 |
RESET MASTER; |
| 49 |
SET @@global.gtid_slave_pos=""; |
| 50 |
connection master; |
| 51 |
RESET MASTER; |
| 52 |
CREATE TABLE ti (a INT) ENGINE=innodb; |
| 53 |
CREATE SEQUENCE s2 ENGINE=innodb; |
| 54 |
include/save_master_gtid.inc |
| 55 |
connection slave; |
| 56 |
include/start_slave.inc |
| 57 |
include/sync_with_master_gtid.inc |
| 58 |
include/stop_slave.inc |
| 59 |
include/rpl_restart_server.inc [server_number=2] |
| 60 |
SET @@global.slave_parallel_threads=2; |
| 61 |
SET @@global.slave_parallel_mode=optimistic; |
| 62 |
SET @@global.debug_dbug="+d,hold_worker_on_schedule"; |
| 63 |
SET @@global.gtid_strict_mode=1; |
| 64 |
connection master; |
| 65 |
SET @@gtid_seq_no=100; |
| 66 |
ALTER SEQUENCE s2 restart with 1; |
| 67 |
INSERT INTO ti SET a=1; |
| 68 |
include/save_master_gtid.inc |
| 69 |
SELECT @@global.gtid_binlog_state "Master gtid state"; |
| 70 |
Master gtid state |
| 71 |
0-1-101 |
| 72 |
connection slave; |
| 73 |
SET STATEMENT sql_log_bin=0 FOR FLUSH TABLES; |
| 74 |
include/start_slave.inc |
| 75 |
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both"; |
| 76 |
@@global.gtid_binlog_state no 100,101 yet in both |
| 77 |
0-1-2 0-1-2 |
| 78 |
SET DEBUG_SYNC = 'now SIGNAL continue_worker'; |
| 79 |
# Normal sync with master proves the fixes correct |
| 80 |
include/sync_with_master_gtid.inc |
| 81 |
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed"; |
| 82 |
@@global.gtid_binlog_state all through 101 have been committed |
| 83 |
0-1-101 0-1-101 |
| 84 |
connection slave; |
| 85 |
include/stop_slave.inc |
| 86 |
set @saved_mode= @@global.slave_parallel_mode; |
| 87 |
set @@global.slave_parallel_mode = conservative; |
| 88 |
include/start_slave.inc |
| 89 |
connection master; |
| 90 |
INSERT INTO ti SET a=2; |
| 91 |
include/save_master_gtid.inc |
| 92 |
connection slave; |
| 93 |
include/sync_with_master_gtid.inc |
| 94 |
lock table ti write; |
| 95 |
SET GLOBAL debug_dbug= "+d,halt_past_mark_start_commit"; |
| 96 |
connection master; |
| 97 |
INSERT INTO ti SET a=35570; |
| 98 |
ALTER SEQUENCE s2 restart with 1; |
| 99 |
include/save_master_gtid.inc |
| 100 |
connection slave; |
| 101 |
unlock tables; |
| 102 |
SET debug_sync = "now SIGNAL past_mark_continue"; |
| 103 |
include/sync_with_master_gtid.inc |
| 104 |
include/stop_slave.inc |
| 105 |
SET @@global.slave_parallel_mode = @saved_mode; |
| 106 |
SET @@global.debug_dbug = @@GLOBAL.debug_dbug; |
| 107 |
include/start_slave.inc |
| 108 |
connection slave; |
| 109 |
flush tables with read lock; |
| 110 |
connection master; |
| 111 |
CREATE OR REPLACE SEQUENCE s3 ENGINE=innodb; |
| 112 |
SELECT NEXT VALUE FOR s3 into @tmpvar; |
| 113 |
include/save_master_gtid.inc |
| 114 |
connection slave; |
| 115 |
unlock tables; |
| 116 |
include/sync_with_master_gtid.inc |
| 117 |
connection slave; |
| 118 |
flush tables with read lock; |
| 119 |
connection master; |
| 120 |
CREATE OR REPLACE SEQUENCE s3 ENGINE=innodb; |
| 121 |
SELECT NEXT VALUE FOR s3 into @tmpvar; |
| 122 |
include/save_master_gtid.inc |
| 123 |
connection slave; |
| 124 |
unlock tables; |
| 125 |
include/sync_with_master_gtid.inc |
| 126 |
connection slave; |
| 127 |
BEGIN /* slave local Trx */; |
| 128 |
select count(*) from s3; |
| 129 |
count(*) |
| 130 |
1 |
| 131 |
connection master; |
| 132 |
CREATE OR REPLACE SEQUENCE s3 ENGINE=innodb; |
| 133 |
SELECT NEXT VALUE FOR s3 into @tmpvar; |
| 134 |
include/save_master_gtid.inc |
| 135 |
connection slave; |
| 136 |
connection slave; |
| 137 |
rollback /* Trx */; |
| 138 |
include/sync_with_master_gtid.inc |
| 139 |
connection slave; |
| 140 |
include/stop_slave.inc |
| 141 |
SET debug_sync = RESET; |
| 142 |
SET @@global.slave_parallel_threads= 0; |
| 143 |
SET @@global.slave_parallel_mode= optimistic; |
| 144 |
SET @@global.debug_dbug = ""; |
| 145 |
SET @@global.gtid_strict_mode=0; |
| 146 |
include/start_slave.inc |
| 147 |
connection master; |
| 148 |
BEGIN; |
| 149 |
INSERT INTO ti SET a=32593; |
| 150 |
CREATE SEQUENCE s4; |
| 151 |
DROP SEQUENCE s2,s3,s4; |
| 152 |
DROP TABLE ti; |
| 153 |
connection slave; |
| 154 |
connection master; |
| 155 |
CREATE SEQUENCE s; |
| 156 |
SELECT NEXTVAL(s); |
| 157 |
NEXTVAL(s) |
| 158 |
1 |
| 159 |
flush binary logs; |
| 160 |
DROP SEQUENCE s; |
| 161 |
DROP SEQUENCE s; |
| 162 |
connection slave; |
| 163 |
connection master; |
| 164 |
include/rpl_end.inc |