summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-07-13 23:31:16 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-07-13 23:31:16 +0530
commitffc41e1cf56809f82e97daad4869fecac4b46fed (patch)
treeb1ccdd7996147798d9b006d089ff89fbe85b6638
parent79016c9e2db6036b1f94b31cb9bb4a713aef39c6 (diff)
downloadmariadb-git-bb-10.6-MDEV-26131.tar.gz
MDEV-26131 SEGV in ha_innobase::discard_or_import_tablespacebb-10.6-MDEV-26131
- InnoDB aborts the server if the index is marked as corrupted while importing the tablespace. InnoDB should open the table using DICT_ERR_IGNORE_ALL mode during import of tablespace.
-rw-r--r--storage/innobase/dict/dict0dict.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc18
-rw-r--r--storage/innobase/include/dict0dict.h11
3 files changed, 20 insertions, 11 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 9c4eb741bad..d5aec4d3224 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -215,7 +215,7 @@ dict_remove_db_name(
@param[in] cached_only whether to skip loading
@return persistent table
@retval NULL if not found */
-static dict_table_t* dict_table_open_on_id_low(
+dict_table_t* dict_table_open_on_id_low(
table_id_t table_id,
dict_err_ignore_t ignore_err,
bool cached_only)
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2a91106ba22..2c0e5c0d4fc 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -13280,17 +13280,15 @@ ha_innobase::discard_or_import_tablespace(
dict_sys.mutex_lock();
dict_table_close(m_prebuilt->table, TRUE, FALSE);
dict_sys.remove(m_prebuilt->table);
- m_prebuilt->table = dict_table_open_on_id(id, TRUE,
- DICT_TABLE_OP_NORMAL);
+ m_prebuilt->table = dict_table_open_on_id_low(
+ id, DICT_ERR_IGNORE_ALL, false);
+ m_prebuilt->table->acquire();
dict_sys.mutex_unlock();
- if (!m_prebuilt->table) {
- err = DB_TABLE_NOT_FOUND;
- } else {
- if (const Field* ai = table->found_next_number_field) {
- initialize_auto_increment(m_prebuilt->table, ai);
- }
- dict_stats_init(m_prebuilt->table);
- }
+
+ if (const Field* ai = table->found_next_number_field)
+ initialize_auto_increment(m_prebuilt->table, ai);
+
+ dict_stats_init(m_prebuilt->table);
if (dict_stats_is_persistent_enabled(m_prebuilt->table)) {
dberr_t ret;
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 3c0e93edc8f..14b7a5df6a5 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -152,6 +152,17 @@ dict_table_open_on_id(table_id_t table_id, bool dict_locked,
MDL_ticket **mdl= nullptr)
MY_ATTRIBUTE((warn_unused_result));
+/** Open a persistent table.
+@param[in] table_id persistent table identifier
+@param[in] ignore_err errors to ignore
+@param[in] cached_only whether to skip loading
+@return persistent table
+@retval NULL if not found */
+dict_table_t* dict_table_open_on_id_low(
+ table_id_t table_id,
+ dict_err_ignore_t ignore_err,
+ bool cached_only);
+
/** Decrements the count of open handles of a table.
@param[in,out] table table
@param[in] dict_locked data dictionary locked