mirror of
https://github.com/MariaDB/server.git
synced 2025-11-27 05:41:41 +03:00
This is joint work with Thirunarayanan Balathandayuthapani.
The MDL interface between InnoDB and the rest of the server
(in storage/innobase/dict/dict0dict.cc and in include/)
is my work, while most everything else is Thiru's.
The collection of InnoDB persistent statistics and the
defragmentation were not refactored to use MDL. They will
keep relying on lower-level interlocking with
fil_check_pending_operations().
The purge of transaction history and the background operations on
fulltext indexes will use MDL. We will revert
commit 2c4844c9e7
(MDEV-17813) because thanks to MDL, purge cannot conflict
with DDL operations anymore. For a similar reason, we will remove
the MDEV-16222 test case from gcol.innodb_virtual_debug_purge.
Purge is essentially replacing all use of the global dict_sys.latch
with MDL. Purge will skip the undo log records for tables whose names
start with #sql-ib or #sql2. Theoretically, such tables might
be renamed back to visible table names if TRUNCATE fails to
create a new table, or the final rename in ALTER TABLE...ALGORITHM=COPY
fails. In that case, purge could permanently leave some garbage
in the table. Such garbage will be tolerated; the table would not
be considered corrupted.
To avoid repeated MDL releases and acquisitions,
trx_purge_attach_undo_recs() will sort undo log records by table_id,
and purge_node_t will keep the MDL and table handle open for multiple
successive undo log records.
get_purge_table(): A new accessor, used during the purge of
history for indexed virtual columns. This interface should ideally
not exist at all.
thd_mdl_context(): Accessor of THD::mdl_context.
Wrapped in a new thd_mdl_service.
dict_get_db_name_len(): Define inline.
dict_acquire_mdl_shared(): Acquire explicit shared MDL on a table name
if needed.
dict_table_open_on_id(): Return MDL_ticket, if requested.
dict_table_close(): Release MDL ticket, if requested.
dict_fts_index_syncing(), dict_index_t::index_fts_syncing: Remove.
row_drop_table_for_mysql() no longer needs to check these, because
MDL guarantees that a fulltext index sync will not be in progress
while MDL_EXCLUSIVE is protecting a DDL operation.
dict_table_t::parse_name(): Parse the table name for acquiring MDL.
purge_node_t::undo_recs: Change the type to std::list<trx_purge_rec_t*>
(different container, and storing also roll_ptr).
purge_node_t: Add mdl_ticket, last_table_id, purge_thd, mdl_hold_recs
for acquiring MDL and for keeping the table open across multiple
undo log records.
purge_vcol_info_t, row_purge_store_vsec_cur(), row_purge_restore_vsec_cur():
Remove. We will acquire the MDL earlier.
purge_sys_t::heap: Added, for reading undo log records.
fts_sync_during_ddl(): Invoked during ALGORITHM=INPLACE operations
to ensure that fts_sync_table() will not conflict with MDL_EXCLUSIVE.
Uses fts_t::sync_message for bookkeeping.
85 lines
3.6 KiB
Plaintext
85 lines
3.6 KiB
Plaintext
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0
|
|
SET GLOBAL innodb_file_per_table=1;
|
|
#
|
|
# Bug#21644827 - FTS, ASSERT !SRV_READ_ONLY_MODE || M_IMPL.M_LOG_MODE ==
|
|
# MTR_LOG_NO_REDO
|
|
#
|
|
SET GLOBAL innodb_file_per_table=ON;
|
|
create table t1 (a int not null, d varchar(15) not null, b
|
|
varchar(198) not null, c char(156),
|
|
fulltext ftsic(c)) engine=InnoDB
|
|
row_format=redundant;
|
|
insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
|
|
insert into t1 values(456, 'abcdef', 'jghikl', 'mnop');
|
|
insert into t1 values(789, 'abcdef', 'jghikl', 'mnop');
|
|
insert into t1 values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf');
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
insert into t1 select * from t1;
|
|
SET GLOBAL innodb_file_per_table=OFF;
|
|
create table t2 (a int not null, d varchar(15) not null, b
|
|
varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB
|
|
row_format=redundant;
|
|
insert into t2 select * from t1;
|
|
create table t3 (a int not null, d varchar(15) not null, b varchar(198),
|
|
c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB
|
|
row_format=redundant;
|
|
insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa');
|
|
insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa');
|
|
SET GLOBAL innodb_fast_shutdown=0;
|
|
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --innodb-read-only
|
|
SELECT COUNT(*) FROM t1;
|
|
COUNT(*)
|
|
4096
|
|
SELECT COUNT(*) FROM t2;
|
|
COUNT(*)
|
|
4096
|
|
SELECT COUNT(*) FROM t3;
|
|
COUNT(*)
|
|
2
|
|
TRUNCATE TABLE t1;
|
|
ERROR HY000: Table 't1' is read only
|
|
TRUNCATE TABLE t2;
|
|
ERROR HY000: Table 't2' is read only
|
|
TRUNCATE TABLE t3;
|
|
ERROR HY000: Table 't3' is read only
|
|
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0
|
|
TRUNCATE TABLE t1;
|
|
TRUNCATE TABLE t2;
|
|
TRUNCATE TABLE t3;
|
|
corrupted SYS_TABLES.MIX_LEN for test/t1
|
|
corrupted SYS_TABLES.MIX_LEN for test/t2
|
|
corrupted SYS_TABLES.MIX_LEN for test/t3
|
|
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0
|
|
TRUNCATE TABLE t1;
|
|
ERROR 42S02: Table 'test.t1' doesn't exist in engine
|
|
TRUNCATE TABLE t2;
|
|
TRUNCATE TABLE t3;
|
|
SELECT COUNT(*) FROM t1;
|
|
ERROR 42S02: Table 'test.t1' doesn't exist in engine
|
|
SELECT COUNT(*) FROM t2;
|
|
COUNT(*)
|
|
0
|
|
SELECT COUNT(*) FROM t3;
|
|
COUNT(*)
|
|
0
|
|
RENAME TABLE t1 TO tee_one;
|
|
ERROR HY000: Error on rename of './test/t1' to './test/tee_one' (errno: 155 "The table does not exist in the storage engine")
|
|
DROP TABLE t1;
|
|
Warnings:
|
|
Warning 1932 Table 'test.t1' doesn't exist in engine
|
|
DROP TABLE t2,t3;
|
|
FOUND 49 /\[ERROR\] InnoDB: Table `test`\.`t1` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=511\b/ in mysqld.1.err
|
|
# restart
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata1
|
|
db.opt
|