22
33-- source include/have_innodb.inc
44-- source include/have_debug.inc
5+ -- source include/count_sessions.inc
56
6- if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`)
7- {
8- --skip Test requires InnoDB built with UNIV_DEBUG definition.
9- }
10-
11- --disable_query_log
127set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
13- set @old_innodb_undo_logs = @@innodb_undo_logs;
14- # Limit undo segments for stable progress of purge.
15- set global innodb_undo_logs = 1;
16- --enable_query_log
178
189CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
1910
@@ -22,36 +13,45 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
2213#
2314set global innodb_limit_optimistic_insert_debug = 2;
2415insert into t1 values (1);
16+ --connect (con5,localhost,root)
17+ begin;
2518insert into t1 values (5);
2619#current tree form
2720# (1, 5)
2821
22+ --connect (con4,localhost,root)
23+ begin;
2924insert into t1 values (4);
3025#records in a page is limited to 2 artificially. root rise occurs
3126#current tree form
3227# (1, 5)
3328#(1, 4) (5)
3429
30+ --connection default
3531insert into t1 values (3);
3632#current tree form
3733# (1, 5)
3834# (1, 4) (5)
3935#(1, 3) (4) (5)
4036
37+ --connect (con2,localhost,root)
38+ begin;
4139insert into t1 values (2);
4240#current tree form
4341# (1, 5)
4442# (1, 4) (5)
4543# (1, 3) (4) (5)
4644#(1, 2) (3) (4) (5)
4745
46+ --connection default
4847analyze table t1;
4948select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
5049
51- delete from t1 where a=4;
52- set global innodb_purge_stop_now=ON;
53- set global innodb_purge_run_now=ON;
54- --source include/wait_innodb_all_purged.inc
50+ --connection con4
51+ rollback;
52+ --disconnect con4
53+ --connection default
54+
5555#deleting 1 record of 2 records don't cause merge artificially.
5656#current tree form
5757# (1, 5)
@@ -62,10 +62,11 @@ set global innodb_purge_run_now=ON;
6262analyze table t1;
6363select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
6464
65- delete from t1 where a=5;
66- set global innodb_purge_stop_now=ON;
67- set global innodb_purge_run_now=ON;
68- --source include/wait_innodb_all_purged.inc
65+ --connection con5
66+ rollback;
67+ --disconnect con5
68+ --connection default
69+
6970#deleting 1 record of 2 records don't cause merge artificially.
7071#current tree form
7172# (1)
@@ -81,11 +82,12 @@ select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME
8182#
8283
8384#disable the artificial limitation of records in a page
84- set global innodb_limit_optimistic_insert_debug = 0;
85- delete from t1 where a=2;
86- set global innodb_purge_stop_now=ON;
87- set global innodb_purge_run_now=ON;
88- --source include/wait_innodb_all_purged.inc
85+ set global innodb_limit_optimistic_insert_debug = 10000;
86+ --connection con2
87+ rollback;
88+ --disconnect con2
89+ --connection default
90+
8991#merge page occurs. and lift up occurs.
9092#current tree form
9193# (1)
@@ -95,32 +97,27 @@ set global innodb_purge_run_now=ON;
9597analyze table t1;
9698select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
9799
100+ begin;
98101insert into t1 values (2);
99102#current tree form
100103# (1)
101104# (1) <- lift up this level next, because it is not root
102105# (1, 2, 3)
106+ rollback;
103107
104- delete from t1 where a=2;
105- set global innodb_purge_stop_now=ON;
106- set global innodb_purge_run_now=ON;
107- --source include/wait_innodb_all_purged.inc
108108#current tree form
109109# (1)
110110# (1, 3)
111111
112112analyze table t1;
113113select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1';
114114
115+ begin;
115116insert into t1 values (2);
116117#current tree form
117118# (1)
118119# (1, 2, 3) <- lift up this level next, because the father is root
119-
120- delete from t1 where a=2;
121- set global innodb_purge_stop_now=ON;
122- set global innodb_purge_run_now=ON;
123- --source include/wait_innodb_all_purged.inc
120+ rollback;
124121#current tree form
125122# (1, 3)
126123
@@ -129,7 +126,5 @@ select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME
129126
130127drop table t1;
131128
132- --disable_query_log
133129set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
134- set global innodb_undo_logs = @old_innodb_undo_logs;
135- --enable_query_log
130+ -- source include/wait_until_count_sessions.inc
0 commit comments