mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
f27e9c8947
The purpose of the change buffer was to reduce random disk access, which could be useful on rotational storage, but maybe less so on solid-state storage. When we wished to (1) insert a record into a non-unique secondary index, (2) delete-mark a secondary index record, (3) delete a secondary index record as part of purge (but not ROLLBACK), and the B-tree leaf page where the record belongs to is not in the buffer pool, we inserted a record into the change buffer B-tree, indexed by the page identifier. When the page was eventually read into the buffer pool, we looked up the change buffer B-tree for any modifications to the page, applied these upon the completion of the read operation. This was called the insert buffer merge. We remove the change buffer, because it has been the source of various hard-to-reproduce corruption bugs, including those fixed in commit5b9ee8d819
and commit165564d3c3
but not limited to them. A downgrade will fail with a clear message starting with commitdb14eb16f9
(MDEV-30106). buf_page_t::state: Merge IBUF_EXIST to UNFIXED and WRITE_FIX_IBUF to WRITE_FIX. buf_pool_t::watch[]: Remove. trx_t: Move isolation_level, check_foreigns, check_unique_secondary, bulk_insert into the same bit-field. The only purpose of trx_t::check_unique_secondary is to enable bulk insert into an empty table. It no longer enables insert buffering for UNIQUE INDEX. btr_cur_t::thr: Remove. This field was originally needed for change buffering. Later, its use was extended to cover SPATIAL INDEX. Much of the time, rtr_info::thr holds this field. When it does not, we will add parameters to SPATIAL INDEX specific functions. ibuf_upgrade_needed(): Check if the change buffer needs to be updated. ibuf_upgrade(): Merge and upgrade the change buffer after all redo log has been applied. Free any pages consumed by the change buffer, and zero out the change buffer root page to mark the upgrade completed, and to prevent a downgrade to an earlier version. dict_load_tablespaces(): Renamed from dict_check_tablespaces_and_store_max_id(). This needs to be invoked before ibuf_upgrade(). btr_cur_open_at_rnd_pos(): Specialize for use in persistent statistics. The change buffer merge does not need this function anymore. btr_page_alloc(): Renamed from btr_page_alloc_low(). We no longer allocate any change buffer pages. btr_cur_open_at_rnd_pos(): Specialize for use in persistent statistics. The change buffer merge does not need this function anymore. row_search_index_entry(), btr_lift_page_up(): Add a parameter thr for the SPATIAL INDEX case. rtr_page_split_and_insert(): Specialized from btr_page_split_and_insert(). rtr_root_raise_and_insert(): Specialized from btr_root_raise_and_insert(). Note: The support for upgrading from the MySQL 3.23 or MySQL 4.0 change buffer format that predates the MySQL 4.1 introduction of the option innodb_file_per_table was removed in MySQL 5.6.5 as part of mysql/mysql-server@69b6241a79 and MariaDB 10.0.11 as part of1d0f70c2f8
. In the tests innodb.log_upgrade and innodb.log_corruption, we create valid (upgraded) change buffer pages. Tested by: Matthias Leich
29 lines
935 B
Text
29 lines
935 B
Text
#
|
|
# Bug#19904003 INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=1
|
|
# CAUSES INFINITE PAGE SPLIT
|
|
#
|
|
SET GLOBAL innodb_limit_optimistic_insert_debug=1;
|
|
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB
|
|
PARTITION BY HASH (c1) PARTITIONS 15;
|
|
DROP TABLE t1;
|
|
SET GLOBAL innodb_limit_optimistic_insert_debug=0;
|
|
#
|
|
# Bug#25082593 FOREIGN KEY VALIDATION DOESN'T NEED
|
|
# TO ACQUIRE GAP LOCK IN READ COMMITTED
|
|
#
|
|
SET GLOBAL innodb_limit_optimistic_insert_debug=2;
|
|
CREATE TABLE t1(col1 INT PRIMARY KEY) ENGINE=INNODB;
|
|
CREATE TABLE t2(col1 INT PRIMARY KEY, col2 INT NOT NULL,
|
|
FOREIGN KEY(col2) REFERENCES t1(col1)) ENGINE=INNODB;
|
|
INSERT INTO t1 VALUES(1), (3), (4);
|
|
connect con1,localhost,root;
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
START TRANSACTION;
|
|
INSERT INTO t2 VALUES(1, 3);
|
|
connection default;
|
|
START TRANSACTION;
|
|
INSERT INTO t1 VALUES(2);
|
|
disconnect con1;
|
|
SET GLOBAL innodb_limit_optimistic_insert_debug=0;
|
|
DROP TABLE t2;
|
|
DROP TABLE t1;
|