From 021652ba5035c0bcf1da02fb81b59b88893f09bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 14 Aug 2018 19:34:33 +0300 Subject: MDEV-15872 Crash in online ALTER TABLE...ADD PRIMARY KEY after instant ADD COLUMN...NULL row_log_table_get_pk_col(): Replace a condition that was inadvertently removed in MDEV-16365. PRIMARY KEY columns are never allowed to be NULL, and failure to enforce the constraint caused a null pointer to be dereferenced in mem_heap_dup(). --- mysql-test/suite/innodb/t/instant_alter_debug.test | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'mysql-test/suite/innodb/t') diff --git a/mysql-test/suite/innodb/t/instant_alter_debug.test b/mysql-test/suite/innodb/t/instant_alter_debug.test index 5a73ed65d72..cab9decd3d0 100644 --- a/mysql-test/suite/innodb/t/instant_alter_debug.test +++ b/mysql-test/suite/innodb/t/instant_alter_debug.test @@ -234,6 +234,32 @@ SET DEBUG_SYNC = 'now SIGNAL logged'; connection ddl; reap; + +connection default; +SET DEBUG_SYNC = RESET; +SELECT * FROM t1; + +--echo # +--echo # MDEV-15872 Crash in online ALTER TABLE...ADD PRIMARY KEY +--echo # after instant ADD COLUMN ... NULL +--echo # +ALTER TABLE t1 ADD COLUMN d INT, ALGORITHM=INSTANT; +UPDATE t1 SET d=1; + +connection ddl; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL copied WAIT_FOR logged'; +send ALTER IGNORE TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY (a,d); + +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR copied'; +BEGIN; +INSERT INTO t1 SET a=3; +ROLLBACK; +SET DEBUG_SYNC = 'now SIGNAL logged'; + +connection ddl; +--error ER_INVALID_USE_OF_NULL +reap; disconnect ddl; connection default; -- cgit v1.2.1