mirror of
https://github.com/MariaDB/server.git
synced 2025-07-24 19:42:23 +03:00
The test case for reproducing MDEV-14126 demonstrates that InnoDB can end up with an index tree where a non-leaf page has only one child page. The test case innodb.innodb_bug14676111 demonstrates that such pages are sometimes unavoidable, because InnoDB does not implement any sort of B-tree rotation. But, there is no reason to allow a root page with only one child page. btr_cur_node_ptr_delete(): Replaces btr_node_ptr_delete(). btr_page_get_father(): Declare globally. btr_discard_only_page_on_level(): Declare with ATTRIBUTE_COLD. It turns out that this function is not covered by the innodb.innodb_bug14676111 test case after all. btr_discard_page(): If the root page ends up having only one child page, shrink the tree by invoking btr_lift_page_up().
74 lines
2.0 KiB
Plaintext
74 lines
2.0 KiB
Plaintext
set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
|
|
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
|
|
set global innodb_limit_optimistic_insert_debug = 2;
|
|
insert into t1 values (1);
|
|
connect con5,localhost,root;
|
|
begin;
|
|
insert into t1 values (5);
|
|
connect con4,localhost,root;
|
|
begin;
|
|
insert into t1 values (4);
|
|
connection default;
|
|
insert into t1 values (3);
|
|
connect con2,localhost,root;
|
|
begin;
|
|
insert into t1 values (2);
|
|
connection default;
|
|
analyze table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
|
|
CLUST_INDEX_SIZE
|
|
10
|
|
connection con4;
|
|
rollback;
|
|
disconnect con4;
|
|
connection default;
|
|
analyze table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
|
|
CLUST_INDEX_SIZE
|
|
8
|
|
connection con5;
|
|
rollback;
|
|
disconnect con5;
|
|
connection default;
|
|
analyze table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
|
|
CLUST_INDEX_SIZE
|
|
4
|
|
set global innodb_limit_optimistic_insert_debug = 10000;
|
|
connection con2;
|
|
rollback;
|
|
disconnect con2;
|
|
connection default;
|
|
analyze table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
|
|
CLUST_INDEX_SIZE
|
|
2
|
|
begin;
|
|
insert into t1 values (2);
|
|
rollback;
|
|
analyze table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
|
|
CLUST_INDEX_SIZE
|
|
1
|
|
begin;
|
|
insert into t1 values (2);
|
|
rollback;
|
|
analyze table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
|
|
CLUST_INDEX_SIZE
|
|
1
|
|
drop table t1;
|
|
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
|