| 1 |
# |
| 2 |
# MDEV-22232: CTAS execution crashes during replay. |
| 3 |
# |
| 4 |
# There were multiple problems and two failing scenarios with empty result set |
| 5 |
# and with non-empty result set: |
| 6 |
# - CTAS didn't add shared keys for selected tables |
| 7 |
# - Security context wasn't set on the replayer thread |
| 8 |
# - CTAS was retried after failure - now retry disabled |
| 9 |
|
| 10 |
--source include/galera_cluster.inc |
| 11 |
--source include/have_debug_sync.inc |
| 12 |
--source include/have_debug.inc |
| 13 |
|
| 14 |
--connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1 |
| 15 |
|
| 16 |
# Scenario 1 |
| 17 |
--echo --- CTAS with empty result set --- |
| 18 |
CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
| 19 |
|
| 20 |
# Run CTAS until the resulting table gets created, |
| 21 |
# then it gets BF aborted by other DDL. |
| 22 |
SET DEBUG_SYNC = 'create_table_select_before_create SIGNAL may_run WAIT_FOR bf_abort'; |
| 23 |
--send |
| 24 |
CREATE TABLE t2 SELECT * FROM t1; |
| 25 |
|
| 26 |
# Wait for CTAS to reach the table create point, |
| 27 |
# start executing other DDL and BF abort CTAS. |
| 28 |
--connection node_1 |
| 29 |
SET DEBUG_SYNC = 'now WAIT_FOR may_run'; |
| 30 |
TRUNCATE TABLE t1; |
| 31 |
|
| 32 |
--connection con1 |
| 33 |
# CTAS gets BF aborted. |
| 34 |
--error ER_QUERY_INTERRUPTED |
| 35 |
--reap |
| 36 |
|
| 37 |
# Cleanup |
| 38 |
SET DEBUG_SYNC = 'RESET'; |
| 39 |
|
| 40 |
|
| 41 |
# Scenario 2 |
| 42 |
--echo --- CTAS with non-empty result set --- |
| 43 |
INSERT INTO t1 VALUES (10), (20), (30); |
| 44 |
|
| 45 |
# Run CTAS until the resulting table gets created, |
| 46 |
# then it gets BF aborted by other DDL. |
| 47 |
SET DEBUG_SYNC = 'create_table_select_before_create SIGNAL may_run WAIT_FOR bf_abort'; |
| 48 |
--send |
| 49 |
CREATE TABLE t2 SELECT * FROM t1; |
| 50 |
|
| 51 |
# Wait for CTAS to reach the table create point, |
| 52 |
# start executing other DDL and BF abort CTAS. |
| 53 |
--connection node_1 |
| 54 |
SET DEBUG_SYNC = 'now WAIT_FOR may_run'; |
| 55 |
TRUNCATE TABLE t1; |
| 56 |
|
| 57 |
--connection con1 |
| 58 |
# CTAS gets BF aborted. |
| 59 |
--error ER_QUERY_INTERRUPTED |
| 60 |
--reap |
| 61 |
|
| 62 |
# Cleanup |
| 63 |
SET DEBUG_SYNC = 'RESET'; |
| 64 |
DROP TABLE t1; |
| 65 |
--disconnect con1 |
| 66 |
--source include/galera_end.inc |