Skip to content

Commit 56e4b01

Browse files
committed
MDEV-35419 Server crashes when a adding column to the table which has a primary key using hash
correct the assert. followup for 062f8eb
1 parent a826e6d commit 56e4b01

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

mysql-test/suite/innodb/r/alter_primary_key.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,10 @@ ab
2828
ac
2929
DROP TABLE t0,t1;
3030
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
31+
#
32+
# MDEV-35419 Server crashes when a adding column to the table which has a primary key using hash
33+
#
34+
create table t1 (a int,primary key using hash (a)) engine=innodb;
35+
alter table t1 add b int;
36+
drop table t1;
37+
# End of 11.7 tests

mysql-test/suite/innodb/t/alter_primary_key.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,14 @@ SELECT * FROM t1;
3636
DROP TABLE t0,t1;
3737

3838
--source include/test_db_charset_restore.inc
39+
40+
--echo #
41+
--echo # MDEV-35419 Server crashes when a adding column to the table which has a primary key using hash
42+
--echo #
43+
# it's not really using hash, it ignores the declaration
44+
# for ALTER from MEMORY and back to be possible
45+
create table t1 (a int,primary key using hash (a)) engine=innodb;
46+
alter table t1 add b int;
47+
drop table t1;
48+
49+
--echo # End of 11.7 tests

storage/innobase/handler/handler0alter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3884,7 +3884,7 @@ innobase_create_index_def(
38843884
index->rebuild = new_clustered;
38853885

38863886
if (key_clustered) {
3887-
DBUG_ASSERT(key->algorithm <= HA_KEY_ALG_BTREE);
3887+
DBUG_ASSERT(key->algorithm <= HA_KEY_ALG_HASH);
38883888
DBUG_ASSERT(key->flags & HA_NOSAME);
38893889
index->ind_type = DICT_CLUSTERED | DICT_UNIQUE;
38903890
} else if (key->algorithm == HA_KEY_ALG_FULLTEXT) {

0 commit comments

Comments
 (0)