summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-05-07 15:30:57 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-05-07 15:39:29 +0300
commite44ca6cc9c300cbdf93c64110bd8cf2be8125379 (patch)
treea50f01c1052e8736ba4b0ca53ef91edcd972b65c /mysql-test
parentd257c425f2cc8bcc3f042bad51aefba5c2e76fed (diff)
downloadmariadb-git-e44ca6cc9c300cbdf93c64110bd8cf2be8125379.tar.gz
MDEV-14825 Assertion `col->ord_part' in row_build_index_entry_low upon ROLLBACK or DELETE with concurrent ALTER on partitioned table
If creating a secondary index fails (typically, ADD UNIQUE INDEX fails due to duplicate key), it is possible that concurrently running UPDATE or DELETE will access the index stub and hit the debug assertion. It does not make any sense to keep updating an uncommitted index whose creation has failed. dict_index_t::is_corrupted(): Replaces dict_index_is_corrupted(). Also take online_status into account. Replace some calls to dict_index_is_clust() with calls to dict_index_t::is_primary().
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/innodb/r/alter_partitioned_debug.result27
-rw-r--r--mysql-test/suite/innodb/t/alter_partitioned_debug.test34
2 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/alter_partitioned_debug.result b/mysql-test/suite/innodb/r/alter_partitioned_debug.result
new file mode 100644
index 00000000000..d2ec602c6d7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_partitioned_debug.result
@@ -0,0 +1,27 @@
+CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=InnoDB
+PARTITION BY RANGE(a)
+(PARTITION pa VALUES LESS THAN (3),
+PARTITION pb VALUES LESS THAN (5));
+INSERT INTO t1 VALUES(2,'two'),(2,'two'),(4,'four');
+connect ddl,localhost,root,,test;
+SET DEBUG_SYNC = 'inplace_after_index_build SIGNAL go WAIT_FOR done';
+ALTER TABLE t1 ADD UNIQUE KEY (a,b(3));
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR go';
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+a b
+2 two
+2 two
+4 four
+SET DEBUG_SYNC = 'now SIGNAL done';
+connection ddl;
+ERROR 23000: Duplicate entry '2-two' for key 'a'
+connection default;
+DELETE FROM t1;
+disconnect ddl;
+SET DEBUG_SYNC = 'RESET';
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/alter_partitioned_debug.test b/mysql-test/suite/innodb/t/alter_partitioned_debug.test
new file mode 100644
index 00000000000..34565e12036
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_partitioned_debug.test
@@ -0,0 +1,34 @@
+--source include/have_innodb.inc
+--source include/have_partition.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=InnoDB
+PARTITION BY RANGE(a)
+(PARTITION pa VALUES LESS THAN (3),
+PARTITION pb VALUES LESS THAN (5));
+
+INSERT INTO t1 VALUES(2,'two'),(2,'two'),(4,'four');
+
+connect ddl,localhost,root,,test;
+SET DEBUG_SYNC = 'inplace_after_index_build SIGNAL go WAIT_FOR done';
+send ALTER TABLE t1 ADD UNIQUE KEY (a,b(3));
+
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR go';
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+SET DEBUG_SYNC = 'now SIGNAL done';
+
+connection ddl;
+--error ER_DUP_ENTRY
+reap;
+
+connection default;
+DELETE FROM t1;
+disconnect ddl;
+
+SET DEBUG_SYNC = 'RESET';
+
+CHECK TABLE t1;
+DROP TABLE t1;