1--source include/have_debug.inc 2--source include/have_debug_sync.inc 3--source include/have_innodb.inc 4 5--echo # 6--echo # Bug 84366: InnoDB index dives do not detect concurrent tree changes, return 7--echo # bogus estimates 8--echo # 9 10--source include/count_sessions.inc 11 12CREATE TABLE t1 (key1 INT NOT NULL, key2 INT NOT NULL, 13 INDEX i1(key1), INDEX i2(key2)) ENGINE = InnoDB; 14 15--disable_query_log 16INSERT INTO t1 VALUES (1, 1), (2, 2); 17 18let $1=9; 19SET @d=2; 20while ($1) 21{ 22 INSERT INTO t1 SELECT key1 + @d, key2 + @d FROM t1; 23 SET @d=@d*2; 24 dec $1; 25} 26--enable_query_log 27 28SET @@GLOBAL.innodb_purge_stop_now = TRUE; 29 30ALTER TABLE t1 ADD keyC INT NOT NULL, ADD INDEX iC(keyC); 31UPDATE t1 SET keyC = key1; 32 33ANALYZE TABLE t1; 34 35--connect(con1,localhost,root,,) 36 37EXPLAIN SELECT * FROM t1 WHERE key1 = 1 OR key2 = 2 OR keyC = 12; 38 39SET DEBUG_SYNC = "btr_estimate_n_rows_in_range_between_dives SIGNAL estimate_ready WAIT_FOR estimate_finish"; 40 41send EXPLAIN SELECT * FROM t1 WHERE key1 = 1 OR key2 = 2 OR keyC = 12; 42 43connection default; 44SET DEBUG_SYNC = "now WAIT_FOR estimate_ready"; 45 46SET @@GLOBAL.innodb_purge_run_now = TRUE; 47 48--let $status_var= innodb_purge_trx_id_age 49--let $status_var_value= 0 50--source include/wait_for_status_var.inc 51 52SET DEBUG_SYNC = "now SIGNAL estimate_finish"; 53 54connection con1; 55reap; 56 57EXPLAIN SELECT * FROM t1 WHERE key1=1 or key2=2 or keyC=12; 58 59disconnect con1; 60connection default; 61 62DROP TABLE t1; 63 64--source include/wait_until_count_sessions.inc 65