| 1 |
# This test case accompanies bug#26434966 (bugs.mysql.com bug #87052) |
| 2 |
# |
| 3 |
# t1 is an NDB table without any unique keys. |
| 4 |
# |
| 5 |
# We test HASH_SCAN access in idempotent mode by deleting a row on the slave, |
| 6 |
# and then deleting several rows on the master, where the replicated delete |
| 7 |
# includes the row already deleted. |
| 8 |
|
| 9 |
--source include/have_ndb.inc |
| 10 |
--source include/have_binlog_format_mixed_or_row.inc |
| 11 |
--source suite/ndb_rpl/ndb_master-slave.inc |
| 12 |
|
| 13 |
connection master; |
| 14 |
--echo **** On Master **** |
| 15 |
|
| 16 |
# t1 has a non-unique index and a hidden primary key |
| 17 |
CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), KEY(C1, C2)) ENGINE = ndb; |
| 18 |
|
| 19 |
# t2 is exacly like t1 |
| 20 |
CREATE TABLE t2 (C1 CHAR(1), C2 CHAR(1), KEY(C1, C2)) ENGINE = ndb; |
| 21 |
|
| 22 |
# t3 is exacly like t1 |
| 23 |
CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), KEY(C1, C2)) ENGINE = ndb; |
| 24 |
|
| 25 |
# |
| 26 |
# Load data |
| 27 |
# |
| 28 |
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M'), ('N','N'); |
| 29 |
INSERT INTO t2 VALUES ('K','K'), ('L','L'), ('M','M'), ('N','N'); |
| 30 |
INSERT INTO t3 VALUES ('K','K'), ('L','L'), ('M','M'), ('N','N'); |
| 31 |
|
| 32 |
--sleep 1 |
| 33 |
--source include/sync_slave_sql_with_master.inc |
| 34 |
--echo **** On Slave **** |
| 35 |
|
| 36 |
set @prior_replica_exec_mode=@@global.replica_exec_mode; |
| 37 |
set @prior_slave_rows_search_algorithms=@@global.slave_rows_search_algorithms; |
| 38 |
set @prior_replica_allow_batching=@@global.replica_allow_batching; |
| 39 |
set @@global.replica_exec_mode= 'IDEMPOTENT'; |
| 40 |
set @@global.slave_rows_search_algorithms= 'HASH_SCAN'; |
| 41 |
set @@global.replica_allow_batching = OFF; |
| 42 |
|
| 43 |
--source include/restart_slave_sql.inc |
| 44 |
|
| 45 |
# Deletions on slave |
| 46 |
DELETE FROM t1 WHERE C1 = 'L'; |
| 47 |
DELETE FROM t2 WHERE C1 = 'L'; |
| 48 |
DELETE FROM t3 WHERE C1 = 'K'; |
| 49 |
|
| 50 |
connection master; |
| 51 |
--echo **** On Master **** |
| 52 |
--sleep 1 |
| 53 |
DELETE FROM t1; |
| 54 |
|
| 55 |
--source include/sync_slave_sql_with_master.inc |
| 56 |
--source include/check_slave_is_running.inc |
| 57 |
--echo **** On Slave ; expect count to be 0 **** |
| 58 |
SELECT COUNT(*) FROM t1 ORDER BY c1,c2; |
| 59 |
|
| 60 |
connection master; |
| 61 |
--echo **** On Master **** |
| 62 |
DELETE FROM t2; |
| 63 |
DELETE FROM t3; |
| 64 |
|
| 65 |
|
| 66 |
--source include/sync_slave_sql_with_master.inc |
| 67 |
--source include/check_slave_is_running.inc |
| 68 |
--echo **** On Slave ; expect count to be 0 **** |
| 69 |
SELECT COUNT(*) FROM t2 ORDER BY c1,c2; |
| 70 |
SELECT COUNT(*) FROM t3 ORDER BY c1,c2; |
| 71 |
|
| 72 |
|
| 73 |
--connection master |
| 74 |
--echo **** On Master **** |
| 75 |
drop table t1, t2, t3; |
| 76 |
|
| 77 |
|
| 78 |
--sync_slave_with_master |
| 79 |
--echo **** Cleanup on Slave **** |
| 80 |
set @@global.replica_exec_mode= @prior_replica_exec_mode; |
| 81 |
set @@global.slave_rows_search_algorithms= @prior_slave_rows_search_algorithms; |
| 82 |
set @@global.replica_allow_batching= @prior_replica_allow_batching; |
| 83 |
call mtr.add_suppression("Replica SQL.*Could not execute Delete_rows event on table test.t.* Error_code: 1032"); |
| 84 |
|
| 85 |
--source include/rpl_end.inc |