| 1 |
--source include/big_test.inc |
| 2 |
--source include/force_restart.inc |
| 3 |
--source include/galera_cluster.inc |
| 4 |
--source include/have_sequence.inc |
| 5 |
|
| 6 |
# |
| 7 |
# MDEV-28641 : Query cache entries not invalidated on slave of a Galera cluster |
| 8 |
# |
| 9 |
# We use two 2-node galera clusters as follows |
| 10 |
# |
| 11 |
# A(1) <-> B(2) {Galera cluster 1} |
| 12 |
# | {Async replication} |
| 13 |
# D(3) <-> E(4) {Galera cluster 2} |
| 14 |
# |
| 15 |
# Normal asyncronous replication is used between nodes 1 and 3 |
| 16 |
# so that node_1 is master and node_3 a slave. |
| 17 |
# |
| 18 |
# In this test we can't test is some query fast or slow but we can |
| 19 |
# test does all nodes see all rows (this is not true before fix) |
| 20 |
# |
| 21 |
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 |
| 22 |
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 |
| 23 |
|
| 24 |
--connection node_2 |
| 25 |
call mtr.add_suppression("WSREP: Ignoring server id .* for non bootstrap node"); |
| 26 |
--connection node_4 |
| 27 |
call mtr.add_suppression("WSREP: Ignoring server id .* for non bootstrap node"); |
| 28 |
|
| 29 |
--connection node_3 |
| 30 |
|
| 31 |
--disable_query_log |
| 32 |
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_1, master_use_gtid=current_pos; |
| 33 |
--enable_query_log |
| 34 |
START SLAVE; |
| 35 |
--source include/wait_for_slave_to_start.inc |
| 36 |
|
| 37 |
--connection node_1 |
| 38 |
|
| 39 |
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb; |
| 40 |
--disable_query_log |
| 41 |
INSERT INTO t1 SELECT seq, md5(rand()) from seq_1_to_50000; |
| 42 |
COMMIT; |
| 43 |
--enable_query_log |
| 44 |
SET AUTOCOMMIT=1; |
| 45 |
INSERT INTO t1 VALUES (4000000, 'foobar'); |
| 46 |
SELECT COUNT(*) FROM t1; |
| 47 |
--sync_slave_with_master node_3 |
| 48 |
|
| 49 |
# |
| 50 |
# All nodes should see one row and first query is slow and second fast |
| 51 |
# |
| 52 |
--connection node_1 |
| 53 |
--echo # node_1 |
| 54 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 55 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 56 |
--connection node_2 |
| 57 |
--echo # node_2 |
| 58 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 59 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 60 |
--connection node_3 |
| 61 |
--echo # node_3 |
| 62 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 63 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 64 |
--connection node_4 |
| 65 |
--echo # node_4 |
| 66 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 67 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 68 |
# |
| 69 |
# Insert a new row in master, this should cause query cache |
| 70 |
# invalidation |
| 71 |
# |
| 72 |
--connection node_1 |
| 73 |
--echo # node_1 insert new |
| 74 |
INSERT INTO t1 values (5000000, 'foobar'); |
| 75 |
--sync_slave_with_master node_3 |
| 76 |
|
| 77 |
# |
| 78 |
# All nodes should see 2 rows |
| 79 |
# |
| 80 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 81 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 82 |
|
| 83 |
--connection node_2 |
| 84 |
--echo # node_2 |
| 85 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 86 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 87 |
--connection node_3 |
| 88 |
--echo # node_3 |
| 89 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 90 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 91 |
--connection node_4 |
| 92 |
--echo # node_4 |
| 93 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 94 |
SELECT * FROM t1 WHERE msg='foobar'; |
| 95 |
|
| 96 |
--connection node_2 |
| 97 |
--echo # node_3 different query same table |
| 98 |
SELECT id, msg FROM t1 WHERE msg='foobar'; |
| 99 |
|
| 100 |
--connection node_4 |
| 101 |
--echo # node_6 different query same table |
| 102 |
SELECT id, msg FROM t1 WHERE msg='foobar'; |
| 103 |
|
| 104 |
# |
| 105 |
# Cleanup |
| 106 |
# |
| 107 |
--connection node_1 |
| 108 |
drop table t1; |
| 109 |
--sync_slave_with_master node_3 |
| 110 |
|
| 111 |
--connection node_3 |
| 112 |
STOP SLAVE; |
| 113 |
RESET SLAVE ALL; |
| 114 |
|
| 115 |
--connection node_1 |
| 116 |
SET SESSION WSREP_ON=OFF; |
| 117 |
RESET MASTER; |
| 118 |
SET SESSION WSREP_ON=ON; |
| 119 |
|
| 120 |
--source include/galera_end.inc |
| 121 |
--echo # End of test |