Commit c026e2c0 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15507 Assertion failed in dict_check_sys_tables on upgrade from 5.5

The InnoDB system table column SYS_TABLES.MIX_LEN was repurposed
in InnoDB Plugin for MySQL 5.1, in
commit 91111174 (MySQL 5.1.46).
Until MySQL 5.6, it only contained a flag DICT_TF2_TEMPORARY.

MySQL 5.6 introduced a number of flags that were transient
in nature. One of these was introduced in 5.6.5, originally
called DICT_TF2_USE_TABLESPACE and later renamed to
DICT_TF2_USE_FILE_PER_TABLE. MySQL 5.7.6 introduced logic
that insists that the flag be set for any table that does not
reside in a shared tablespace, breaking upgrade from MySQL 5.5.

MariaDB does not support shared tablespaces other than the
InnoDB system tablespace. Also, some dependencies on
SYS_TABLES.MIX_LEN were removed in an earlier fix:
MDEV-13084 MariaDB 10.2 crashes on corrupted SYS_TABLES.MIX_LEN field
(commit e813fe86).

dict_check_sys_tables(): Remove a bogus debug assertion, and add a
comment that explains how DICT_TF2_USE_FILE_PER_TABLE is used.

dict_table_is_file_per_table(): Remove a bogus debug assertion.
parent f033fbd9
......@@ -1436,12 +1436,13 @@ dict_check_sys_tables(
continue;
}
/* If the table is not a predefined tablespace then it must
be in a file-per-table tablespace.
Note that flags2 is not available for REDUNDANT tables,
so don't check those. */
ut_ad(!DICT_TF_GET_COMPACT(flags)
|| flags2 & DICT_TF2_USE_FILE_PER_TABLE);
/* For tables or partitions using .ibd files, the flag
DICT_TF2_USE_FILE_PER_TABLE was not set in MIX_LEN
before MySQL 5.6.5. The flag should not have been
introduced in persistent storage. MariaDB will keep
setting the flag when writing SYS_TABLES entries for
newly created or rebuilt tables or partitions, but
will otherwise ignore the flag. */
/* Now that we have the proper name for this tablespace,
look to see if it is already in the tablespace cache. */
......
......@@ -1534,16 +1534,7 @@ bool
dict_table_is_file_per_table(
const dict_table_t* table) /*!< in: table to check */
{
bool is_file_per_table =
!is_system_tablespace(table->space);
/* If the table is file-per-table and it is not redundant, then
it should have the flags2 bit for DICT_TF2_USE_FILE_PER_TABLE. */
ut_ad(!is_file_per_table
|| !DICT_TF_GET_COMPACT(table->flags)
|| DICT_TF2_FLAG_IS_SET(table, DICT_TF2_USE_FILE_PER_TABLE));
return(is_file_per_table);
return !is_system_tablespace(table->space);
}
/** Get reference count.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment