1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä
2020-05-27 17:10:39 +03:00
30 changed files with 1257 additions and 120 deletions

View File

@ -113,10 +113,52 @@ alter online table t1 delay_key_write=1;
show create table t1;
drop table t1;
#
# MDEV-14817 Server crashes in prep_alter_part_table() after table lock and multiple add partition
#
create or replace table t1 (x int) partition by hash (x) (partition p1, partition p2);
--echo #
--echo # MDEV-19751 Wrong partitioning by KEY() after key dropped
--echo #
create or replace table t1 (pk int, x timestamp(6), primary key (pk, x)) engine innodb
partition by key() partitions 2;
insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
--echo # Inplace for DROP PRIMARY KEY when partitioned by default field list is denied
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 drop primary key, drop column x, add primary key (pk), algorithm=inplace;
alter table t1 drop primary key, drop column x, add primary key (pk);
select * from t1 partition (p0);
drop table t1;
create or replace table t1 (pk int not null, x timestamp(6), unique u(pk, x)) engine innodb
partition by key() partitions 2;
insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
--echo # Same for NOT NULL UNIQUE KEY as this is actually primary key
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t1 drop key u, drop column x, add unique (pk), algorithm=inplace;
alter table t1 drop key u, drop column x, add unique (pk);
select * from t1 partition (p0);
drop table t1;
create or replace table t1 (pk int, x timestamp(6), primary key (pk)) engine innodb
partition by key(pk) partitions 2;
insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
--echo # Inplace for DROP PRIMARY KEY when partitioned by explicit field list is allowed
alter table t1 drop primary key, add primary key (pk, x), algorithm=inplace;
select * from t1 partition (p0);
drop table t1;
create or replace table t1 (k int, x timestamp(6), unique key u (x, k)) engine innodb
partition by key(k) partitions 2;
insert into t1 (k, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
--echo # Inplace for DROP KEY is allowed
alter table t1 drop key u, algorithm=inplace;
select * from t1 partition (p0);
drop table t1;
--echo # End of 10.2 tests
--echo #
--echo # MDEV-14817 Server crashes in prep_alter_part_table()
--echo # after table lock and multiple add partition
--echo #
create table t1 (x int) partition by hash (x) (partition p1, partition p2);
lock table t1 write;
--error ER_SAME_NAME_PARTITION
alter table t1 add partition (partition p1);
@ -129,7 +171,7 @@ drop table t1;
--echo # ha_partition::update_row or `part_id == m_last_part' in
--echo # ha_partition::delete_row upon UPDATE/DELETE after dropping versioning
--echo #
create or replace table t1 (pk int, f int, primary key(pk, f)) engine=innodb
create table t1 (pk int, f int, primary key(pk, f)) engine=innodb
partition by key() partitions 2;
insert into t1 values (1,10),(2,11);
@ -142,3 +184,5 @@ select * from t1 partition(p0);
select * from t1 partition(p1);
delete from t1;
drop table t1;
--echo # End of 10.3 tests