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