Commit b7b58a23 authored by Yuchen Pei's avatar Yuchen Pei

MDEV-33731 Only iterate over m_locked_partitions in update_next_auto_inc_val()

Only locked will participate in the query in this case. Chances are
that not-locked partitions were not opened, which is the cause of the
crash in the added test case spider/bugfix.mdev_33731 without this
patch.
parent 7e3090a8
......@@ -10753,18 +10753,19 @@ int ha_partition::update_next_auto_inc_val()
bool ha_partition::need_info_for_auto_inc()
{
handler **file= m_file;
DBUG_ENTER("ha_partition::need_info_for_auto_inc");
do
for (uint i= bitmap_get_first_set(&m_locked_partitions);
i < m_tot_parts;
i= bitmap_get_next_set(&m_locked_partitions, i))
{
if ((*file)->need_info_for_auto_inc())
if ((m_file[i])->need_info_for_auto_inc())
{
/* We have to get new auto_increment values from handler */
part_share->auto_inc_initialized= FALSE;
DBUG_RETURN(TRUE);
}
} while (*(++file));
}
DBUG_RETURN(FALSE);
}
......
for master_1
for child2
for child3
CREATE TABLE t (a INT) ENGINE=Spider PARTITION BY LIST (a) PARTITIONS 2 (PARTITION p1 VALUES IN (0,1),PARTITION p2 VALUES IN (2,3));
DELETE FROM t PARTITION (p2);
ERROR HY000: Unable to connect to foreign data source: localhost
drop table t;
for master_1
for child2
for child3
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
CREATE TABLE t (a INT) ENGINE=Spider PARTITION BY LIST (a) PARTITIONS 2 (PARTITION p1 VALUES IN (0,1),PARTITION p2 VALUES IN (2,3));
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
DELETE FROM t PARTITION (p2);
drop table t;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment