| 1 |
# |
| 2 |
# This test is for testing virtual columnm support in galera cluster |
| 3 |
# |
| 4 |
--source include/galera_cluster.inc |
| 5 |
--source include/have_innodb.inc |
| 6 |
|
| 7 |
# |
| 8 |
# test case for verifying that cascaded delete in a table with virtual column does not crash slave node |
| 9 |
# |
| 10 |
|
| 11 |
--connection node_1 |
| 12 |
|
| 13 |
CREATE TABLE p (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT) ENGINE = InnoDB; |
| 14 |
CREATE TABLE c (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, pid INT UNSIGNED, bitmap TINYINT UNSIGNED NOT NULL DEFAULT 0, bitmap5 TINYINT UNSIGNED GENERATED ALWAYS AS (bitmap&(1<<5)) VIRTUAL, FOREIGN KEY (pid) REFERENCES p (id) ON DELETE CASCADE ON UPDATE CASCADE); |
| 15 |
|
| 16 |
# not sure of this index is needed for the test |
| 17 |
CREATE INDEX bitmap5 ON c(bitmap5) USING BTREE; |
| 18 |
|
| 19 |
INSERT INTO p VALUES(1); |
| 20 |
INSERT INTO c(pid) VALUES(1); |
| 21 |
|
| 22 |
|
| 23 |
--connection node_2 |
| 24 |
# wait until both INSERTS have arrived in node_2 |
| 25 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM c |
| 26 |
--source include/wait_condition.inc |
| 27 |
|
| 28 |
--connection node_1 |
| 29 |
# delete from parent table, it will cascade into child table |
| 30 |
# node_2 might have problem in applying this cascaded delete |
| 31 |
DELETE FROM p WHERE id=1; |
| 32 |
|
| 33 |
SELECT * FROM p; |
| 34 |
SELECT * FROM c; |
| 35 |
|
| 36 |
--connection node_2 |
| 37 |
--let $wait_condition = SELECT COUNT(*) = 0 FROM c; |
| 38 |
--source include/wait_condition.inc |
| 39 |
|
| 40 |
--connection node_1 |
| 41 |
DROP TABLE c; |
| 42 |
DROP TABLE p; |