| 1 |
# Test for bug #14676111: WRONG PAGE_LEVEL WRITTEN FOR UPPER THAN FATHER PAGE AT BTR_LIFT_PAGE_UP() |
| 2 |
|
| 3 |
-- source include/have_debug.inc |
| 4 |
|
| 5 |
--disable_query_log |
| 6 |
set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; |
| 7 |
set @old_innodb_stats_persistent = @@innodb_stats_persistent; |
| 8 |
set @old_innodb_rollback_segments = @@innodb_rollback_segments; |
| 9 |
# Limit undo segments for stable progress of purge. |
| 10 |
set global innodb_rollback_segments = 1; |
| 11 |
--enable_query_log |
| 12 |
--disable_warnings |
| 13 |
drop table if exists t1; |
| 14 |
--enable_warnings |
| 15 |
set global innodb_stats_persistent = false; |
| 16 |
|
| 17 |
CREATE TABLE t1 (a int not null primary key) engine=InnoDB; |
| 18 |
|
| 19 |
# |
| 20 |
# make 4 leveled straight tree |
| 21 |
# |
| 22 |
set global innodb_limit_optimistic_insert_debug = 2; |
| 23 |
insert into t1 values (1); |
| 24 |
insert into t1 values (5); |
| 25 |
#current tree form |
| 26 |
# (1, 5) |
| 27 |
|
| 28 |
insert into t1 values (4); |
| 29 |
#records in a page is limited to 2 artificially. root rise occurs |
| 30 |
#current tree form |
| 31 |
# (1, 5) |
| 32 |
#(1, 4) (5) |
| 33 |
|
| 34 |
insert into t1 values (3); |
| 35 |
#current tree form |
| 36 |
# (1, 5) |
| 37 |
# (1, 4) (5) |
| 38 |
#(1, 3) (4) (5) |
| 39 |
|
| 40 |
insert into t1 values (2); |
| 41 |
#current tree form |
| 42 |
# (1, 5) |
| 43 |
# (1, 4) (5) |
| 44 |
# (1, 3) (4) (5) |
| 45 |
#(1, 2) (3) (4) (5) |
| 46 |
|
| 47 |
analyze table t1; |
| 48 |
select CLUST_INDEX_SIZE from information_schema.INNODB_TABLESTATS where NAME = 'test/t1'; |
| 49 |
|
| 50 |
delete from t1 where a=4; |
| 51 |
set global innodb_purge_stop_now=ON; |
| 52 |
set global innodb_purge_run_now=ON; |
| 53 |
--source include/wait_innodb_all_purged.inc |
| 54 |
#deleting 1 record of 2 records don't cause merge artificially. |
| 55 |
#current tree form |
| 56 |
# (1, 5) |
| 57 |
# (1) (5) |
| 58 |
# (1, 3) (5) |
| 59 |
#(1, 2) (3) (5) |
| 60 |
|
| 61 |
analyze table t1; |
| 62 |
select CLUST_INDEX_SIZE from information_schema.INNODB_TABLESTATS where NAME = 'test/t1'; |
| 63 |
|
| 64 |
delete from t1 where a=5; |
| 65 |
set global innodb_purge_stop_now=ON; |
| 66 |
set global innodb_purge_run_now=ON; |
| 67 |
--source include/wait_innodb_all_purged.inc |
| 68 |
#deleting 1 record of 2 records don't cause merge artificially. |
| 69 |
#current tree form |
| 70 |
# (1) |
| 71 |
# (1) |
| 72 |
# (1, 3) <- lift up this level next, when deleting node ptr |
| 73 |
#(1, 2) (3) <- merged next |
| 74 |
|
| 75 |
analyze table t1; |
| 76 |
select CLUST_INDEX_SIZE from information_schema.INNODB_TABLESTATS where NAME = 'test/t1'; |
| 77 |
|
| 78 |
# |
| 79 |
# cause merge at level 0 |
| 80 |
# |
| 81 |
|
| 82 |
#disable the artificial limitation of records in a page |
| 83 |
set global innodb_limit_optimistic_insert_debug = 0; |
| 84 |
delete from t1 where a=2; |
| 85 |
set global innodb_purge_stop_now=ON; |
| 86 |
set global innodb_purge_run_now=ON; |
| 87 |
--source include/wait_innodb_all_purged.inc |
| 88 |
#merge page occurs. and lift up occurs. |
| 89 |
#current tree form |
| 90 |
# (1) |
| 91 |
# (1) |
| 92 |
# (1, 3) |
| 93 |
|
| 94 |
analyze table t1; |
| 95 |
select CLUST_INDEX_SIZE from information_schema.INNODB_TABLESTATS where NAME = 'test/t1'; |
| 96 |
|
| 97 |
insert into t1 values (2); |
| 98 |
#current tree form |
| 99 |
# (1) |
| 100 |
# (1) <- lift up this level next, because it is not root |
| 101 |
# (1, 2, 3) |
| 102 |
|
| 103 |
delete from t1 where a=2; |
| 104 |
set global innodb_purge_stop_now=ON; |
| 105 |
set global innodb_purge_run_now=ON; |
| 106 |
--source include/wait_innodb_all_purged.inc |
| 107 |
#current tree form |
| 108 |
# (1) |
| 109 |
# (1, 3) |
| 110 |
|
| 111 |
analyze table t1; |
| 112 |
select CLUST_INDEX_SIZE from information_schema.INNODB_TABLESTATS where NAME = 'test/t1'; |
| 113 |
|
| 114 |
insert into t1 values (2); |
| 115 |
#current tree form |
| 116 |
# (1) |
| 117 |
# (1, 2, 3) <- lift up this level next, because the father is root |
| 118 |
|
| 119 |
delete from t1 where a=2; |
| 120 |
set global innodb_purge_stop_now=ON; |
| 121 |
set global innodb_purge_run_now=ON; |
| 122 |
--source include/wait_innodb_all_purged.inc |
| 123 |
#current tree form |
| 124 |
# (1, 3) |
| 125 |
|
| 126 |
analyze table t1; |
| 127 |
select CLUST_INDEX_SIZE from information_schema.INNODB_TABLESTATS where NAME = 'test/t1'; |
| 128 |
|
| 129 |
drop table t1; |
| 130 |
|
| 131 |
--disable_query_log |
| 132 |
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; |
| 133 |
set global innodb_stats_persistent = @old_innodb_stats_persistent; |
| 134 |
set global innodb_rollback_segments = @old_innodb_rollback_segments; |
| 135 |
--enable_query_log |