diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2018-10-08 20:38:58 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2019-10-10 00:20:34 +0300 |
commit | c9cba59749e1b5a39a9e3a0a5b8bd762507245f9 (patch) | |
tree | 45a790e03450274fa1506bfcea2cb1bd0dc26284 /sql/ha_partition.h | |
parent | a92f3146d22cb3b290228c0e66eb1ea6c7b7c373 (diff) | |
download | mariadb-git-c9cba59749e1b5a39a9e3a0a5b8bd762507245f9.tar.gz |
MDEV-17333 Assertion in update_auto_increment() upon exotic LOAD
While `handler::next_insert_id` is restored on duplicate key errors
`part_share->next_auto_inc_val` is not restored which causes
discrepancy.
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r-- | sql/ha_partition.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h index d795502600f..0c945e5b317 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -92,6 +92,7 @@ public: bool auto_inc_initialized; mysql_mutex_t auto_inc_mutex; /**< protecting auto_inc val */ ulonglong next_auto_inc_val; /**< first non reserved value */ + ulonglong prev_auto_inc_val; /**< stored next_auto_inc_val */ /** Hash of partition names. Initialized in the first ha_partition::open() for the table_share. After that it is read-only, i.e. no locking required. @@ -103,6 +104,7 @@ public: Partition_share() : auto_inc_initialized(false), next_auto_inc_val(0), + prev_auto_inc_val(0), partition_name_hash_initialized(false), partition_names(NULL) { @@ -371,6 +373,19 @@ private: MY_BITMAP m_locked_partitions; /** Stores shared auto_increment etc. */ Partition_share *part_share; + /** Store and restore next_auto_inc_val over duplicate key errors. */ + virtual void store_auto_increment() + { + DBUG_ASSERT(part_share); + part_share->prev_auto_inc_val= part_share->next_auto_inc_val; + handler::store_auto_increment(); + } + virtual void restore_auto_increment() + { + DBUG_ASSERT(part_share); + part_share->next_auto_inc_val= part_share->prev_auto_inc_val; + handler::restore_auto_increment(); + } /** Temporary storage for new partitions Handler_shares during ALTER */ List<Parts_share_refs> m_new_partitions_share_refs; /** Sorted array of partition ids in descending order of number of rows. */ |