diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2022-08-19 11:24:51 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2022-09-27 15:27:34 +0400 |
commit | b2cfcf1d1f260756cceb4f19e330b4955c381f98 (patch) | |
tree | 11905534cf733c2b44943dd26119a4e61a6e048b /sql | |
parent | 47e967898283a1fef44a7b84467cf26ff6bd63a3 (diff) | |
download | mariadb-git-b2cfcf1d1f260756cceb4f19e330b4955c381f98.tar.gz |
MDEV-21134 Crash with partitioned table, PARTITION syntax, and index_merge.
When the partition table is cloned, the handlers for the partitions that were not opened
should anyway be created (but not opened).
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_partition.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 0a8cf3b9532..1b265d7e05f 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3637,7 +3637,22 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) for (i= 0; i < m_tot_parts; i++) { if (!bitmap_is_set(&m_is_clone_of->m_opened_partitions, i)) + { + /* Here we should just create the handler instance, not open it. */ + if (!(m_file[i]= get_new_handler(table->s, m_clone_mem_root, + file[i]->ht))) + { + error= HA_ERR_INITIALIZATION; + file= &m_file[i]; + goto err_handler; + } + if (m_file[i]->set_ha_share_ref(file[i]->ha_share)) + { + error= HA_ERR_INITIALIZATION; + goto err_handler; + } continue; + } if (unlikely((error= create_partition_name(name_buff, sizeof(name_buff), name, name_buffer_ptr, |