SET GLOBAL innodb_adaptive_hash_index = false; SET GLOBAL innodb_stats_persistent = false; connect con1,localhost,root,,; connect con2,localhost,root,,; connect con3,localhost,root,,; CREATE TABLE t1 ( a00 CHAR(255) NOT NULL DEFAULT 'a', a01 CHAR(255) NOT NULL DEFAULT 'a', a02 CHAR(255) NOT NULL DEFAULT 'a', a03 CHAR(255) NOT NULL DEFAULT 'a', a04 CHAR(255) NOT NULL DEFAULT 'a', a05 CHAR(255) NOT NULL DEFAULT 'a', a06 CHAR(255) NOT NULL DEFAULT 'a', b INT NOT NULL DEFAULT 0 ) ENGINE = InnoDB; ALTER TABLE t1 ADD PRIMARY KEY( a00, a01, a02, a03, a04, a05, a06 ); 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 SET GLOBAL innodb_limit_optimistic_insert_debug = 7; INSERT INTO t1 (a00) VALUES ('aa'); INSERT INTO t1 (a00) VALUES ('ab'); INSERT INTO t1 (a00) VALUES ('ac'); INSERT INTO t1 (a00) VALUES ('ad'); INSERT INTO t1 (a00) VALUES ('ae'); INSERT INTO t1 (a00) VALUES ('af'); INSERT INTO t1 (a00) VALUES ('ag'); INSERT INTO t1 (a00) VALUES ('ah'); 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 3 INSERT INTO t1 (a00) VALUES ('ai'); INSERT INTO t1 (a00) VALUES ('aj'); INSERT INTO t1 (a00) VALUES ('ak'); 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 INSERT INTO t1 (a00) VALUES ('al'); INSERT INTO t1 (a00) VALUES ('am'); INSERT INTO t1 (a00) VALUES ('an'); INSERT INTO t1 (a00) VALUES ('ao'); INSERT INTO t1 (a00) VALUES ('ap'); INSERT INTO t1 (a00) VALUES ('aq'); INSERT INTO t1 (a00) VALUES ('ar'); 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 5 INSERT INTO t1 (a00) VALUES ('as'); INSERT INTO t1 (a00) VALUES ('at'); INSERT INTO t1 (a00) VALUES ('au'); INSERT INTO t1 (a00) VALUES ('av'); INSERT INTO t1 (a00) VALUES ('aw'); INSERT INTO t1 (a00) VALUES ('ax'); INSERT INTO t1 (a00) VALUES ('ay'); 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 6 INSERT INTO t1 (a00) VALUES ('az'); INSERT INTO t1 (a00) VALUES ('ba'); INSERT INTO t1 (a00) VALUES ('bb'); INSERT INTO t1 (a00) VALUES ('bc'); INSERT INTO t1 (a00) VALUES ('bd'); INSERT INTO t1 (a00) VALUES ('be'); INSERT INTO t1 (a00) VALUES ('bf'); 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 7 INSERT INTO t1 (a00) VALUES ('bg'); INSERT INTO t1 (a00) VALUES ('bh'); INSERT INTO t1 (a00) VALUES ('bi'); INSERT INTO t1 (a00) VALUES ('bj'); INSERT INTO t1 (a00) VALUES ('bk'); INSERT INTO t1 (a00) VALUES ('bl'); INSERT INTO t1 (a00) VALUES ('bm'); 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 INSERT INTO t1 (a00) VALUES ('bn'); INSERT INTO t1 (a00) VALUES ('bo'); INSERT INTO t1 (a00) VALUES ('bp'); INSERT INTO t1 (a00) VALUES ('bq'); INSERT INTO t1 (a00) VALUES ('br'); INSERT INTO t1 (a00) VALUES ('bs'); INSERT INTO t1 (a00) VALUES ('bt'); 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 11 INSERT INTO t1 (a00) VALUES ('bu'); INSERT INTO t1 (a00) VALUES ('bv'); INSERT INTO t1 (a00) VALUES ('bw'); INSERT INTO t1 (a00) VALUES ('bx'); INSERT INTO t1 (a00) VALUES ('by'); INSERT INTO t1 (a00) VALUES ('bz'); INSERT INTO t1 (a00) VALUES ('ca'); INSERT INTO t1 (a00) VALUES ('cb'); INSERT INTO t1 (a00) VALUES ('cc'); INSERT INTO t1 (a00) VALUES ('cd'); INSERT INTO t1 (a00) VALUES ('ce'); INSERT INTO t1 (a00) VALUES ('cf'); INSERT INTO t1 (a00) VALUES ('cg'); INSERT INTO t1 (a00) VALUES ('ch'); INSERT INTO t1 (a00) VALUES ('ci'); INSERT INTO t1 (a00) VALUES ('cj'); INSERT INTO t1 (a00) VALUES ('ck'); INSERT INTO t1 (a00) VALUES ('cl'); INSERT INTO t1 (a00) VALUES ('cm'); INSERT INTO t1 (a00) VALUES ('cn'); INSERT INTO t1 (a00) VALUES ('co'); 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 15 INSERT INTO t1 (a00) VALUES ('cp'); INSERT INTO t1 (a00) VALUES ('cq'); INSERT INTO t1 (a00) VALUES ('cr'); INSERT INTO t1 (a00) VALUES ('cs'); INSERT INTO t1 (a00) VALUES ('ct'); INSERT INTO t1 (a00) VALUES ('cu'); INSERT INTO t1 (a00) VALUES ('cv'); INSERT INTO t1 (a00) VALUES ('cw'); INSERT INTO t1 (a00) VALUES ('cx'); INSERT INTO t1 (a00) VALUES ('cy'); INSERT INTO t1 (a00) VALUES ('cz'); INSERT INTO t1 (a00) VALUES ('da'); INSERT INTO t1 (a00) VALUES ('db'); INSERT INTO t1 (a00) VALUES ('dc'); INSERT INTO t1 (a00) VALUES ('dd'); INSERT INTO t1 (a00) VALUES ('de'); INSERT INTO t1 (a00) VALUES ('df'); INSERT INTO t1 (a00) VALUES ('dg'); INSERT INTO t1 (a00) VALUES ('dh'); INSERT INTO t1 (a00) VALUES ('di'); INSERT INTO t1 (a00) VALUES ('dj'); INSERT INTO t1 (a00) VALUES ('dk'); INSERT INTO t1 (a00) VALUES ('dl'); INSERT INTO t1 (a00) VALUES ('dm'); INSERT INTO t1 (a00) VALUES ('dn'); INSERT INTO t1 (a00) VALUES ('do'); INSERT INTO t1 (a00) VALUES ('dp'); INSERT INTO t1 (a00) VALUES ('dq'); INSERT INTO t1 (a00) VALUES ('dr'); INSERT INTO t1 (a00) VALUES ('ds'); INSERT INTO t1 (a00) VALUES ('dt'); INSERT INTO t1 (a00) VALUES ('du'); INSERT INTO t1 (a00) VALUES ('dv'); INSERT INTO t1 (a00) VALUES ('dw'); INSERT INTO t1 (a00) VALUES ('dx'); INSERT INTO t1 (a00) VALUES ('dy'); INSERT INTO t1 (a00) VALUES ('dz'); INSERT INTO t1 (a00) VALUES ('ea'); INSERT INTO t1 (a00) VALUES ('eb'); INSERT INTO t1 (a00) VALUES ('ec'); INSERT INTO t1 (a00) VALUES ('ed'); INSERT INTO t1 (a00) VALUES ('ee'); INSERT INTO t1 (a00) VALUES ('ef'); INSERT INTO t1 (a00) VALUES ('eg'); INSERT INTO t1 (a00) VALUES ('eh'); INSERT INTO t1 (a00) VALUES ('ei'); INSERT INTO t1 (a00) VALUES ('ej'); INSERT INTO t1 (a00) VALUES ('ek'); INSERT INTO t1 (a00) VALUES ('el'); 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 23 INSERT INTO t1 (a00) VALUES ('em'); INSERT INTO t1 (a00) VALUES ('en'); INSERT INTO t1 (a00) VALUES ('eo'); INSERT INTO t1 (a00) VALUES ('ep'); INSERT INTO t1 (a00) VALUES ('eq'); INSERT INTO t1 (a00) VALUES ('er'); INSERT INTO t1 (a00) VALUES ('es'); INSERT INTO t1 (a00) VALUES ('et'); INSERT INTO t1 (a00) VALUES ('eu'); INSERT INTO t1 (a00) VALUES ('ev'); INSERT INTO t1 (a00) VALUES ('ew'); INSERT INTO t1 (a00) VALUES ('ex'); INSERT INTO t1 (a00) VALUES ('ey'); INSERT INTO t1 (a00) VALUES ('ez'); INSERT INTO t1 (a00) VALUES ('fa'); INSERT INTO t1 (a00) VALUES ('fb'); INSERT INTO t1 (a00) VALUES ('fc'); INSERT INTO t1 (a00) VALUES ('fd'); INSERT INTO t1 (a00) VALUES ('fe'); INSERT INTO t1 (a00) VALUES ('ff'); INSERT INTO t1 (a00) VALUES ('fg'); INSERT INTO t1 (a00) VALUES ('fh'); INSERT INTO t1 (a00) VALUES ('fi'); INSERT INTO t1 (a00) VALUES ('fj'); INSERT INTO t1 (a00) VALUES ('fk'); INSERT INTO t1 (a00) VALUES ('fl'); INSERT INTO t1 (a00) VALUES ('fm'); INSERT INTO t1 (a00) VALUES ('fn'); INSERT INTO t1 (a00) VALUES ('fo'); INSERT INTO t1 (a00) VALUES ('fp'); INSERT INTO t1 (a00) VALUES ('fq'); INSERT INTO t1 (a00) VALUES ('fr'); INSERT INTO t1 (a00) VALUES ('fs'); INSERT INTO t1 (a00) VALUES ('ft'); INSERT INTO t1 (a00) VALUES ('fu'); INSERT INTO t1 (a00) VALUES ('fv'); INSERT INTO t1 (a00) VALUES ('fw'); INSERT INTO t1 (a00) VALUES ('fx'); INSERT INTO t1 (a00) VALUES ('fy'); INSERT INTO t1 (a00) VALUES ('fz'); INSERT INTO t1 (a00) VALUES ('ga'); INSERT INTO t1 (a00) VALUES ('gb'); INSERT INTO t1 (a00) VALUES ('gc'); INSERT INTO t1 (a00) VALUES ('gd'); INSERT INTO t1 (a00) VALUES ('ge'); INSERT INTO t1 (a00) VALUES ('gf'); INSERT INTO t1 (a00) VALUES ('gg'); INSERT INTO t1 (a00) VALUES ('gh'); 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 29 SET GLOBAL innodb_limit_optimistic_insert_debug = 0; # Test start SET DEBUG_SYNC = 'RESET'; INSERT INTO t1 (a00) VALUES ('bfa'); connection con1; SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; INSERT INTO t1 (a00) VALUES ('bfb'); connection con2; SET DEBUG_SYNC = 'now WAIT_FOR reached'; SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; a00 a01 aa a SELECT a00,a01 FROM t1 WHERE a00 = 'aq'; a00 a01 aq a SELECT a00,a01 FROM t1 WHERE a00 = 'cp'; a00 a01 cp a SELECT a00,a01 FROM t1 WHERE a00 = 'el'; a00 a01 el a SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; SELECT a00,a01 FROM t1 WHERE a00 = 'ar'; connection con3; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'cn'; connection default; SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; SET DEBUG_SYNC = 'now SIGNAL continue'; connection con1; connection con2; a00 a01 ar a connection con3; a00 a01 cn a 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 30 SET DEBUG_SYNC = 'RESET'; INSERT INTO t1 (a00) VALUES ('coa'); connection con1; SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; INSERT INTO t1 (a00) VALUES ('cob'); connection con2; SET DEBUG_SYNC = 'now WAIT_FOR reached'; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; connection con3; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'el'; connection default; SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; SET DEBUG_SYNC = 'now SIGNAL continue'; connection con1; connection con2; a00 a01 aa a connection con3; a00 a01 el a 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 31 SET DEBUG_SYNC = 'RESET'; INSERT INTO t1 (a00) VALUES ('gba'); connection con1; SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue'; INSERT INTO t1 (a00) VALUES ('gbb'); connection con2; SET DEBUG_SYNC = 'now WAIT_FOR reached'; SELECT a00,a01 FROM t1 WHERE a00 = 'aa'; a00 a01 aa a SELECT a00,a01 FROM t1 WHERE a00 = 'ek'; a00 a01 ek a SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; SELECT a00,a01 FROM t1 WHERE a00 = 'el'; connection con3; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2'; SELECT a00,a01 FROM t1 WHERE a00 = 'gb'; connection default; SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1'; SET DEBUG_SYNC = 'now SIGNAL continue'; connection con1; connection con2; a00 a01 el a connection con3; a00 a01 gb a 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 32 SET DEBUG_SYNC = 'RESET'; connection default; disconnect con1; disconnect con2; disconnect con3; DROP TABLE t1;