| 1 |
CREATE TABLE t1 (a TEXT) ENGINE=INNODB; |
| 2 |
INSERT INTO t1 (a) VALUES ('foo'); |
| 3 |
ALTER TABLE t1 ADD COLUMN b INT DEFAULT 0, algorithm=instant; |
| 4 |
SELECT * FROM t1; |
| 5 |
a b |
| 6 |
foo 0 |
| 7 |
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL update_now WAIT_FOR update_done'; |
| 8 |
ALTER TABLE t1 ADD PRIMARY KEY (b); |
| 9 |
SET DEBUG_SYNC='now WAIT_FOR update_now'; |
| 10 |
# Metadata from INFORMATION_SCHEMA.TABLES |
| 11 |
NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS |
| 12 |
test/t1 5 0 1 |
| 13 |
# Metadata from INFORMATION_SCHEMA.COLUMNS |
| 14 |
NAME POS MTYPE PRTYPE HAS_DEFAULT |
| 15 |
a 0 5 16711932 0 |
| 16 |
b 1 6 1027 1 |
| 17 |
SELECT * FROM t1; |
| 18 |
a b |
| 19 |
foo 0 |
| 20 |
SHOW CREATE TABLE t1; |
| 21 |
Table Create Table |
| 22 |
t1 CREATE TABLE `t1` ( |
| 23 |
`a` text, |
| 24 |
`b` int DEFAULT '0' |
| 25 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 26 |
CHECK TABLE t1; |
| 27 |
Table Op Msg_type Msg_text |
| 28 |
test.t1 check status OK |
| 29 |
# Simulate incorrect instant field fetch when reading field from record written with primary index |
| 30 |
SET DEBUG = '+d,incorrect_instant_add_drop_field_fetched'; |
| 31 |
UPDATE t1 SET b = 1; |
| 32 |
ERROR HY000: Incorrect key file for table 't1'; try to repair it |
| 33 |
SET DEBUG = '-d,incorrect_instant_add_drop_field_fetched'; |
| 34 |
# Metadata from INFORMATION_SCHEMA.TABLES |
| 35 |
NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS |
| 36 |
test/t1 5 0 1 |
| 37 |
# Metadata from INFORMATION_SCHEMA.COLUMNS |
| 38 |
NAME POS MTYPE PRTYPE HAS_DEFAULT |
| 39 |
a 0 5 16711932 0 |
| 40 |
b 1 6 1027 1 |
| 41 |
SELECT * FROM t1; |
| 42 |
a b |
| 43 |
foo 0 |
| 44 |
SHOW CREATE TABLE t1; |
| 45 |
Table Create Table |
| 46 |
t1 CREATE TABLE `t1` ( |
| 47 |
`a` text, |
| 48 |
`b` int DEFAULT '0' |
| 49 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 50 |
CHECK TABLE t1; |
| 51 |
Table Op Msg_type Msg_text |
| 52 |
test.t1 check status OK |
| 53 |
SET DEBUG_SYNC='now SIGNAL update_done'; |
| 54 |
ERROR HY000: Index PRIMARY is corrupted |
| 55 |
# Metadata from INFORMATION_SCHEMA.TABLES |
| 56 |
NAME N_COLS INSTANT_COLS TOTAL_ROW_VERSIONS |
| 57 |
test/t1 5 0 1 |
| 58 |
# Metadata from INFORMATION_SCHEMA.COLUMNS |
| 59 |
NAME POS MTYPE PRTYPE HAS_DEFAULT |
| 60 |
a 0 5 16711932 0 |
| 61 |
b 1 6 1027 1 |
| 62 |
SELECT * FROM t1; |
| 63 |
a b |
| 64 |
foo 0 |
| 65 |
SHOW CREATE TABLE t1; |
| 66 |
Table Create Table |
| 67 |
t1 CREATE TABLE `t1` ( |
| 68 |
`a` text, |
| 69 |
`b` int DEFAULT '0' |
| 70 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 71 |
CHECK TABLE t1; |
| 72 |
Table Op Msg_type Msg_text |
| 73 |
test.t1 check status OK |
| 74 |
DROP TABLE t1; |
| 75 |
# Now we parse the server ERROR log and print the expected error message |
| 76 |
Occurrences of 'Unexpected INSTANTLY Added / Dropped' in the input file: 1 |
| 77 |
# Error message: |
| 78 |
[ERROR] [MY-013992] [InnoDB] Unexpected INSTANTLY Added / Dropped column: 'b' at position 4 for Table 'test/t1', Index 'GEN_CLUST_INDEX' while getting Primary Key for row logging |
| 79 |
# End |