1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36817 Server crashes in do_mark_index_columns instead of

ER_DUP_ENTRY on partitioned table

Now as c1492f3d07 (MDEV-36115) restores m_last_part table->file
points to partition p0 while the error happens in p1, so error index
does not match ib_table in innobase_get_mysql_key_number_for_index().

This case is handled by separate code block in
innobase_get_mysql_key_number_for_index() which was wrong on using
secondary index for dict_index_is_auto_gen_clust() and it was not
covered by the tests.
This commit is contained in:
Aleksey Midenkov
2025-05-21 11:10:09 +03:00
parent fbd736c872
commit 1a95c2a4b2
3 changed files with 21 additions and 1 deletions

View File

@@ -1805,6 +1805,15 @@ insert into t values (1),(2);
DELETE from t; DELETE from t;
drop table t; drop table t;
# #
# MDEV-36817 Server crashes in do_mark_index_columns instead of
# ER_DUP_ENTRY on partitioned table
#
create table t (f int, unique(f)) engine=innodb partition by key (f) partitions 2;
insert into t (f) values (1), (3);
update t set f = 0;
ERROR 23000: Duplicate entry '0' for key 'f'
drop table t;
#
# End of 10.5 tests # End of 10.5 tests
# #
set global innodb_stats_persistent= @save_persistent; set global innodb_stats_persistent= @save_persistent;

View File

@@ -1583,6 +1583,16 @@ insert into t values (1),(2);
DELETE from t; DELETE from t;
drop table t; drop table t;
--echo #
--echo # MDEV-36817 Server crashes in do_mark_index_columns instead of
--echo # ER_DUP_ENTRY on partitioned table
--echo #
create table t (f int, unique(f)) engine=innodb partition by key (f) partitions 2;
insert into t (f) values (1), (3);
--error ER_DUP_ENTRY
update t set f = 0;
drop table t;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -14554,13 +14554,14 @@ innobase_get_mysql_key_number_for_index(
if (index->table != ib_table) { if (index->table != ib_table) {
i = 0; i = 0;
ind = dict_table_get_first_index(index->table); ind = dict_table_get_first_index(index->table);
const bool auto_gen_clust = dict_index_is_auto_gen_clust(ind);
while (index != ind) { while (index != ind) {
ind = dict_table_get_next_index(ind); ind = dict_table_get_next_index(ind);
i++; i++;
} }
if (dict_index_is_auto_gen_clust(index)) { if (auto_gen_clust) {
ut_a(i > 0); ut_a(i > 0);
i--; i--;
} }