mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-22343 Remove SYS_TABLESPACES and SYS_DATAFILES
The InnoDB internal tables SYS_TABLESPACES and SYS_DATAFILES as well as the INFORMATION_SCHEMA views INNODB_SYS_TABLESPACES and INNODB_SYS_DATAFILES were introduced in MySQL 5.6 for no good reason in mysql/mysql-server/commit/e9255a22ef16d612a8076bc0b34002bc5a784627 when the InnoDB support for the DATA DIRECTORY attribute was introduced. The file system should be the authoritative source of information on files. Storing information about file system paths in the file system (symlinks, or even the .isl files that were unfortunately chosen as the solution) is sufficient. If information is additionally stored in some hidden tables inside the InnoDB system tablespace, everything unnecessarily becomes more complicated, because more copies of data mean more opportunity for the copies to be out of sync, and because modifying the data in the system tablespace in the desired way might not be possible at all without modifying the InnoDB source code. So, the copy in the system tablespace basically is a redundant, non-authoritative source of information. We will stop creating or accessing the system tables SYS_TABLESPACES and SYS_DATAFILES. We will also remove the view INFORMATION_SCHEMA.INNODB_SYS_DATAFILES along with SYS_DATAFILES. The view INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES will be repurposed to directly reflect fil_system.space_list. The column PAGE_SIZE, which would always contain the value of the GLOBAL read-only variable innodb_page_size, is removed. The column ZIP_PAGE_SIZE, which would actually contain the physical page size of a page, is renamed to PAGE_SIZE. Finally, a new column FILENAME is added, as a replacement of SYS_DATAFILES.PATH. This will also address MDEV-21801 (files that were created before upgrading to MySQL 5.6 or MariaDB 10.0 or later were never registered in SYS_TABLESPACES or SYS_DATAFILES) and MDEV-21801 (information about the system tablespace is not stored in SYS_TABLESPACES or SYS_DATAFILES).
This commit is contained in:
@ -9,10 +9,8 @@ WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY table_id;
|
||||
TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
|
||||
11 SYS_FOREIGN 0 7 0 Redundant 0 System
|
||||
12 SYS_FOREIGN_COLS 0 7 0 Redundant 0 System
|
||||
13 SYS_TABLESPACES 0 6 0 Redundant 0 System
|
||||
14 SYS_DATAFILES 0 5 0 Redundant 0 System
|
||||
15 SYS_VIRTUAL 0 6 0 Redundant 0 System
|
||||
18 mysql/transaction_registry 33 8 3 Dynamic 0 Single
|
||||
13 SYS_VIRTUAL 0 6 0 Redundant 0 System
|
||||
16 mysql/transaction_registry 33 8 3 Dynamic 0 Single
|
||||
SELECT table_id,pos,mtype,prtype,len,name
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
|
||||
WHERE table_id NOT IN (@table_stats_id, @index_stats_id)
|
||||
@ -26,19 +24,14 @@ table_id pos mtype prtype len name
|
||||
12 1 6 0 4 POS
|
||||
12 2 1 524292 0 FOR_COL_NAME
|
||||
12 3 1 524292 0 REF_COL_NAME
|
||||
13 0 6 0 4 SPACE
|
||||
13 1 1 524292 0 NAME
|
||||
13 2 6 0 4 FLAGS
|
||||
14 0 6 0 4 SPACE
|
||||
14 1 1 524292 0 PATH
|
||||
15 0 6 0 8 TABLE_ID
|
||||
15 1 6 0 4 POS
|
||||
15 2 6 0 4 BASE_POS
|
||||
18 0 6 1800 8 transaction_id
|
||||
18 1 6 1800 8 commit_id
|
||||
18 2 3 526087 7 begin_timestamp
|
||||
18 3 3 526087 7 commit_timestamp
|
||||
18 4 6 1022 1 isolation_level
|
||||
13 0 6 0 8 TABLE_ID
|
||||
13 1 6 0 4 POS
|
||||
13 2 6 0 4 BASE_POS
|
||||
16 0 6 1800 8 transaction_id
|
||||
16 1 6 1800 8 commit_id
|
||||
16 2 3 526087 7 begin_timestamp
|
||||
16 3 3 526087 7 commit_timestamp
|
||||
16 4 6 1022 1 isolation_level
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES
|
||||
WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY index_id;
|
||||
INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE MERGE_THRESHOLD
|
||||
@ -46,8 +39,6 @@ INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE MERGE_THRESHOLD
|
||||
# FOR_IND # 0 1 # # 50
|
||||
# REF_IND # 0 1 # # 50
|
||||
# ID_IND # 3 2 # # 50
|
||||
# SYS_TABLESPACES_SPACE # 3 1 # # 50
|
||||
# SYS_DATAFILES_SPACE # 3 1 # # 50
|
||||
# BASE_IDX # 3 3 # # 50
|
||||
# PRIMARY # 3 1 # # 50
|
||||
# commit_id # 2 1 # # 50
|
||||
@ -62,16 +53,14 @@ index_id pos name
|
||||
13 0 REF_NAME
|
||||
14 0 ID
|
||||
14 1 POS
|
||||
15 0 SPACE
|
||||
16 0 SPACE
|
||||
17 0 TABLE_ID
|
||||
17 1 POS
|
||||
17 2 BASE_POS
|
||||
20 0 transaction_id
|
||||
21 0 commit_id
|
||||
22 0 begin_timestamp
|
||||
23 0 commit_timestamp
|
||||
23 1 transaction_id
|
||||
15 0 TABLE_ID
|
||||
15 1 POS
|
||||
15 2 BASE_POS
|
||||
18 0 transaction_id
|
||||
19 0 commit_id
|
||||
20 0 begin_timestamp
|
||||
21 0 commit_timestamp
|
||||
21 1 transaction_id
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
@ -95,7 +84,7 @@ test/t_dynamic DEFAULT DEFAULT MYSQLD_DATADIR/test/t_dynamic.ibd
|
||||
DROP TABLE t_redundant, t_compact, t_compressed, t_dynamic;
|
||||
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
|
||||
count(*)
|
||||
8
|
||||
6
|
||||
CREATE TABLE parent (id INT NOT NULL,
|
||||
PRIMARY KEY (id)) ENGINE=INNODB;
|
||||
CREATE TABLE child (id INT, parent_id INT,
|
||||
@ -119,10 +108,8 @@ test/parent 1 1
|
||||
SELECT NAME, FLAG, N_COLS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
|
||||
WHERE name NOT LIKE 'sys/%';
|
||||
NAME FLAG N_COLS
|
||||
SYS_DATAFILES 0 5
|
||||
SYS_FOREIGN 0 7
|
||||
SYS_FOREIGN_COLS 0 7
|
||||
SYS_TABLESPACES 0 6
|
||||
SYS_VIRTUAL 0 6
|
||||
mysql/innodb_index_stats 33 11
|
||||
mysql/innodb_table_stats 33 9
|
||||
|
Reference in New Issue
Block a user