summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/instant_alter_debug.test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-08-14 19:34:33 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-08-14 19:34:33 +0300
commit021652ba5035c0bcf1da02fb81b59b88893f09bb (patch)
tree348baa72e92126608ae6a1c82d0c5b906a40f5a9 /mysql-test/suite/innodb/t/instant_alter_debug.test
parente10ca66bab04960688ccc2d3a3af4fbad7c06b02 (diff)
downloadmariadb-git-021652ba5035c0bcf1da02fb81b59b88893f09bb.tar.gz
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().
Diffstat (limited to 'mysql-test/suite/innodb/t/instant_alter_debug.test')
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_debug.test26
1 files changed, 26 insertions, 0 deletions
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;