diff options
author | Nikita Malyavin <nikitamalyavin@gmail.com> | 2020-04-02 22:37:36 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 22:37:36 +1000 |
commit | 9149017bb838e9efbef40c5f2807894c38b3412f (patch) | |
tree | 2a0ac6313b38ed105981fbd3fb5969999ce5e219 /sql/sql_partition.cc | |
parent | b40b3720cbba133ee76ef336bf89bbf5c03ac403 (diff) | |
download | mariadb-git-9149017bb838e9efbef40c5f2807894c38b3412f.tar.gz |
MDEV-17091 - Assertion failed after dropping versioning
Assertion `old_part_id == m_last_part' failed in ha_partition::update_row or `part_id == m_last_part' in ha_partition::delete_row upon UPDATE/DELETE after dropping versioning
PRIMARY KEY change hadn't been treated as partition reorganization in case of partitioning by KEY() (without parameters).
* set `*partition_changed= true` in the described case.
* since add/drop system versioning does not affect alter_info->key_list, it required separate attention
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index febd88c4b9b..5fdca153ef7 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -6016,6 +6016,24 @@ the generated partition syntax in a correct manner. *partition_changed= true; } } + + // In case of PARTITION BY KEY(), check if primary key has changed + // System versioning also implicitly adds/removes primary key parts + if (alter_info->partition_flags == 0 && part_info->list_of_part_fields + && part_info->part_field_list.elements == 0) + { + if (alter_info->flags & (ALTER_DROP_SYSTEM_VERSIONING | + ALTER_ADD_SYSTEM_VERSIONING)) + *partition_changed= true; + + List_iterator<Key> it(alter_info->key_list); + Key *key; + while((key= it++) && !*partition_changed) + { + if (key->type == Key::PRIMARY) + *partition_changed= true; + } + } /* Set up partition default_engine_type either from the create_info or from the previus table |