mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
a0f3b9f94f
Problem: ======== Server fails to notify the engine by not setting the ADD_PK_INDEX and DROP_PK_INDEX When there is a i) Change in candidate for primary key. ii) New candidate for primary key. Fix: ==== Server sets the ADD_PK_INDEX and DROP_PK_INDEX while doing alter for the above problematic case.
72 lines
2 KiB
Text
72 lines
2 KiB
Text
--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;
|