summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorShunsuke Tokunaga <tkngsnsk313320@gmail.com>2022-06-16 13:28:24 +0900
committerGitHub <noreply@github.com>2022-06-16 13:28:24 +0900
commitc4f65d8fed16370deae85115490fc0c06da2ce84 (patch)
treec61e321ea34d38fd875a4c0e4eb5ec5388b9b7c6 /sql/ha_partition.cc
parentf31e935c3e0649d36008ab440cd87cb7ff474bb3 (diff)
downloadmariadb-git-c4f65d8fed16370deae85115490fc0c06da2ce84.tar.gz
MDEV-21027 Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed in ha_partition::set_auto_increment_if_higher
ha_partition::set_auto_increment_if_higher expects part_share->auto_inc_initialized is true or can_use_for_auto_inc_init() is false (but as the comment of this method says, it returns false only if we use Spider engine with DROP TABLE or ALTER TABLE query). However, part_share->auto_inc_initialized becomes true only after all partitions are opened (since 6dce6aecebe6ef78a14cb5c5c5daa8a355551e40). Therefore, I added a conditional expression in order to read all partitions when we execute REPLACE on a table that has an AUTO_INCREMENT column. Reviewed by: Nayuta Yanagisawa Reviewed by: Alexey Botchkov
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 48c479070a5..5c08c934dde 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3661,7 +3661,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
}
else
{
- check_insert_autoincrement();
+ check_insert_or_replace_autoincrement();
if (unlikely((error= open_read_partitions(name_buff, sizeof(name_buff)))))
goto err_handler;
m_num_locks= m_file_sample->lock_count();
@@ -8666,7 +8666,7 @@ int ha_partition::change_partitions_to_open(List<String> *partition_names)
return 0;
}
- check_insert_autoincrement();
+ check_insert_or_replace_autoincrement();
if (bitmap_cmp(&m_opened_partitions, &m_part_info->read_partitions) != 0)
return 0;