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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')) engine=myisam;
insert into t1 (a) values (1),(2),(3);
alter online table t1 modify b int default 5, alter c set default 'X';
alter online table t1 change b new_name int;
alter online table t1 modify e enum('a','b','c');
alter online table t1 comment "new comment";
alter table t1 add constraint q check (a > 0);
alter online table t1 drop constraint q;
alter online table t1 algorithm=INPLACE, lock=NONE;
alter online table t1;
alter table t1 algorithm=INPLACE;
alter table t1 lock=NONE;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`new_name` int(11) DEFAULT NULL,
`c` varchar(80) DEFAULT 'X',
`e` enum('a','b','c') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new comment'
drop table t1;
create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
insert into t1 (a) values (1),(2),(3);
alter online table t1 modify b int default 5, alter c set default 'X';
alter online table t1 change b new_name int;
alter online table t1 modify e enum('a','b','c');
alter online table t1 comment "new comment";
alter online table t1 rename to t2;
show create table t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL,
`new_name` int(11) DEFAULT NULL,
`c` varchar(80) DEFAULT 'X',
`e` enum('a','b','c') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new comment'
drop table t2;
create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')) engine=aria;
insert into t1 (a) values (1),(2),(3);
alter online table t1 modify b int default 5;
alter online table t1 change b new_name int;
alter online table t1 modify e enum('a','b','c');
alter online table t1 comment "new comment";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`new_name` int(11) DEFAULT NULL,
`c` varchar(80) DEFAULT NULL,
`e` enum('a','b','c') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new comment'
alter online table t1 page_checksum=1;
alter online table t1 page_checksum=0;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
drop table t1;
create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
insert into t1 (a) values (1),(2),(3);
alter online table t1 drop column b, add b int;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify b bigint;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify e enum('c','a','b');
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify c varchar(50);
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify c varchar(100);
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 add f int;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 engine=memory;
ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED
alter online table t1 rename to t2;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
alter online table t1 checksum=1;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 add constraint check (b > 0);
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter table t1 engine=innodb;
alter table t1 add index (b);
alter online table t1 add index c (c);
alter online table t1 drop index b;
alter online table t1 comment "new comment";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` varchar(80) DEFAULT NULL,
`e` enum('a','b') DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `c` (`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new comment'
drop table t1;
create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
insert into t1 (a) values (1),(2),(3);
alter online table t1 drop column b, add b int;
alter online table t1 modify b bigint;
alter online table t1 modify e enum('c','a','b');
alter online table t1 modify c varchar(50);
alter online table t1 modify c varchar(100);
alter online table t1 add f int;
alter online table t1 engine=memory;
alter table t1 engine=innodb;
alter table t1 add index (b);
alter online table t1 add index c (c);
alter online table t1 drop index b;
drop table t1;
create table t1 (a int not null primary key, b int, c varchar(80));
create table t2 (a int not null primary key, b int, c varchar(80));
create table t3 (a int not null primary key, b int, c varchar(80)) engine=merge UNION=(t1);
alter online table t3 union=(t1,t2);
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=EXCLUSIVE
drop table t1,t2,t3;
create table t1 (i int) partition by hash(i) partitions 2;
alter online table t1 comment 'test';
drop table t1;
create table t1 (a int);
alter online table t1 modify a int comment 'test';
drop table t1;
create table t1 (a int) engine=innodb;
alter online table t1 modify a int comment 'test';
drop table t1;
create table t1 (a int) partition by hash(a) partitions 2;
alter online table t1 modify a int comment 'test';
drop table t1;
#
# MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
#
CREATE TABLE t1 (a BINARY(10));
ALTER TABLE t1 MODIFY a BINARY(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARBINARY(10));
ALTER TABLE t1 MODIFY a VARBINARY(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TINYBLOB);
ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMBLOB);
ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGBLOB);
ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10));
ALTER TABLE t1 MODIFY a CHAR(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10));
ALTER TABLE t1 MODIFY a VARCHAR(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT);
ALTER TABLE t1 MODIFY a TINYTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT);
ALTER TABLE t1 MODIFY a MEDIUMTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
ALTER TABLE t1 MODIFY a TEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT);
ALTER TABLE t1 MODIFY a LONGTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10));
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10));
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
select @@global.delay_key_write;
@@global.delay_key_write
ON
create table t1 (a int, b int, key(b));
flush tables;
flush status;
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 0
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 0
alter online table t1 delay_key_write=1;
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 1
flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 2
alter online table t1 delay_key_write=0;
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 2
flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
Variable_name Value
Feature_delay_key_write 2
drop table t1;
|