Bug #77321 Import tablespace may fail with invalid corruption error
Submitted: 11 Jun 2015 18:04 Modified: 22 Sep 2015 13:32
Reporter: Santosh Praneeth Banda Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.6.23 OS:Any
Assigned to: CPU Architecture:Any

[11 Jun 2015 18:04] Santosh Praneeth Banda
Description:
While importing a tablespace using the command "Alter table t1 import tablespace;" we are hitting the following error sometimes

InnoDB: Discarding tablespace of table "test"."t1": Data structure corruption

Investigating the error, we found the following check in PageConverter::validate() is failing

  const byte*     b = page;
  const byte*     e = b + m_page_size;

  /* If the page number is zero and offset > 0 then
  the entire page MUST consist of zeroes. If not then
  we flag it as corrupt. */
                
  while (b != e) {

   if (*b++ && !trigger_corruption()) {
     return(IMPORT_PAGE_STATUS_CORRUPTED);
   } 
  }

The checksum fields were not zero in the page. In the same function, the checksums were validated using buf_page_is_corrupted(). So i think the page is really not corrupted.

How to repeat:
don't know

Suggested fix:
Leave checksum bytes out the check in PageConverter::validate()

--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -2095,12 +2095,16 @@ PageConverter::validate(
                return(IMPORT_PAGE_STATUS_CORRUPTED);
 
        } else if (offset > 0 && page_get_page_no(page) == 0) {
-               const byte*     b = page;
-               const byte*     e = b + m_page_size;
+               const byte*     b = page + FIL_PAGE_OFFSET;
+               const byte*     e = b + m_page_size
+                                   - FIL_PAGE_OFFSET
+                                   - FIL_PAGE_END_LSN_OLD_CHKSUM;
[12 Jun 2015 14:09] MySQL Verification Team
Hi,

Thank you so much for your report.

In order to verify the bug and plan it for fixing, we need a fully repeatable test case.

Hence, what we need from you are files and description of the exact steps to be taken in order to repeat the bug, as you observe it. So, please, upload the necessary files and describe exactly what we should do in order to receive the same error that you received.

Thanks in advance.
[13 Jul 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[18 Sep 2015 2:09] Shaohua Wang
Posted by developer:
 
Issue a warning instead of returning an error if the checksum of an empty page is non-zero.
[22 Sep 2015 13:32] Daniel Price
Fixed as of the upcoming 5.6.28, 5.7.10, 5.8.0 release, and here's the changelog entry:

InnoDB returned an invalid corruption-related error message during an
IMPORT TABLESPACE operation. 

Thank you for the bug report.
[22 Sep 2015 13:33] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.6.28, 5.7.10, 5.8.0 release, and here's the changelog entry:

InnoDB returned an invalid corruption-related error message during an
IMPORT TABLESPACE operation. 

Thank you for the bug report.