Skip to content

Commit 9f56dd7

Browse files
committed
Merge 10.3 into 10.4
2 parents 3a269a8 + 4e7ee16 commit 9f56dd7

File tree

12 files changed

+274
-71
lines changed

12 files changed

+274
-71
lines changed

mysql-test/suite/innodb/r/alter_varchar_change.result

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SET @idx1_id = 0;
1515
CREATE TABLE t1(f1 INT NOT NULL,
1616
f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
1717
CALL get_table_id("test/t1", @tbl_id);
18-
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
18+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
1919
CALL get_table_id("test/t1", @tbl1_id);
2020
SELECT @tbl1_id = @tbl_id;
2121
@tbl1_id = @tbl_id
@@ -32,7 +32,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
3232
f2 VARCHAR(100),
3333
INDEX idx(f2))ENGINE=InnoDB;
3434
CALL get_table_id("test/t1", @tbl_id);
35-
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
35+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
3636
CALL get_table_id("test/t1", @tbl1_id);
3737
SELECT @tbl1_id = @tbl_id;
3838
@tbl1_id = @tbl_id
@@ -49,7 +49,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100),
4949
INDEX idx(f2, f3), index idx1(f3, f2))ENGINE=InnoDB;
5050
CALL get_table_id("test/t1", @tbl_id);
5151
CALL get_index_id(@tbl_id, "idx", @idx_id);
52-
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150);
52+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150), ALGORITHM=INSTANT;
5353
CALL get_table_id("test/t1", @tbl1_id);
5454
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
5555
SELECT @tbl1_id = @tbl_id;
@@ -72,7 +72,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100),
7272
INDEX idx(f2(40)))ENGINE=InnoDB;
7373
CALL get_table_id("test/t1", @tbl_id);
7474
CALL get_index_id(@tbl_id, "idx", @idx_id);
75-
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
75+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
7676
CALL get_table_id("test/t1", @tbl1_id);
7777
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
7878
SELECT @tbl1_id = @tbl_id;
@@ -93,7 +93,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
9393
f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB;
9494
CALL get_table_id("test/t1", @tbl_id);
9595
CALL get_index_id(@tbl_id, "idx", @idx_id);
96-
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
96+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
9797
CALL get_table_id("test/t1", @tbl1_id);
9898
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
9999
SELECT @tbl1_id = @tbl_id;
@@ -117,7 +117,7 @@ INDEX idx(f3))ENGINE=InnoDB;
117117
INSERT INTO t1(f1, f2) VALUES(1, repeat('a', 40));
118118
CALL get_table_id("test/t1", @tbl_id);
119119
CALL get_index_id(@tbl_id, "idx", @idx_id);
120-
ALTER TABLE t1 MODIFY f2 VARCHAR(100);
120+
ALTER TABLE t1 MODIFY f2 VARCHAR(100), ALGORITHM=INSTANT;
121121
CALL get_table_id("test/t1", @tbl1_id);
122122
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
123123
SELECT @tbl1_id = @tbl_id;
@@ -163,7 +163,7 @@ f2 VARCHAR(100),
163163
INDEX idx(f2(10)))ENGINE=InnoDB;
164164
CALL get_table_id("test/t1", @tbl_id);
165165
CALL get_index_id(@tbl_id, "idx", @idx_id);
166-
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10));
166+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10)), ALGORITHM=INSTANT;
167167
CALL get_table_id("test/t1", @tbl1_id);
168168
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
169169
SELECT @tbl1_id = @tbl_id;
@@ -251,7 +251,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
251251
f2 VARCHAR(100),
252252
INDEX idx(f2))ENGINE=InnoDB;
253253
CALL get_table_id("test/t1", @tbl_id);
254-
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
254+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT, ALGORITHM=INSTANT;
255255
CALL get_table_id("test/t1", @tbl1_id);
256256
SELECT @tbl1_id = @tbl_id;
257257
@tbl1_id = @tbl_id
@@ -267,7 +267,7 @@ t1 CREATE TABLE `t1` (
267267
DROP TABLE t1;
268268
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
269269
CALL get_table_id("test/t1", @tbl_id);
270-
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
270+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT, ALGORITHM=INSTANT;
271271
CALL get_table_id("test/t1", @tbl1_id);
272272
SELECT @tbl1_id = @tbl_id;
273273
@tbl1_id = @tbl_id
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
set default_storage_engine=innodb;
2+
#
3+
# MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
4+
#
5+
create table t2 (x int, z int default 41);
6+
alter table t2 discard tablespace;
7+
create table t1 (x int);
8+
insert into t1 values (1);
9+
alter table t1 add z int default 42, algorithm instant;
10+
select * from t1;
11+
x z
12+
1 42
13+
flush tables t1 for export;
14+
unlock tables;
15+
# The metadata has to be updated to instant ADD COLUMN.
16+
alter table t2 import tablespace;
17+
select * from t2;
18+
x z
19+
1 42
20+
insert into t2 set x=2;
21+
select * from t2;
22+
x z
23+
1 42
24+
2 41
25+
alter table t1 discard tablespace;
26+
flush tables t2 for export;
27+
unlock tables;
28+
# Both the metadata and the data file used instant ADD COLUMN.
29+
alter table t1 import tablespace;
30+
select * from t1;
31+
x z
32+
1 42
33+
2 41
34+
drop table t2;
35+
create table t2 select * from t1;
36+
alter table t1 discard tablespace;
37+
flush tables t2 for export;
38+
unlock tables;
39+
# The instant ADD COLUMN has to be removed from the metadata.
40+
alter table t1 import tablespace;
41+
select * from t1;
42+
x z
43+
1 42
44+
2 41
45+
# Remove metadata for instant DROP COLUMN, then import
46+
alter table t1 drop x, add column x int first, algorithm instant;
47+
select * from t1;
48+
x z
49+
NULL 42
50+
NULL 41
51+
alter table t1 discard tablespace;
52+
alter table t1 import tablespace;
53+
select * from t1;
54+
x z
55+
1 42
56+
2 41
57+
# Import a data file that contains instant DROP COLUMN metadata
58+
alter table t2 drop x;
59+
alter table t1 drop x, force;
60+
alter table t1 discard tablespace;
61+
flush tables t2 for export;
62+
unlock tables;
63+
alter table t1 import tablespace;
64+
ERROR HY000: Schema mismatch (Index field count 4 doesn't match tablespace metadata file value 5)
65+
select * from t1;
66+
ERROR HY000: Tablespace has been discarded for table `t1`
67+
alter table t1 import tablespace;
68+
ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Unsupported
69+
select * from t1;
70+
ERROR HY000: Tablespace has been discarded for table `t1`
71+
drop table t2;
72+
drop table t1;

mysql-test/suite/innodb/t/alter_varchar_change.test

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
2626
f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
2727

2828
CALL get_table_id("test/t1", @tbl_id);
29-
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
29+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
3030
CALL get_table_id("test/t1", @tbl1_id);
3131

3232
SELECT @tbl1_id = @tbl_id;
@@ -39,7 +39,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
3939
INDEX idx(f2))ENGINE=InnoDB;
4040

4141
CALL get_table_id("test/t1", @tbl_id);
42-
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
42+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
4343
CALL get_table_id("test/t1", @tbl1_id);
4444

4545
SELECT @tbl1_id = @tbl_id;
@@ -51,7 +51,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100),
5151

5252
CALL get_table_id("test/t1", @tbl_id);
5353
CALL get_index_id(@tbl_id, "idx", @idx_id);
54-
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150);
54+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150), ALGORITHM=INSTANT;
5555
CALL get_table_id("test/t1", @tbl1_id);
5656
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
5757

@@ -65,7 +65,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100),
6565

6666
CALL get_table_id("test/t1", @tbl_id);
6767
CALL get_index_id(@tbl_id, "idx", @idx_id);
68-
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
68+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
6969
CALL get_table_id("test/t1", @tbl1_id);
7070
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
7171

@@ -80,7 +80,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
8080

8181
CALL get_table_id("test/t1", @tbl_id);
8282
CALL get_index_id(@tbl_id, "idx", @idx_id);
83-
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
83+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ALGORITHM=INSTANT;
8484
CALL get_table_id("test/t1", @tbl1_id);
8585
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
8686

@@ -98,7 +98,7 @@ INSERT INTO t1(f1, f2) VALUES(1, repeat('a', 40));
9898

9999
CALL get_table_id("test/t1", @tbl_id);
100100
CALL get_index_id(@tbl_id, "idx", @idx_id);
101-
ALTER TABLE t1 MODIFY f2 VARCHAR(100);
101+
ALTER TABLE t1 MODIFY f2 VARCHAR(100), ALGORITHM=INSTANT;
102102
CALL get_table_id("test/t1", @tbl1_id);
103103
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
104104

@@ -129,7 +129,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
129129

130130
CALL get_table_id("test/t1", @tbl_id);
131131
CALL get_index_id(@tbl_id, "idx", @idx_id);
132-
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10));
132+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10)), ALGORITHM=INSTANT;
133133
CALL get_table_id("test/t1", @tbl1_id);
134134
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
135135

@@ -192,7 +192,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
192192
INDEX idx(f2))ENGINE=InnoDB;
193193

194194
CALL get_table_id("test/t1", @tbl_id);
195-
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
195+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT, ALGORITHM=INSTANT;
196196
CALL get_table_id("test/t1", @tbl1_id);
197197

198198
SELECT @tbl1_id = @tbl_id;
@@ -202,7 +202,7 @@ DROP TABLE t1;
202202
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
203203

204204
CALL get_table_id("test/t1", @tbl_id);
205-
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
205+
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT, ALGORITHM=INSTANT;
206206
CALL get_table_id("test/t1", @tbl1_id);
207207

208208
SELECT @tbl1_id = @tbl_id;
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
--source include/have_innodb.inc
2+
set default_storage_engine=innodb;
3+
4+
--echo #
5+
--echo # MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
6+
--echo #
7+
8+
create table t2 (x int, z int default 41);
9+
alter table t2 discard tablespace;
10+
11+
create table t1 (x int);
12+
insert into t1 values (1);
13+
alter table t1 add z int default 42, algorithm instant;
14+
select * from t1;
15+
flush tables t1 for export;
16+
--let $MYSQLD_DATADIR= `select @@datadir`
17+
--move_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg
18+
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
19+
unlock tables;
20+
21+
--echo # The metadata has to be updated to instant ADD COLUMN.
22+
alter table t2 import tablespace;
23+
24+
select * from t2;
25+
insert into t2 set x=2;
26+
select * from t2;
27+
28+
alter table t1 discard tablespace;
29+
flush tables t2 for export;
30+
--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_DATADIR/test/t1.cfg
31+
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd
32+
unlock tables;
33+
34+
--echo # Both the metadata and the data file used instant ADD COLUMN.
35+
alter table t1 import tablespace;
36+
select * from t1;
37+
38+
drop table t2;
39+
create table t2 select * from t1;
40+
41+
alter table t1 discard tablespace;
42+
flush tables t2 for export;
43+
--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_DATADIR/test/t1.cfg
44+
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd
45+
unlock tables;
46+
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t1b.cfg
47+
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t1b.ibd
48+
49+
--echo # The instant ADD COLUMN has to be removed from the metadata.
50+
alter table t1 import tablespace;
51+
select * from t1;
52+
53+
--echo # Remove metadata for instant DROP COLUMN, then import
54+
alter table t1 drop x, add column x int first, algorithm instant;
55+
select * from t1;
56+
alter table t1 discard tablespace;
57+
58+
--move_file $MYSQLD_DATADIR/test/t1b.cfg $MYSQLD_DATADIR/test/t1.cfg
59+
--move_file $MYSQLD_DATADIR/test/t1b.ibd $MYSQLD_DATADIR/test/t1.ibd
60+
alter table t1 import tablespace;
61+
select * from t1;
62+
63+
--echo # Import a data file that contains instant DROP COLUMN metadata
64+
alter table t2 drop x;
65+
alter table t1 drop x, force;
66+
alter table t1 discard tablespace;
67+
68+
flush tables t2 for export;
69+
--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_DATADIR/test/t1.cfg
70+
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t1.ibd
71+
unlock tables;
72+
73+
--error ER_TABLE_SCHEMA_MISMATCH
74+
alter table t1 import tablespace;
75+
--error ER_TABLESPACE_DISCARDED
76+
select * from t1;
77+
--remove_file $MYSQLD_DATADIR/test/t1.cfg
78+
--error ER_INTERNAL_ERROR
79+
alter table t1 import tablespace;
80+
--error ER_TABLESPACE_DISCARDED
81+
select * from t1;
82+
83+
drop table t2;
84+
drop table t1;

mysys/my_fopen.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,7 @@ int my_fclose(FILE *fd, myf MyFlags)
171171
my_file_info[file].type= UNOPEN;
172172
}
173173
#ifndef _WIN32
174-
do
175-
{
176-
err= fclose(fd);
177-
} while (err == -1 && errno == EINTR);
174+
err= fclose(fd);
178175
#else
179176
err= my_win_fclose(fd);
180177
#endif

plugin/user_variables/mysql-test/user_variables/basic.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PLUGIN_AUTHOR Sergey Vojtovich
77
PLUGIN_DESCRIPTION User-defined variables
88
PLUGIN_LICENSE GPL
99
LOAD_OPTION ON
10-
PLUGIN_MATURITY Gamma
10+
PLUGIN_MATURITY Stable
1111
SHOW CREATE TABLE INFORMATION_SCHEMA.USER_VARIABLES;
1212
Table Create Table
1313
user_variables CREATE TEMPORARY TABLE `user_variables` (

plugin/user_variables/user_variables.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,6 @@ maria_declare_plugin(user_variables)
135135
NULL,
136136
NULL,
137137
"1.0",
138-
MariaDB_PLUGIN_MATURITY_GAMMA
138+
MariaDB_PLUGIN_MATURITY_STABLE
139139
}
140140
maria_declare_plugin_end;

sql/ha_sequence.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,6 @@ maria_declare_plugin(sql_sequence)
443443
NULL, /* status variables */
444444
NULL, /* system variables */
445445
"1.0", /* string version */
446-
MariaDB_PLUGIN_MATURITY_ALPHA /* maturity */
446+
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
447447
}
448448
maria_declare_plugin_end;

0 commit comments

Comments
 (0)