diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index 8e255e18bec..1030fbd0502 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -8,6 +8,7 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .*"); call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file"); call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); +call mtr.add_suppression("InnoDB: Unknown index id .* on page"); FLUSH TABLES; SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test index f72935ebc3c..536bf4bff26 100644 --- a/mysql-test/suite/innodb/t/innodb-alter.test +++ b/mysql-test/suite/innodb/t/innodb-alter.test @@ -583,10 +583,14 @@ DROP TABLE t1, parent; --echo #BUG#21514135 SCHEMA MISMATCH ERROR WHEN IMPORTING TABLESPACE AFTER --echo #DROPPING AN INDEX --echo # + +--disable_query_log +call mtr.add_suppression("\\[Warning\\] InnoDB: Unknown index id .* on page"); +--enable_query_log + let $source_db = source_db; let $dest_db = dest_db; ---source include/default_charset.inc SET NAMES utf8mb4; eval CREATE DATABASE $source_db; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test index 07c2adeb550..a22afc041b0 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test @@ -28,6 +28,7 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .*"); call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file"); call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS="); +call mtr.add_suppression("InnoDB: Unknown index id .* on page"); FLUSH TABLES; let MYSQLD_DATADIR =`SELECT @@datadir`; diff --git a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result index 15227e9d6d3..fccee685caf 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result @@ -3,6 +3,12 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* becau call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file"); call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x"); +call mtr.add_suppression("InnoDB: Unknown index id .* on page"); +call mtr.add_suppression("InnoDB: Operating system error number"); +call mtr.add_suppression("InnoDB: The error means"); +call mtr.add_suppression("InnoDB: If you are installing InnoDB"); +call mtr.add_suppression("InnoDB: Cannot open datafile .*t1\\.ibd"); +call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`\\.`t1`"); FLUSH TABLES; SET SESSION innodb_strict_mode=1; CREATE TABLE t1 (c1 INT) ENGINE = Innodb diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test index 9529045785f..282469f0a0c 100644 --- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test @@ -19,6 +19,12 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* becau call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file"); call mtr.add_suppression("InnoDB: Page for tablespace "); call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x"); +call mtr.add_suppression("InnoDB: Unknown index id .* on page"); +call mtr.add_suppression("InnoDB: Operating system error number"); +call mtr.add_suppression("InnoDB: The error means"); +call mtr.add_suppression("InnoDB: If you are installing InnoDB"); +call mtr.add_suppression("InnoDB: Cannot open datafile .*t1\\.ibd"); +call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`\\.`t1`"); FLUSH TABLES; let MYSQLD_DATADIR =`SELECT @@datadir`; diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 8376fbb4ba6..ea961823354 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2020, MariaDB Corporation. +Copyright (c) 2015, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1880,38 +1880,33 @@ dberr_t PageConverter::update_index_page( buf_block_t* block) UNIV_NOTHROW { - index_id_t id; - buf_frame_t* page = block->frame; const page_id_t page_id(block->page.id()); if (is_free(page_id.page_no())) { return(DB_SUCCESS); - } else if ((id = btr_page_get_index_id(page)) != m_index->m_id) { + } - row_index_t* index = find_index(id); + buf_frame_t* page = block->frame; + const index_id_t id = btr_page_get_index_id(page); + + if (id != m_index->m_id) { + row_index_t* index = find_index(id); if (UNIV_UNLIKELY(!index)) { - ib::error() << "Page for tablespace " << m_space - << " is index page with id " << id - << " but that index is not found from" - << " configuration file. Current index name " - << m_index->m_name << " and id " << m_index->m_id; - m_index = 0; - return(DB_CORRUPTION); + ib::warn() << "Unknown index id " << id + << " on page " << page_id.page_no(); + return DB_SUCCESS; } - /* Update current index */ m_index = index; } /* If the .cfg file is missing and there is an index mismatch then ignore the error. */ - if (m_cfg->m_missing && (m_index == 0 || m_index->m_srv_index == 0)) { + if (m_cfg->m_missing && !m_index->m_srv_index) { return(DB_SUCCESS); } - - if (m_index && page_id.page_no() == m_index->m_page_no) { byte *b = FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + FSEG_HDR_SPACE + page;