1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-03 05:41:09 +03:00

Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä
2019-01-24 22:42:35 +02:00
83 changed files with 944 additions and 269 deletions

View File

@@ -0,0 +1,114 @@
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL,
UNIQUE KEY uidx2(f1,f2),
UNIQUE KEY uidx1(f2)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
`f2` int(11) NOT NULL,
UNIQUE KEY `uidx2` (`f1`,`f2`),
UNIQUE KEY `uidx1` (`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
SIGNAL conc_dml WAIT_FOR go_ahead';
ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE;
connect con1,localhost,root,,;
SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
DELETE FROM t1;
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f11` int(11) DEFAULT NULL,
`f2` int(11) NOT NULL,
UNIQUE KEY `uidx1` (`f2`),
UNIQUE KEY `uidx2` (`f11`,`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1(f1 INT, f2 INT,
PRIMARY KEY(f1, f2),
UNIQUE INDEX uidx2 (f1, f2),
UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB;
ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
`f2` int(11) NOT NULL,
UNIQUE KEY `uidx2` (`f1`,`f2`),
UNIQUE KEY `uidx1` (`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
SIGNAL conc_dml WAIT_FOR go_ahead';
ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE;
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
INSERT INTO t1 VALUES(1, 1), (1, 1);
ERROR 23000: Duplicate entry '1-1' for key 'uidx2'
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f11` int(11) DEFAULT NULL,
`f2` int(11) NOT NULL,
UNIQUE KEY `uidx1` (`f2`),
UNIQUE KEY `uidx2` (`f11`,`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET SQL_MODE= strict_trans_tables;
CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL;
connection con1;
SET DEBUG_SYNC='now WAIT_FOR dml';
BEGIN;
INSERT INTO t1 SET a=NULL;
ROLLBACK;
set DEBUG_SYNC='now SIGNAL dml_done';
connection default;
ERROR 22004: Invalid use of NULL value
DROP TABLE t1;
disconnect con1;
SET DEBUG_SYNC="RESET";
SET SQL_MODE=DEFAULT;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2),
UNIQUE KEY(f2))ENGINE=InnoDB;
ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
`f2` int(11) NOT NULL,
UNIQUE KEY `f2` (`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB;
Warnings:
Note 1831 Duplicate index `f2_2`. This is deprecated and will be disallowed in a future release
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
`f2` int(11) NOT NULL,
UNIQUE KEY `f2` (`f2`),
UNIQUE KEY `f2_2` (`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
`f2` int(11) NOT NULL,
UNIQUE KEY `f2_2` (`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;

View File

@@ -1571,6 +1571,7 @@ create table t1(f1 int not null, f2 int not null,
primary key (f1), unique key(f1, f2))engine=innodb;
insert into t1 values(1,3), (2,2);
alter table t1 drop primary key, lock=none;
alter table t1 drop index f1, lock=none;
ERROR 0A000: LOCK=NONE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try LOCK=SHARED
drop table t1;
#

View File

@@ -99,17 +99,6 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `c2` (`c2`),
UNIQUE KEY `c2_2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPY
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
`c3` char(255) NOT NULL,
UNIQUE KEY `c2` (`c2`),
UNIQUE KEY `c2_2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1);
# session default
connection default;

View File

@@ -0,0 +1,9 @@
create table t1 (a int) engine=innodb;
insert t1 values (1),(2);
create database ib_logfile2;
select * from t1;
a
1
2
drop table t1;
drop database ib_logfile2;

View File

@@ -0,0 +1,72 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL,
UNIQUE KEY uidx2(f1,f2),
UNIQUE KEY uidx1(f2)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 1);
SHOW CREATE TABLE t1;
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
SIGNAL conc_dml WAIT_FOR go_ahead';
--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE
connect (con1,localhost,root,,);
SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
DELETE FROM t1;
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
reap;
SHOW CREATE TABLE t1;
CHECK TABLE t1;
DROP TABLE t1;
CREATE TABLE t1(f1 INT, f2 INT,
PRIMARY KEY(f1, f2),
UNIQUE INDEX uidx2 (f1, f2),
UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB;
ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1;
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter
SIGNAL conc_dml WAIT_FOR go_ahead';
--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR conc_dml';
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES(1, 1), (1, 1);
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
connection default;
reap;
SHOW CREATE TABLE t1;
CHECK TABLE t1;
DROP TABLE t1;
SET SQL_MODE= strict_trans_tables;
CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
--send ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL
connection con1;
SET DEBUG_SYNC='now WAIT_FOR dml';
BEGIN;
INSERT INTO t1 SET a=NULL;
ROLLBACK;
set DEBUG_SYNC='now SIGNAL dml_done';
connection default;
--error ER_INVALID_USE_OF_NULL
reap;
DROP TABLE t1;
disconnect con1;
SET DEBUG_SYNC="RESET";
SET SQL_MODE=DEFAULT;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2),
UNIQUE KEY(f2))ENGINE=InnoDB;
ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB;
SHOW CREATE TABLE t1;
ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
DROP TABLE t1;

View File

@@ -905,8 +905,9 @@ drop table t1;
create table t1(f1 int not null, f2 int not null,
primary key (f1), unique key(f1, f2))engine=innodb;
insert into t1 values(1,3), (2,2);
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t1 drop primary key, lock=none;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t1 drop index f1, lock=none;
drop table t1;
--echo #

View File

@@ -101,10 +101,6 @@ LOCK = SHARED, ALGORITHM = INPLACE;
ALTER TABLE t1 ADD UNIQUE INDEX(c2),
LOCK = EXCLUSIVE, ALGORITHM = INPLACE;
SHOW CREATE TABLE t1;
# We do not support plain DROP_PK_INDEX without ADD_PK_INDEX.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE;
SHOW CREATE TABLE t1;
# Now the previous DEBUG_SYNC should kick in.
--send

View File

@@ -0,0 +1,12 @@
#
# Bug#28867993: POSSIBLE ISSUE WITH MYSQL SERVER RESTART
#
source include/have_innodb.inc;
create table t1 (a int) engine=innodb;
insert t1 values (1),(2);
create database ib_logfile2;
source include/restart_mysqld.inc;
select * from t1;
drop table t1;
drop database ib_logfile2;