1SET GLOBAL innodb_adaptive_hash_index = false;
2SET GLOBAL innodb_stats_persistent = false;
3connect  con1,localhost,root,,;
4connect  con2,localhost,root,,;
5connect  con3,localhost,root,,;
6CREATE TABLE t1 (
7a00 CHAR(255) NOT NULL DEFAULT 'a',
8a01 CHAR(255) NOT NULL DEFAULT 'a',
9a02 CHAR(255) NOT NULL DEFAULT 'a',
10a03 CHAR(255) NOT NULL DEFAULT 'a',
11a04 CHAR(255) NOT NULL DEFAULT 'a',
12a05 CHAR(255) NOT NULL DEFAULT 'a',
13a06 CHAR(255) NOT NULL DEFAULT 'a',
14b INT NOT NULL DEFAULT 0
15) ENGINE = InnoDB;
16ALTER TABLE t1 ADD PRIMARY KEY(
17a00,
18a01,
19a02,
20a03,
21a04,
22a05,
23a06
24);
25ANALYZE TABLE t1;
26Table	Op	Msg_type	Msg_text
27test.t1	analyze	status	Engine-independent statistics collected
28test.t1	analyze	status	OK
29SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
30CLUST_INDEX_SIZE
311
32SET GLOBAL innodb_limit_optimistic_insert_debug = 7;
33BEGIN;
34INSERT INTO t1 (a00) VALUES ('aa');
35INSERT INTO t1 (a00) VALUES ('ab');
36INSERT INTO t1 (a00) VALUES ('ac');
37INSERT INTO t1 (a00) VALUES ('ad');
38INSERT INTO t1 (a00) VALUES ('ae');
39INSERT INTO t1 (a00) VALUES ('af');
40INSERT INTO t1 (a00) VALUES ('ag');
41INSERT INTO t1 (a00) VALUES ('ah');
42COMMIT;
43ANALYZE TABLE t1;
44Table	Op	Msg_type	Msg_text
45test.t1	analyze	status	Engine-independent statistics collected
46test.t1	analyze	status	OK
47SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
48CLUST_INDEX_SIZE
493
50BEGIN;
51INSERT INTO t1 (a00) VALUES ('ai');
52INSERT INTO t1 (a00) VALUES ('aj');
53INSERT INTO t1 (a00) VALUES ('ak');
54COMMIT;
55ANALYZE TABLE t1;
56Table	Op	Msg_type	Msg_text
57test.t1	analyze	status	Engine-independent statistics collected
58test.t1	analyze	status	OK
59SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
60CLUST_INDEX_SIZE
614
62BEGIN;
63INSERT INTO t1 (a00) VALUES ('al');
64INSERT INTO t1 (a00) VALUES ('am');
65INSERT INTO t1 (a00) VALUES ('an');
66INSERT INTO t1 (a00) VALUES ('ao');
67INSERT INTO t1 (a00) VALUES ('ap');
68INSERT INTO t1 (a00) VALUES ('aq');
69INSERT INTO t1 (a00) VALUES ('ar');
70COMMIT;
71ANALYZE TABLE t1;
72Table	Op	Msg_type	Msg_text
73test.t1	analyze	status	Engine-independent statistics collected
74test.t1	analyze	status	OK
75SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
76CLUST_INDEX_SIZE
775
78BEGIN;
79INSERT INTO t1 (a00) VALUES ('as');
80INSERT INTO t1 (a00) VALUES ('at');
81INSERT INTO t1 (a00) VALUES ('au');
82INSERT INTO t1 (a00) VALUES ('av');
83INSERT INTO t1 (a00) VALUES ('aw');
84INSERT INTO t1 (a00) VALUES ('ax');
85INSERT INTO t1 (a00) VALUES ('ay');
86COMMIT;
87ANALYZE TABLE t1;
88Table	Op	Msg_type	Msg_text
89test.t1	analyze	status	Engine-independent statistics collected
90test.t1	analyze	status	OK
91SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
92CLUST_INDEX_SIZE
936
94BEGIN;
95INSERT INTO t1 (a00) VALUES ('az');
96INSERT INTO t1 (a00) VALUES ('ba');
97INSERT INTO t1 (a00) VALUES ('bb');
98INSERT INTO t1 (a00) VALUES ('bc');
99INSERT INTO t1 (a00) VALUES ('bd');
100INSERT INTO t1 (a00) VALUES ('be');
101INSERT INTO t1 (a00) VALUES ('bf');
102COMMIT;
103ANALYZE TABLE t1;
104Table	Op	Msg_type	Msg_text
105test.t1	analyze	status	Engine-independent statistics collected
106test.t1	analyze	status	OK
107SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
108CLUST_INDEX_SIZE
1097
110BEGIN;
111INSERT INTO t1 (a00) VALUES ('bg');
112INSERT INTO t1 (a00) VALUES ('bh');
113INSERT INTO t1 (a00) VALUES ('bi');
114INSERT INTO t1 (a00) VALUES ('bj');
115INSERT INTO t1 (a00) VALUES ('bk');
116INSERT INTO t1 (a00) VALUES ('bl');
117INSERT INTO t1 (a00) VALUES ('bm');
118COMMIT;
119ANALYZE TABLE t1;
120Table	Op	Msg_type	Msg_text
121test.t1	analyze	status	Engine-independent statistics collected
122test.t1	analyze	status	OK
123SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
124CLUST_INDEX_SIZE
1258
126BEGIN;
127INSERT INTO t1 (a00) VALUES ('bn');
128INSERT INTO t1 (a00) VALUES ('bo');
129INSERT INTO t1 (a00) VALUES ('bp');
130INSERT INTO t1 (a00) VALUES ('bq');
131INSERT INTO t1 (a00) VALUES ('br');
132INSERT INTO t1 (a00) VALUES ('bs');
133INSERT INTO t1 (a00) VALUES ('bt');
134COMMIT;
135ANALYZE TABLE t1;
136Table	Op	Msg_type	Msg_text
137test.t1	analyze	status	Engine-independent statistics collected
138test.t1	analyze	status	OK
139SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
140CLUST_INDEX_SIZE
14111
142BEGIN;
143INSERT INTO t1 (a00) VALUES ('bu');
144INSERT INTO t1 (a00) VALUES ('bv');
145INSERT INTO t1 (a00) VALUES ('bw');
146INSERT INTO t1 (a00) VALUES ('bx');
147INSERT INTO t1 (a00) VALUES ('by');
148INSERT INTO t1 (a00) VALUES ('bz');
149INSERT INTO t1 (a00) VALUES ('ca');
150INSERT INTO t1 (a00) VALUES ('cb');
151INSERT INTO t1 (a00) VALUES ('cc');
152INSERT INTO t1 (a00) VALUES ('cd');
153INSERT INTO t1 (a00) VALUES ('ce');
154INSERT INTO t1 (a00) VALUES ('cf');
155INSERT INTO t1 (a00) VALUES ('cg');
156INSERT INTO t1 (a00) VALUES ('ch');
157INSERT INTO t1 (a00) VALUES ('ci');
158INSERT INTO t1 (a00) VALUES ('cj');
159INSERT INTO t1 (a00) VALUES ('ck');
160INSERT INTO t1 (a00) VALUES ('cl');
161INSERT INTO t1 (a00) VALUES ('cm');
162INSERT INTO t1 (a00) VALUES ('cn');
163INSERT INTO t1 (a00) VALUES ('co');
164COMMIT;
165ANALYZE TABLE t1;
166Table	Op	Msg_type	Msg_text
167test.t1	analyze	status	Engine-independent statistics collected
168test.t1	analyze	status	OK
169SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
170CLUST_INDEX_SIZE
17115
172BEGIN;
173INSERT INTO t1 (a00) VALUES ('cp');
174INSERT INTO t1 (a00) VALUES ('cq');
175INSERT INTO t1 (a00) VALUES ('cr');
176INSERT INTO t1 (a00) VALUES ('cs');
177INSERT INTO t1 (a00) VALUES ('ct');
178INSERT INTO t1 (a00) VALUES ('cu');
179INSERT INTO t1 (a00) VALUES ('cv');
180INSERT INTO t1 (a00) VALUES ('cw');
181INSERT INTO t1 (a00) VALUES ('cx');
182INSERT INTO t1 (a00) VALUES ('cy');
183INSERT INTO t1 (a00) VALUES ('cz');
184INSERT INTO t1 (a00) VALUES ('da');
185INSERT INTO t1 (a00) VALUES ('db');
186INSERT INTO t1 (a00) VALUES ('dc');
187INSERT INTO t1 (a00) VALUES ('dd');
188INSERT INTO t1 (a00) VALUES ('de');
189INSERT INTO t1 (a00) VALUES ('df');
190INSERT INTO t1 (a00) VALUES ('dg');
191INSERT INTO t1 (a00) VALUES ('dh');
192INSERT INTO t1 (a00) VALUES ('di');
193INSERT INTO t1 (a00) VALUES ('dj');
194INSERT INTO t1 (a00) VALUES ('dk');
195INSERT INTO t1 (a00) VALUES ('dl');
196INSERT INTO t1 (a00) VALUES ('dm');
197INSERT INTO t1 (a00) VALUES ('dn');
198INSERT INTO t1 (a00) VALUES ('do');
199INSERT INTO t1 (a00) VALUES ('dp');
200INSERT INTO t1 (a00) VALUES ('dq');
201INSERT INTO t1 (a00) VALUES ('dr');
202INSERT INTO t1 (a00) VALUES ('ds');
203INSERT INTO t1 (a00) VALUES ('dt');
204INSERT INTO t1 (a00) VALUES ('du');
205INSERT INTO t1 (a00) VALUES ('dv');
206INSERT INTO t1 (a00) VALUES ('dw');
207INSERT INTO t1 (a00) VALUES ('dx');
208INSERT INTO t1 (a00) VALUES ('dy');
209INSERT INTO t1 (a00) VALUES ('dz');
210INSERT INTO t1 (a00) VALUES ('ea');
211INSERT INTO t1 (a00) VALUES ('eb');
212INSERT INTO t1 (a00) VALUES ('ec');
213INSERT INTO t1 (a00) VALUES ('ed');
214INSERT INTO t1 (a00) VALUES ('ee');
215INSERT INTO t1 (a00) VALUES ('ef');
216INSERT INTO t1 (a00) VALUES ('eg');
217INSERT INTO t1 (a00) VALUES ('eh');
218INSERT INTO t1 (a00) VALUES ('ei');
219INSERT INTO t1 (a00) VALUES ('ej');
220INSERT INTO t1 (a00) VALUES ('ek');
221INSERT INTO t1 (a00) VALUES ('el');
222COMMIT;
223ANALYZE TABLE t1;
224Table	Op	Msg_type	Msg_text
225test.t1	analyze	status	Engine-independent statistics collected
226test.t1	analyze	status	OK
227SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
228CLUST_INDEX_SIZE
22923
230BEGIN;
231INSERT INTO t1 (a00) VALUES ('em');
232INSERT INTO t1 (a00) VALUES ('en');
233INSERT INTO t1 (a00) VALUES ('eo');
234INSERT INTO t1 (a00) VALUES ('ep');
235INSERT INTO t1 (a00) VALUES ('eq');
236INSERT INTO t1 (a00) VALUES ('er');
237INSERT INTO t1 (a00) VALUES ('es');
238INSERT INTO t1 (a00) VALUES ('et');
239INSERT INTO t1 (a00) VALUES ('eu');
240INSERT INTO t1 (a00) VALUES ('ev');
241INSERT INTO t1 (a00) VALUES ('ew');
242INSERT INTO t1 (a00) VALUES ('ex');
243INSERT INTO t1 (a00) VALUES ('ey');
244INSERT INTO t1 (a00) VALUES ('ez');
245INSERT INTO t1 (a00) VALUES ('fa');
246INSERT INTO t1 (a00) VALUES ('fb');
247INSERT INTO t1 (a00) VALUES ('fc');
248INSERT INTO t1 (a00) VALUES ('fd');
249INSERT INTO t1 (a00) VALUES ('fe');
250INSERT INTO t1 (a00) VALUES ('ff');
251INSERT INTO t1 (a00) VALUES ('fg');
252INSERT INTO t1 (a00) VALUES ('fh');
253INSERT INTO t1 (a00) VALUES ('fi');
254INSERT INTO t1 (a00) VALUES ('fj');
255INSERT INTO t1 (a00) VALUES ('fk');
256INSERT INTO t1 (a00) VALUES ('fl');
257INSERT INTO t1 (a00) VALUES ('fm');
258INSERT INTO t1 (a00) VALUES ('fn');
259INSERT INTO t1 (a00) VALUES ('fo');
260INSERT INTO t1 (a00) VALUES ('fp');
261INSERT INTO t1 (a00) VALUES ('fq');
262INSERT INTO t1 (a00) VALUES ('fr');
263INSERT INTO t1 (a00) VALUES ('fs');
264INSERT INTO t1 (a00) VALUES ('ft');
265INSERT INTO t1 (a00) VALUES ('fu');
266INSERT INTO t1 (a00) VALUES ('fv');
267INSERT INTO t1 (a00) VALUES ('fw');
268INSERT INTO t1 (a00) VALUES ('fx');
269INSERT INTO t1 (a00) VALUES ('fy');
270INSERT INTO t1 (a00) VALUES ('fz');
271INSERT INTO t1 (a00) VALUES ('ga');
272INSERT INTO t1 (a00) VALUES ('gb');
273INSERT INTO t1 (a00) VALUES ('gc');
274INSERT INTO t1 (a00) VALUES ('gd');
275INSERT INTO t1 (a00) VALUES ('ge');
276INSERT INTO t1 (a00) VALUES ('gf');
277INSERT INTO t1 (a00) VALUES ('gg');
278INSERT INTO t1 (a00) VALUES ('gh');
279COMMIT;
280ANALYZE TABLE t1;
281Table	Op	Msg_type	Msg_text
282test.t1	analyze	status	Engine-independent statistics collected
283test.t1	analyze	status	OK
284SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
285CLUST_INDEX_SIZE
28629
287SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
288# Test start
289SET DEBUG_SYNC = 'RESET';
290INSERT INTO t1 (a00) VALUES ('bfa');
291connection con1;
292SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
293INSERT INTO t1 (a00) VALUES ('bfb');
294connection con2;
295SET DEBUG_SYNC = 'now WAIT_FOR reached';
296SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
297a00	a01
298aa	a
299SELECT a00,a01 FROM t1 WHERE a00 = 'aq';
300a00	a01
301aq	a
302SELECT a00,a01 FROM t1 WHERE a00 = 'cp';
303a00	a01
304cp	a
305SELECT a00,a01 FROM t1 WHERE a00 = 'el';
306a00	a01
307el	a
308SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
309SELECT a00,a01 FROM t1 WHERE a00 = 'ar';
310connection con3;
311SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
312SELECT a00,a01 FROM t1 WHERE a00 = 'cn';
313connection default;
314SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
315SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
316SET DEBUG_SYNC = 'now SIGNAL continue';
317connection con1;
318connection con2;
319a00	a01
320ar	a
321connection con3;
322a00	a01
323cn	a
324connection default;
325ANALYZE TABLE t1;
326Table	Op	Msg_type	Msg_text
327test.t1	analyze	status	Engine-independent statistics collected
328test.t1	analyze	status	OK
329SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
330CLUST_INDEX_SIZE
33130
332SET DEBUG_SYNC = 'RESET';
333INSERT INTO t1 (a00) VALUES ('coa');
334connection con1;
335SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
336INSERT INTO t1 (a00) VALUES ('cob');
337connection con2;
338SET DEBUG_SYNC = 'now WAIT_FOR reached';
339SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
340SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
341connection con3;
342SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
343SELECT a00,a01 FROM t1 WHERE a00 = 'el';
344connection default;
345SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
346SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
347SET DEBUG_SYNC = 'now SIGNAL continue';
348connection con1;
349connection con2;
350a00	a01
351aa	a
352connection con3;
353a00	a01
354el	a
355connection default;
356ANALYZE TABLE t1;
357Table	Op	Msg_type	Msg_text
358test.t1	analyze	status	Engine-independent statistics collected
359test.t1	analyze	status	OK
360SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
361CLUST_INDEX_SIZE
36231
363SET DEBUG_SYNC = 'RESET';
364INSERT INTO t1 (a00) VALUES ('gba');
365connection con1;
366SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
367INSERT INTO t1 (a00) VALUES ('gbb');
368connection con2;
369SET DEBUG_SYNC = 'now WAIT_FOR reached';
370SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
371a00	a01
372aa	a
373SELECT a00,a01 FROM t1 WHERE a00 = 'ek';
374a00	a01
375ek	a
376SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
377SELECT a00,a01 FROM t1 WHERE a00 = 'el';
378connection con3;
379SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
380SELECT a00,a01 FROM t1 WHERE a00 = 'gb';
381connection default;
382SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
383SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
384SET DEBUG_SYNC = 'now SIGNAL continue';
385connection con1;
386connection con2;
387a00	a01
388el	a
389connection con3;
390a00	a01
391gb	a
392connection default;
393ANALYZE TABLE t1;
394Table	Op	Msg_type	Msg_text
395test.t1	analyze	status	Engine-independent statistics collected
396test.t1	analyze	status	OK
397SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
398CLUST_INDEX_SIZE
39932
400SET DEBUG_SYNC = 'RESET';
401connection default;
402disconnect con1;
403disconnect con2;
404disconnect con3;
405DROP TABLE t1;
406