[MDEV-16416] Crash on IMPORT TABLESPACE of a ROW_FORMAT=COMPRESSED table Created: 2018-06-07  Updated: 2018-06-07  Resolved: 2018-06-07

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Storage Engine - XtraDB
Affects Version/s: 10.1.7, 10.2.0, 10.3.0
Fix Version/s: 10.1.34, 10.2.16, 10.3.8

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: crash, encryption

Issue Links:
Problem/Incident
is caused by MDEV-8708 InnoDB temp file encryption Closed
Relates
relates to MDEV-15032 Encrypted database created on big end... Closed

 Description   

The function fil_iterate() that implements ALTER TABLE…IMPORT TABLESPACE is passing a wrong parameter to fil_encrypt_buf() when ROW_FORMAT=COMPRESSED is used together with a KEY_BLOCK_SIZE that equals to innodb_page_size/1024 (that is, the logical page size is equal to the physical page size).
This will result in a large amount of error messages like this, during the import operation:

10.1 1d4e1d3263bf3b87b473c12d4876f368dc3450b6

2018-06-07 10:19:36 140577841662720 [Note] InnoDB: Phase I - Update all pages
2018-06-07 10:19:36 140577841662720 [Note] InnoDB: Sync to disk
2018-06-07 10:19:36 140577841662720 [Note] InnoDB: Sync to disk - done!
2018-06-07 10:19:36 140577841662720 [ERROR] InnoDB: The page [page id: space=6, page number=1] in file test/t3 cannot be decrypted.
2018-06-07 10:19:36 140577841662720 [Note] InnoDB: However key management plugin or used key_version 1 is not found or used encryption algorithm or method does not match.
2018-06-07 10:19:36 140577841662720 [Note] InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.
2018-06-07 10:19:36 140577841662720 [ERROR] InnoDB: The page [page id: space=6, page number=1] in file test/t3 cannot be decrypted.
2018-06-07 10:19:36 140577841662720 [Note] InnoDB: However key management plugin or used key_version 1 is not found or used encryption algorithm or method does not match.
2018-06-07 10:19:36 140577841662720 [Note] InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.
2018-06-07 10:19:36 7fdad450cb00  InnoDB: Assertion failure in thread 140577841662720 in file buf0buf.cc line 2893
InnoDB: We intentionally generate a memory trap.

The assertion failure that occurs is only present in a debug build. A non-debug build would likely crash due to buf_page_get_gen() having returned NULL after the decryption failure:

#6  0x00007fdad6bde3c8 in buf_block_align (ptr=0x0) at /mariadb/10.1/storage/innobase/buf/buf0buf.cc:2893
#7  0x00007fdad6d3200e in mtr_memo_contains_page (mtr=0x7fdad45097b0, ptr=0x0, type=2) at /mariadb/10.1/storage/innobase/mtr/mtr0mtr.cc:420
#8  0x00007fdad6cf2dc1 in ibuf_bitmap_page_get_bits_low (page=0x0, page_no=2, zip_size=16384, latch_type=2, mtr=0x7fdad45097b0, bit=3) at /mariadb/10.1/storage/innobase/ibuf/ibuf0ibuf.cc:740
#9  0x00007fdad6cfbc38 in ibuf_check_bitmap_on_import (trx=0x7fda8c0d4f98, space_id=6) at /mariadb/10.1/storage/innobase/ibuf/ibuf0ibuf.cc:5183
#10 0x00007fdad6d8e39c in row_import_for_mysql (table=0x7fda8c0219e8, prebuilt=0x7fda8c0cc998) at /mariadb/10.1/storage/innobase/row/row0import.cc:4042


Generated at Thu Feb 08 08:28:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.