[MDEV-30615] Can't read from I_S.INNODB_SYS_INDEXES when having a discarded tablesace Created: 2023-02-08  Updated: 2023-02-16  Resolved: 2023-02-16

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.11.1, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3
Fix Version/s: 10.11.2, 10.4.29, 10.5.20, 10.6.13, 10.8.8, 10.9.6, 10.10.4

Type: Bug Priority: Major
Reporter: Hartmut Holzgraefe Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: information_schema, innodb

Issue Links:
Duplicate
duplicates MDEV-30616 Provide an easy way to list table cur... Closed
Relates
relates to MDEV-30616 Provide an easy way to list table cur... Closed

 Description   

When having a discarded tablespace it is not possible to read from INNODB_SYS_INDEXES, the below will fail with ERROR 1105 (HY000): Unknown error, and no further details in SHOW WARNINGS output or the error log.

CREATE TABLE test.t1(id INT PRIMARY KEY);
ALTER TABLE test.t1 DISCARD TABLESPACE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2023-02-14 ]

Patch is in bb-10.4-thiru

Comment by Marko Mäkelä [ 2023-02-16 ]

OK to push. Please make the test demonstrate that INFORMATION_SCHEMA.INNODB_SYS_TABLES.SPACE will not be invalidated during ALTER TABLE…DISCARD TABLESPACE.

Comment by Thirunarayanan Balathandayuthapani [ 2023-02-16 ]

SELECT * FROM information_schema.innodb_sys_tablespaces where name="test/t1";
SPACE	NAME	FLAG	ROW_FORMAT	PAGE_SIZE	ZIP_PAGE_SIZE	SPACE_TYPE	FS_BLOCK_SIZE	FILE_SIZE	ALLOCATED_SIZE
5	test/t1	33	Dynamic	16384	16384	Single	4096	65536	65536
 
ALTER TABLE test.t1 DISCARD TABLESPACE;
 
SELECT * FROM information_schema.innodb_sys_tablespaces where file_size = 0;
SPACE	NAME	FLAG	ROW_FORMAT	PAGE_SIZE	ZIP_PAGE_SIZE	SPACE_TYPE	FS_BLOCK_SIZE	FILE_SIZE	ALLOCATED_SIZE
5	test/t1	33	Dynamic	16384	16384	Single	0	0	0

By using file_size, I think we can find out whether the table is in discarded state. But the above query works only till 10.5. In 10.6, i_s view was changed
to reflect the main memory structure. Prior to that, InnoDB was traversing the innodb dictionary table to create view.

Generated at Thu Feb 08 10:17:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.