summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-03-20 13:14:05 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-03-20 15:53:04 +0200
commitb8b3edff1376dc68c13d819470edfb33c339a64b (patch)
treead24c72c1dc79b8f294b47a934e24818981645c2 /storage/innobase
parentc9ec1cc751df936d3359e0705f4341a814b2b4fa (diff)
downloadmariadb-git-b8b3edff1376dc68c13d819470edfb33c339a64b.tar.gz
MDEV-21549 IMPORT TABLESPACE fails to adjust all tablespace ID in root pages
After MDEV-12353, the consistency check that I originally added for commit 1b9fe0bbac72d49a32863241b2b5081438b5f691 (InnoDB Plugin for MySQL 5.1) started randomly failing. It turns out that the IMPORT TABLESPACE code was always incorrect: it did not update the (redundantly stored) tablespace ID in index tree root pages. It only does that for page headers and BLOB pointers. PageConverter::update_index_page(): Update the tablespace ID in the BTR_SEG_TOP and BTR_SEG_LEAF of index root pages.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/row/row0import.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 751cd4e5293..ad7f77f6215 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1902,6 +1902,23 @@ PageConverter::update_index_page(
return(DB_SUCCESS);
}
+ if (m_index && block->page.id.page_no() == m_index->m_page_no) {
+ byte *b = FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + FSEG_HDR_SPACE
+ + page;
+ mach_write_to_4(b, block->page.id.space());
+
+ memcpy(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP + FSEG_HDR_SPACE
+ + page, b, 4);
+ if (UNIV_LIKELY_NULL(block->page.zip.data)) {
+ memcpy(&block->page.zip.data[FIL_PAGE_DATA
+ + PAGE_BTR_SEG_TOP
+ + FSEG_HDR_SPACE], b, 4);
+ memcpy(&block->page.zip.data[FIL_PAGE_DATA
+ + PAGE_BTR_SEG_LEAF
+ + FSEG_HDR_SPACE], b, 4);
+ }
+ }
+
#ifdef UNIV_ZIP_DEBUG
ut_a(!is_compressed_table()
|| page_zip_validate(m_page_zip_ptr, page, m_index->m_srv_index));