mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-30615 Can't read from I_S.INNODB_SYS_INDEXES when having a discarded tablesace
- MY_I_S_MAYBE_NULL field attributes is added PAGE_NO and SPACE in innodb_sys_index table. By doing this, InnoDB can set null for these fields when it encounters discarded tablespace
This commit is contained in:
@ -173,6 +173,17 @@ UNLOCK TABLES;
|
||||
SET GLOBAL innodb_compression_algorithm=0;
|
||||
ALTER TABLE t1 FORCE;
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
# Display the discarded table name by using SPACE and PAGE_NO
|
||||
# column in INNODB_SYS_INDEXES and discard doesn't affect the
|
||||
# SPACE in INNODB_SYS_TABLES
|
||||
SELECT t.NAME, t.SPACE BETWEEN 1 and 0xFFFFFFEF as SYS_TABLE_SPACE_RANGE
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t
|
||||
WHERE t.TABLE_ID IN (
|
||||
SELECT i.TABLE_ID FROM
|
||||
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE
|
||||
i.PAGE_NO IS NULL and i.SPACE IS NULL);
|
||||
NAME SYS_TABLE_SPACE_RANGE
|
||||
test/t1 1
|
||||
db.opt
|
||||
t1.frm
|
||||
restore: t1 .ibd and .cfg files
|
||||
|
@ -195,6 +195,16 @@ SET GLOBAL innodb_compression_algorithm=0;
|
||||
ALTER TABLE t1 FORCE;
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
|
||||
--echo # Display the discarded table name by using SPACE and PAGE_NO
|
||||
--echo # column in INNODB_SYS_INDEXES and discard doesn't affect the
|
||||
--echo # SPACE in INNODB_SYS_TABLES
|
||||
SELECT t.NAME, t.SPACE BETWEEN 1 and 0xFFFFFFEF as SYS_TABLE_SPACE_RANGE
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t
|
||||
WHERE t.TABLE_ID IN (
|
||||
SELECT i.TABLE_ID FROM
|
||||
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE
|
||||
i.PAGE_NO IS NULL and i.SPACE IS NULL);
|
||||
|
||||
--list_files $MYSQLD_DATADIR/test
|
||||
perl;
|
||||
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
||||
|
@ -5430,10 +5430,10 @@ static ST_FIELD_INFO innodb_sysindex_fields_info[]=
|
||||
0, 0, "", SKIP_OPEN_TABLE},
|
||||
#define SYS_INDEX_PAGE_NO 5
|
||||
{"PAGE_NO", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG,
|
||||
0, 0, "", SKIP_OPEN_TABLE},
|
||||
0, MY_I_S_MAYBE_NULL, "", SKIP_OPEN_TABLE},
|
||||
#define SYS_INDEX_SPACE 6
|
||||
{"SPACE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG,
|
||||
0, 0, "", SKIP_OPEN_TABLE},
|
||||
0, MY_I_S_MAYBE_NULL, "", SKIP_OPEN_TABLE},
|
||||
#define SYS_INDEX_MERGE_THRESHOLD 7
|
||||
{"MERGE_THRESHOLD", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG,
|
||||
0, 0, "", SKIP_OPEN_TABLE},
|
||||
@ -5483,12 +5483,14 @@ i_s_dict_fill_sys_indexes(
|
||||
if (index->page == FIL_NULL) {
|
||||
fields[SYS_INDEX_PAGE_NO]->set_null();
|
||||
} else {
|
||||
fields[SYS_INDEX_PAGE_NO]->set_notnull();
|
||||
OK(fields[SYS_INDEX_PAGE_NO]->store(index->page, true));
|
||||
}
|
||||
|
||||
if (space_id == ULINT_UNDEFINED) {
|
||||
if (space_id == FIL_NULL) {
|
||||
fields[SYS_INDEX_SPACE]->set_null();
|
||||
} else {
|
||||
fields[SYS_INDEX_SPACE]->set_notnull();
|
||||
OK(fields[SYS_INDEX_SPACE]->store(space_id, true));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user