summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2023-02-15 01:18:26 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2023-02-15 01:18:26 +0530
commit96a5b189dde2d6c588cdb009b113dac36f45857e (patch)
tree5985a9204bc70c44293d58faa7c3a8af2093a2ad
parent81faf41786cfcded18d5b20d341175367ef1453f (diff)
downloadmariadb-git-bb-104-thiru.tar.gz
MDEV-30615 Can't read from I_S.INNODB_SYS_INDEXES when having a discarded tablesacebb-104-thiru
- 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
-rw-r--r--mysql-test/suite/innodb/r/full_crc32_import.result7
-rw-r--r--mysql-test/suite/innodb/t/full_crc32_import.test6
-rw-r--r--storage/innobase/handler/i_s.cc8
3 files changed, 18 insertions, 3 deletions
diff --git a/mysql-test/suite/innodb/r/full_crc32_import.result b/mysql-test/suite/innodb/r/full_crc32_import.result
index 0cfcf6f4ddb..fdf361a6a43 100644
--- a/mysql-test/suite/innodb/r/full_crc32_import.result
+++ b/mysql-test/suite/innodb/r/full_crc32_import.result
@@ -173,6 +173,13 @@ UNLOCK TABLES;
SET GLOBAL innodb_compression_algorithm=0;
ALTER TABLE t1 FORCE;
ALTER TABLE t1 DISCARD TABLESPACE;
+# Display the discarded table name
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
+WHERE TABLE_ID IN (SELECT TABLE_ID FROM
+INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE
+PAGE_NO IS NULL and SPACE IS NULL);
+NAME
+test/t1
db.opt
t1.frm
restore: t1 .ibd and .cfg files
diff --git a/mysql-test/suite/innodb/t/full_crc32_import.test b/mysql-test/suite/innodb/t/full_crc32_import.test
index c9195111c05..c672554da30 100644
--- a/mysql-test/suite/innodb/t/full_crc32_import.test
+++ b/mysql-test/suite/innodb/t/full_crc32_import.test
@@ -195,6 +195,12 @@ SET GLOBAL innodb_compression_algorithm=0;
ALTER TABLE t1 FORCE;
ALTER TABLE t1 DISCARD TABLESPACE;
+--echo # Display the discarded table name
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
+ WHERE TABLE_ID IN (SELECT TABLE_ID FROM
+ INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE
+ PAGE_NO IS NULL and SPACE IS NULL);
+
--list_files $MYSQLD_DATADIR/test
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index bc9d24cd00f..f01c4162701 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -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));
}