| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_debug_sync.inc |
| 3 |
--source include/have_binlog_format_row.inc |
| 4 |
--source include/have_innodb.inc |
| 5 |
--source include/master-slave.inc |
| 6 |
|
| 7 |
connection master; |
| 8 |
set @old_master_binlog_checksum= @@global.binlog_checksum; |
| 9 |
|
| 10 |
# MDEV-4475: Cannot replicate to old server when binlog contains |
| 11 |
# empty Gtid_list event |
| 12 |
# |
| 13 |
# Test this by binlog rotation before we log any GTIDs. |
| 14 |
sync_slave_with_master; |
| 15 |
|
| 16 |
# Need to stop/start the master without GTID before setting debug_dbug |
| 17 |
--source include/stop_slave.inc |
| 18 |
CHANGE MASTER TO MASTER_USE_GTID=NO; |
| 19 |
--source include/start_slave.inc |
| 20 |
|
| 21 |
--connection master |
| 22 |
--echo # Ensure only the new binlog dump thread is alive (wait for the old one |
| 23 |
--echo # to complete its kill) |
| 24 |
--let $wait_condition= select count(*)=1 from information_schema.processlist where command='Binlog Dump' |
| 25 |
--source include/wait_condition.inc |
| 26 |
|
| 27 |
--echo # And that it has already sent its fake rotate |
| 28 |
--let $wait_condition= select count(*)=1 from information_schema.processlist where state LIKE '%Master has sent all binlog to slave%' and command='Binlog Dump' |
| 29 |
--source include/wait_condition.inc |
| 30 |
|
| 31 |
--connection slave |
| 32 |
--source include/stop_slave.inc |
| 33 |
--echo # Test slave with no capability gets dummy event, which is ignored. |
| 34 |
set @old_dbug= @@global.debug_dbug; |
| 35 |
SET @@global.debug_dbug='+d,simulate_slave_capability_none'; |
| 36 |
--source include/start_slave.inc |
| 37 |
|
| 38 |
connection master; |
| 39 |
FLUSH LOGS; |
| 40 |
--source include/wait_for_binlog_checkpoint.inc |
| 41 |
CREATE TABLE t1 (a INT PRIMARY KEY); |
| 42 |
INSERT INTO t1 VALUES (0); |
| 43 |
sync_slave_with_master; |
| 44 |
|
| 45 |
connection master; |
| 46 |
# Add a dummy event just to have something to sync_slave_with_master on. |
| 47 |
# Otherwise we occasionally get different $relaylog_start, depending on |
| 48 |
# whether Format_description_log_event was written to relay log or not |
| 49 |
# at the time of SHOW SLAVE STATUS. |
| 50 |
ALTER TABLE t1 ORDER BY a; |
| 51 |
sync_slave_with_master; |
| 52 |
connection slave; |
| 53 |
let $relaylog_start= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1); |
| 54 |
|
| 55 |
connection master; |
| 56 |
SET SESSION binlog_annotate_row_events = ON; |
| 57 |
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); |
| 58 |
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 59 |
# A short event, to test when we need to use user_var_event for dummy event. |
| 60 |
DELETE FROM t1; |
| 61 |
INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1); |
| 62 |
let $binlog_limit= 0, 10; |
| 63 |
--source include/show_binlog_events.inc |
| 64 |
sync_slave_with_master; |
| 65 |
connection slave; |
| 66 |
|
| 67 |
SELECT * FROM t1; |
| 68 |
let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); |
| 69 |
let $binlog_start= $relaylog_start; |
| 70 |
let $binlog_limit=0,10; |
| 71 |
--source include/show_relaylog_events.inc |
| 72 |
set @@global.debug_dbug= @old_dbug; |
| 73 |
|
| 74 |
--echo # Test dummy event is checksummed correctly. |
| 75 |
|
| 76 |
connection master; |
| 77 |
set @@global.binlog_checksum = CRC32; |
| 78 |
--source include/wait_for_binlog_checkpoint.inc |
| 79 |
TRUNCATE t1; |
| 80 |
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); |
| 81 |
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 82 |
INSERT INTO t1 VALUES(2); |
| 83 |
let $binlog_limit= 0, 5; |
| 84 |
--source include/show_binlog_events.inc |
| 85 |
sync_slave_with_master; |
| 86 |
connection slave; |
| 87 |
|
| 88 |
SELECT * FROM t1; |
| 89 |
let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); |
| 90 |
let $binlog_start= 0; |
| 91 |
let $binlog_limit=7,5; |
| 92 |
--source include/show_relaylog_events.inc |
| 93 |
|
| 94 |
|
| 95 |
--echo *** MDEV-5754: MySQL 5.5 slaves cannot replicate from MariaDB 10.0 *** |
| 96 |
|
| 97 |
# The problem was that for a group commit, we get commit id into the |
| 98 |
# GTID event, and there was a bug in the code that replaces GTID with |
| 99 |
# dummy that failed when commit id was present. |
| 100 |
# |
| 101 |
# So setup a group commit in InnoDB. |
| 102 |
|
| 103 |
--connection master |
| 104 |
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 105 |
# MDEV-515 takes X-lock on the table for the first insert. |
| 106 |
# So concurrent insert won't happen on the table |
| 107 |
INSERT INTO t2 VALUES(100); |
| 108 |
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); |
| 109 |
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 110 |
|
| 111 |
--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) |
| 112 |
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; |
| 113 |
send INSERT INTO t2 VALUES (1); |
| 114 |
|
| 115 |
--connection master |
| 116 |
SET debug_sync='now WAIT_FOR master_queued1'; |
| 117 |
|
| 118 |
--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) |
| 119 |
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; |
| 120 |
send INSERT INTO t2 VALUES (2); |
| 121 |
|
| 122 |
--connection master |
| 123 |
SET debug_sync='now WAIT_FOR master_queued2'; |
| 124 |
SET debug_sync='now SIGNAL master_cont1'; |
| 125 |
|
| 126 |
--connection con1 |
| 127 |
REAP; |
| 128 |
SET debug_sync='RESET'; |
| 129 |
--connection con2 |
| 130 |
REAP; |
| 131 |
SET debug_sync='RESET'; |
| 132 |
--connection master |
| 133 |
SET debug_sync='RESET'; |
| 134 |
let $binlog_limit= 0, 10; |
| 135 |
--source include/show_binlog_events.inc |
| 136 |
--save_master_pos |
| 137 |
|
| 138 |
--connection slave |
| 139 |
--sync_with_master |
| 140 |
SELECT * FROM t2 ORDER BY a; |
| 141 |
|
| 142 |
|
| 143 |
--echo # Test that slave which cannot tolerate holes in binlog stream but |
| 144 |
--echo # knows the event does not get dummy event |
| 145 |
|
| 146 |
--source include/stop_slave.inc |
| 147 |
SET @@global.debug_dbug='+d,simulate_slave_capability_old_53'; |
| 148 |
--source include/start_slave.inc |
| 149 |
connection master; |
| 150 |
ALTER TABLE t1 ORDER BY a; |
| 151 |
sync_slave_with_master; |
| 152 |
connection slave; |
| 153 |
let $relaylog_start= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1); |
| 154 |
|
| 155 |
connection master; |
| 156 |
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); |
| 157 |
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 158 |
UPDATE t1 SET a = 3; |
| 159 |
let $binlog_limit= 0, 5; |
| 160 |
--source include/show_binlog_events.inc |
| 161 |
sync_slave_with_master; |
| 162 |
connection slave; |
| 163 |
|
| 164 |
SELECT * FROM t1; |
| 165 |
let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); |
| 166 |
let $binlog_start= $relaylog_start; |
| 167 |
let $binlog_limit=0,5; |
| 168 |
--source include/show_relaylog_events.inc |
| 169 |
|
| 170 |
select @@global.log_slave_updates; |
| 171 |
select @@global.replicate_annotate_row_events; |
| 172 |
|
| 173 |
--echo Clean up. |
| 174 |
connection master; |
| 175 |
set @@global.binlog_checksum = @old_master_binlog_checksum; |
| 176 |
DROP TABLE t1, t2; |
| 177 |
sync_slave_with_master; |
| 178 |
set @@global.debug_dbug= @old_dbug; |
| 179 |
--source include/rpl_end.inc |