| 1 |
# |
| 2 |
# Test Flush tables with read lock along with |
| 3 |
# flush tables <table> with read lock for compatibility. |
| 4 |
# Also, making sure all DDL and DMLs are propagated |
| 5 |
# after provider is unpaused |
| 6 |
# |
| 7 |
--source include/galera_cluster.inc |
| 8 |
--source include/have_debug.inc |
| 9 |
--source include/have_debug_sync.inc |
| 10 |
|
| 11 |
--let $galera_connection_name = node_2a |
| 12 |
--let $galera_server_number = 2 |
| 13 |
--source include/galera_connect.inc |
| 14 |
|
| 15 |
--connection node_1 |
| 16 |
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; |
| 17 |
INSERT INTO t1 VALUES (1); |
| 18 |
|
| 19 |
--connection node_2 |
| 20 |
SET session wsrep_sync_wait=0; |
| 21 |
FLUSH TABLES WITH READ LOCK; |
| 22 |
|
| 23 |
--connection node_1 |
| 24 |
ALTER TABLE t1 ADD COLUMN f2 INTEGER; |
| 25 |
INSERT INTO t1 VALUES (2,3); |
| 26 |
|
| 27 |
--connection node_2a |
| 28 |
SET session wsrep_sync_wait=0; |
| 29 |
SHOW CREATE TABLE t1; |
| 30 |
SET debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked2 WAIT_FOR go2'; |
| 31 |
--send FLUSH TABLES t1 WITH READ LOCK; |
| 32 |
|
| 33 |
--connection node_2 |
| 34 |
SET debug_sync='now WAIT_FOR parked2'; |
| 35 |
|
| 36 |
# let the flush table wait in pause state before we unlock |
| 37 |
# table otherwise there is window where-in flush table is |
| 38 |
# yet to wait in pause and unlock allows alter table to proceed. |
| 39 |
# this is because send is asynchronous. |
| 40 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE Info LIKE 'FLUSH TABLES t1 WITH READ LOCK'; |
| 41 |
--let $wait_condition_on_error_output = SHOW PROCESSLIST |
| 42 |
--source include/wait_condition_with_debug.inc |
| 43 |
|
| 44 |
SET debug_sync='now SIGNAL go2'; |
| 45 |
# this will release existing lock but will not resume |
| 46 |
# the cluster as there is new FTRL that is still pausing it. |
| 47 |
UNLOCK TABLES; |
| 48 |
SHOW CREATE TABLE t1; |
| 49 |
|
| 50 |
--connection node_2a |
| 51 |
--reap |
| 52 |
set debug_sync= 'RESET'; |
| 53 |
UNLOCK TABLES; |
| 54 |
|
| 55 |
SET SESSION wsrep_sync_wait = DEFAULT; |
| 56 |
SHOW CREATE TABLE t1; |
| 57 |
SELECT * from t1; |
| 58 |
|
| 59 |
--connection node_1 |
| 60 |
DROP TABLE t1; |