| 1 |
# |
| 2 |
# Test client abort of schema operation |
| 3 |
# |
| 4 |
# Setup to trigger the client to detect that schema |
| 5 |
# distribution is no longer ready |
| 6 |
set GLOBAL debug="+d,ndb_schema_dist_client_not_ready"; |
| 7 |
# Do schema operation which will cause the client to abort its |
| 8 |
# schema operation |
| 9 |
CREATE TABLE t1( |
| 10 |
a int primary key |
| 11 |
) engine = NDB; |
| 12 |
Warnings: |
| 13 |
Warning 1296 Node <nodeid> 'Schema distribution is not ready' |
| 14 |
set GLOBAL debug="-d,ndb_schema_dist_client_not_ready"; |
| 15 |
# Verify that there are no leftover entries in |
| 16 |
# mysql.ndb_schema_result table |
| 17 |
nodeid schema_op_id participant_nodeid result message |
| 18 |
0 rows returned |
| 19 |
# Cleanup |
| 20 |
DROP TABLE t1; |
| 21 |
# |
| 22 |
# Bug#30684839 SCHEMA DISTRIBUTION ABORT IS NOT HANDLED PROPERLY SOMETIMES |
| 23 |
# |
| 24 |
# Setup |
| 25 |
CREATE TABLE t1 ( |
| 26 |
a int primary key |
| 27 |
) engine NDB; |
| 28 |
# Setup to trigger the client to detect that it was killed before |
| 29 |
# starting the schema distribution |
| 30 |
set GLOBAL debug="+d,ndb_schema_dist_client_killed_before_write"; |
| 31 |
# CREATE TABLE should abort the distribution and fail |
| 32 |
CREATE TABLE t2 ( |
| 33 |
a int primary key |
| 34 |
) engine NDB; |
| 35 |
ERROR HY000: Can't create table 't2' (use SHOW WARNINGS for more info). |
| 36 |
# ALTER TABLE should abort the distribution but succeed with warnings |
| 37 |
ALTER TABLE t1 ADD COLUMN b int, algorithm = COPY; |
| 38 |
Warnings: |
| 39 |
Warning 1296 Schema distribution failed |
| 40 |
# Remove debug setup |
| 41 |
set GLOBAL debug="-d,ndb_schema_dist_client_killed_before_write"; |
| 42 |
DROP TABLE t1; |
| 43 |
# Setup to trigger the client to detect that it was killed while |
| 44 |
# waiting for schema distribuiton to complete |
| 45 |
set GLOBAL debug="+d,ndb_schema_dist_client_killed_after_write"; |
| 46 |
# Do schema operation which will cause the client to detect it |
| 47 |
# has been killed but will proceed to completion nevertheless |
| 48 |
CREATE TABLE t1( |
| 49 |
a int primary key |
| 50 |
) engine = NDB; |
| 51 |
set GLOBAL debug="-d,ndb_schema_dist_client_killed_after_write"; |
| 52 |
DROP TABLE t1; |
| 53 |
# Shutdown the MySQL Server when the coordinator is waiting on the |
| 54 |
# participants and verify that they are handled smoothly |
| 55 |
# Skip sending ack from participant mysqld2 to make the coordinator wait |
| 56 |
set GLOBAL debug="+d,ndb_skip_participant_ack"; |
| 57 |
# Send the CREATE TABLE query to mysqld1 |
| 58 |
CREATE TABLE t1 ( |
| 59 |
a INT PRIMARY KEY |
| 60 |
) ENGINE = NDB; |
| 61 |
# Wait for the DDL to be logged in ndb_schema table |
| 62 |
# The coordinator is now waiting for the participants |
| 63 |
# Restart it and verify that it shuts down without any issues |
| 64 |
# restart |
| 65 |
set GLOBAL debug="-d,ndb_skip_participant_ack"; |
| 66 |
# Verify that there are no leftover entries in |
| 67 |
# mysql.ndb_schema_result table |
| 68 |
nodeid schema_op_id participant_nodeid result message |
| 69 |
0 rows returned |
| 70 |
# Verify table exists |
| 71 |
show create table t1; |
| 72 |
Table Create Table |
| 73 |
t1 CREATE TABLE `t1` ( |
| 74 |
`a` int NOT NULL, |
| 75 |
PRIMARY KEY (`a`) |
| 76 |
) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 77 |
# Cleanup |
| 78 |
DROP TABLE t1; |