File: alter_crash.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (128 lines) | stat: -rw-r--r-- 3,817 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#
# Bug#20015132 ALTER TABLE FAILS TO CHECK IF TABLE IS CORRUPTED
#
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 CHAR(1), c3 INT UNSIGNED) ENGINE=InnoDB;
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
SET DEBUG='+d,dict_set_index_corrupted';
CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	Warning	InnoDB: The B-tree of index c2 is corrupted.
test.t1	check	Warning	InnoDB: The B-tree of index c3 is corrupted.
test.t1	check	error	Corrupt
# restart
CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	Warning	InnoDB: Index c2 is marked as corrupted
test.t1	check	Warning	InnoDB: Index c3 is marked as corrupted
test.t1	check	error	Corrupt
ALTER TABLE t1 DROP INDEX c2;
CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	Warning	InnoDB: Index c3 is marked as corrupted
test.t1	check	error	Corrupt
ALTER TABLE t1 ADD INDEX (c2,c3);
ERROR 42000: Can't open table
ALTER TABLE t1 CHANGE c3 c3 INT NOT NULL;
CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
ALTER TABLE t1 ADD INDEX (c2,c3);
DROP TABLE t1;
#
# Bug #14669848 CRASH DURING ALTER MAKES ORIGINAL TABLE INACCESSIBLE
#
# -- Scenario 1:
# Crash the server in ha_innobase::commit_inplace_alter_table()
# just after committing the dictionary changes.
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
INSERT INTO t1 VALUES (1,2),(3,4);
SET DEBUG='d,innodb_alter_commit_crash_after_commit';
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
ERROR HY000: Lost connection to MySQL server during query
# Restart mysqld after the crash and reconnect.
# restart
# Files in datadir after manual recovery.
t1.ibd
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `f1` int NOT NULL,
  `f2` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
INSERT INTO t1 VALUES (5,6),(7,8);
SELECT * FROM t1;
f1	f2
1	2
3	4
5	6
7	8
DROP TABLE t1;
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=InnoDB;
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
DROP TABLE t1;
# -- Scenario 2:
# Crash the server in ha_innobase::commit_inplace_alter_table()
# just before committing the dictionary changes, but after
# writing the MLOG_FILE_RENAME records. As the mini-transaction
# is not committed, the renames will not be replayed.
CREATE TABLE t2 (f1 int not null, f2 int not null) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,2),(3,4);
SET DEBUG='d,innodb_alter_commit_crash_before_commit';
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
ERROR HY000: Lost connection to MySQL server during query
# Startup the server after the crash
# restart
SHOW TABLES;
Tables_in_test
t2
INSERT INTO t2 VALUES (5,6),(7,8);
SELECT * from t2;
f1	f2
1	2
3	4
5	6
7	8
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `f1` int NOT NULL,
  `f2` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t2;
CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=InnoDB;
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
DROP TABLE t2;
# -------------------------
# End of Testing Scenario 2
# -------------------------
#
# Bug#19330255 CRASH DURING ALTER TABLE LEADS TO
# DATA DICTIONARY INCONSISTENCY
#
CREATE TABLE t1(a int PRIMARY KEY, b varchar(150), c int NOT NULL);
INSERT INTO t1 SET a=1,c=2;
SET DEBUG='d,innodb_alter_commit_crash_after_commit';
ALTER TABLE t1 ADD INDEX (b), CHANGE c d int;
ERROR HY000: Lost connection to MySQL server during query
# Restart mysqld after the crash and reconnect.
# restart
# Files in datadir after manual recovery.
t1.ibd
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int NOT NULL,
  `b` varchar(150) DEFAULT NULL,
  `c` int NOT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT * FROM t1;
a	b	c
1	NULL	2
DROP TABLE t1;