From 86e0a73eaa166f752d62b31e96925e29c4fe0c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 7 Aug 2017 23:38:27 +0300 Subject: [PATCH] Remove wait_innodb_all_purged.inc The file wait_innodb_all_purged.inc waited for InnoDB purge in a way that only worked in debug builds. The file wait_all_purged.inc provides a better mechanism. --- mysql-test/include/wait_innodb_all_purged.inc | 60 --------- .../suite/gcol/r/innodb_virtual_purge.result | 5 + .../suite/gcol/t/innodb_virtual_purge.test | 11 +- .../include/innodb_merge_threshold_delete.inc | 20 +-- .../innodb_merge_threshold_secondary.inc | 19 +-- .../include/innodb_merge_threshold_update.inc | 1 - .../innodb/r/index_merge_threshold.result | 115 ++++++++---------- .../r/innodb_defragment_fill_factor.result | 4 +- .../suite/innodb/t/index_merge_threshold.test | 5 +- .../t/innodb_defragment_fill_factor.test | 11 +- 10 files changed, 83 insertions(+), 168 deletions(-) delete mode 100644 mysql-test/include/wait_innodb_all_purged.inc diff --git a/mysql-test/include/wait_innodb_all_purged.inc b/mysql-test/include/wait_innodb_all_purged.inc deleted file mode 100644 index a77e6ec1573..00000000000 --- a/mysql-test/include/wait_innodb_all_purged.inc +++ /dev/null @@ -1,60 +0,0 @@ -# include/wait_innodb_all_purged.inc -# -# SUMMARY -# -# Waits until purged all undo records of innodb, or operation times out. -# -# USAGE -# -# --source include/wait_innodb_all_purged.inc -# ---source include/have_innodb.inc - -if (`select version() like '%debug%'`) { ---disable_query_log - -let $wait_counter_init= 300; -if ($wait_timeout) -{ - let $wait_counter_init= `SELECT $wait_timeout * 10`; -} -# Reset $wait_timeout so that its value won't be used on subsequent -# calls, and default will be used instead. -let $wait_timeout= 0; - -let $wait_counter= $wait_counter_init; - -# Keep track of how many times the wait condition is tested -let $wait_condition_reps= 0; -let $prev_trx_age= 0; -while ($wait_counter) -{ - let $trx_age = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE';`; - - if ($trx_age != $prev_trx_age) - { - let $wait_counter= $wait_counter_init; - let $prev_trx_age= $trx_age; - } - - let $success= `SELECT $trx_age < 1`; - inc $wait_condition_reps; - if ($success) - { - let $wait_counter= 0; - } - if (!$success) - { - set global innodb_purge_run_now=ON; - real_sleep 0.1; - dec $wait_counter; - } -} -if (!$success) -{ - echo Timeout in wait_innodb_all_purged.inc for INNODB_PURGE_TRX_ID_AGE = $trx_age; -} - ---enable_query_log -} diff --git a/mysql-test/suite/gcol/r/innodb_virtual_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_purge.result index 658f49b4b31..308b01ded25 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_purge.result @@ -1,3 +1,5 @@ +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; # # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION # ON INDEXED VIRTUAL COLUMNS @@ -21,6 +23,7 @@ connection con1; COMMIT; UPDATE t1 SET a=1; connection default; +InnoDB 0 transactions not purged CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -119,6 +122,7 @@ connection con1; COMMIT; disconnect con1; connection default; +InnoDB 0 transactions not purged CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -138,3 +142,4 @@ CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VI CREATE INDEX idx ON t1(a2(10), b, a2(20)); ERROR 42S21: Duplicate column name 'a2' DROP TABLE t1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_purge.test index ab6ba52c2c3..4eb5d8c65b8 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_purge.test @@ -1,6 +1,10 @@ --source include/have_innodb.inc --source include/count_sessions.inc +# Ensure that the history list length will actually be decremented by purge. +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; + --echo # --echo # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION --echo # ON INDEXED VIRTUAL COLUMNS @@ -32,8 +36,7 @@ COMMIT; UPDATE t1 SET a=1; connection default; -# wait for purge to process the update_undo record (in debug builds) ---source include/wait_innodb_all_purged.inc +--source ../../innodb/include/wait_all_purged.inc CHECK TABLE t1; SELECT b1 FROM t1; @@ -118,8 +121,7 @@ COMMIT; disconnect con1; connection default; -# wait for purge to process the update_undo record (in debug builds) ---source include/wait_innodb_all_purged.inc +--source ../../innodb/include/wait_all_purged.inc CHECK TABLE t1; SELECT b1 FROM t1; @@ -136,3 +138,4 @@ CREATE INDEX idx ON t1(a2(10), b, a2(20)); DROP TABLE t1; --source include/wait_until_count_sessions.inc +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc index 6aad7afa878..8c60cd6e230 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc @@ -6,7 +6,6 @@ # --source include/have_innodb.inc ---source include/have_debug.inc --source include/have_innodb_16k.inc # turn on flags @@ -47,17 +46,17 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc # not merged yet # | 1,2,3,4 | 8,9,10,11 | @@ -72,34 +71,27 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; - -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc index 72242ea2e1b..8e821365e3f 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc @@ -7,7 +7,6 @@ # --source include/have_innodb.inc ---source include/have_debug.inc --source include/have_innodb_16k.inc # turn on flags @@ -79,7 +78,7 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -100,10 +99,10 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc # secondary index is not merged yet # | 1,..,11 | 22,..,32 | @@ -119,33 +118,27 @@ where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; # wait for purge view progress (records are deleted actually by purge) ---source include/wait_innodb_all_purged.inc +--source include/wait_all_purged.inc --echo # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc index ff34cafd24a..61e961ac6ae 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc @@ -6,7 +6,6 @@ # --source include/have_innodb.inc ---source include/have_debug.inc --source include/have_innodb_16k.inc # turn on flags diff --git a/mysql-test/suite/innodb/r/index_merge_threshold.result b/mysql-test/suite/innodb/r/index_merge_threshold.result index 092bb69aa65..35cb82e6f1e 100644 --- a/mysql-test/suite/innodb/r/index_merge_threshold.result +++ b/mysql-test/suite/innodb/r/index_merge_threshold.result @@ -1,3 +1,5 @@ +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT, c4 TINYBLOB,c5 BLOB,c6 MEDIUMBLOB,c7 LONGBLOB) ENGINE=InnoDB; CREATE INDEX index1 ON tab(c1(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51'; @@ -205,14 +207,15 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 7 5 7 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -228,27 +231,24 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 4 5 4 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 2 index_page_merge_successful 2 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -288,14 +288,15 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 7 5 7 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -311,27 +312,24 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 4 5 4 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -371,14 +369,15 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 7 5 7 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -394,27 +393,24 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 4 5 4 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -459,14 +455,15 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 7 5 7 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 12; delete from tab1 where a = 13; delete from tab1 where a = 14; delete from tab1 where a = 5; delete from tab1 where a = 6; delete from tab1 where a = 7; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -483,27 +480,24 @@ PAGE_NUMBER NUMBER_RECORDS 3 2 4 4 5 4 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 11; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 10; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=35 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 9; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=25 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -872,7 +866,7 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 21 28 21 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -893,7 +887,8 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -910,27 +905,24 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 11 28 11 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 2 index_page_merge_successful 2 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1000,7 +992,7 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 21 28 21 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -1021,7 +1013,8 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1038,27 +1031,24 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 11 28 11 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1128,7 +1118,7 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 21 28 21 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -1149,7 +1139,8 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1166,27 +1157,24 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 11 28 11 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1257,7 +1245,7 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 21 28 21 -set global innodb_purge_stop_now=ON; +begin; delete from tab1 where a = 33; delete from tab1 where a = 34; delete from tab1 where a = 35; @@ -1278,7 +1266,8 @@ delete from tab1 where a = 18; delete from tab1 where a = 19; delete from tab1 where a = 20; delete from tab1 where a = 21; -set global innodb_purge_run_now=ON; +commit; +InnoDB 0 transactions not purged # check page merge happens (nothing is expected) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1295,27 +1284,24 @@ PAGE_NUMBER NUMBER_RECORDS 4 2 27 11 28 11 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 32; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=50 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 0 index_page_merge_successful 0 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 31; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=45 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; name count_reset index_page_merge_attempts 1 index_page_merge_successful 1 -set global innodb_purge_stop_now=ON; delete from tab1 where a = 30; -set global innodb_purge_run_now=ON; +InnoDB 0 transactions not purged # check page merge happens (MERGE_THRESHOLD=40 causes merge here) SELECT name,count_reset FROM information_schema.innodb_metrics WHERE name like 'index_page_merge_%'; @@ -1323,3 +1309,4 @@ name count_reset index_page_merge_attempts 2 index_page_merge_successful 2 DROP TABLE tab1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result index e1e616a7e6f..5809542db8a 100644 --- a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result +++ b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result @@ -1,5 +1,3 @@ -DROP TABLE if exists t1; -DROP TABLE if exists t2; Testing tables with large records CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c VARCHAR(256), KEY SECOND(a, b,c)) ENGINE=INNODB; INSERT INTO t1 VALUES (1, REPEAT('A', 256), REPEAT('B', 256)); @@ -13,6 +11,7 @@ INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1; +SET GLOBAL innodb_fast_shutdown = 0; optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK @@ -57,6 +56,7 @@ insert into t1 values (204, REPEAT('A', 256), REPEAT('B', 256)); DROP TABLE t1; Testing table with small records CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(16), c VARCHAR(32), KEY SECOND(a,b,c)) ENGINE=INNODB; +SET GLOBAL innodb_fast_shutdown = 0; optimize table t2; Table Op Msg_type Msg_text test.t2 optimize status OK diff --git a/mysql-test/suite/innodb/t/index_merge_threshold.test b/mysql-test/suite/innodb/t/index_merge_threshold.test index 7cbde0acf03..a587e10db6c 100644 --- a/mysql-test/suite/innodb/t/index_merge_threshold.test +++ b/mysql-test/suite/innodb/t/index_merge_threshold.test @@ -11,9 +11,11 @@ # Check actual behavior for table, partitioned table and temporary table # ############################################################# --source include/have_innodb_16k.inc ---source include/have_debug.inc --source include/have_partition.inc +SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency; +SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; + # Check index merge threshold by create index on all datatypes CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT, @@ -187,3 +189,4 @@ CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=45'; --source suite/innodb/include/innodb_merge_threshold_secondary.inc DROP TABLE tab1; +SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test index 2edc8a45c02..3a5897b9911 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test +++ b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test @@ -4,11 +4,6 @@ --source include/not_embedded.inc --source include/have_innodb_16k.inc ---disable_warnings -DROP TABLE if exists t1; -DROP TABLE if exists t2; ---enable_warnings - --echo Testing tables with large records # Create table. CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c VARCHAR(256), KEY SECOND(a, b,c)) ENGINE=INNODB; @@ -36,7 +31,7 @@ while ($size) } --enable_query_log ---source include/wait_innodb_all_purged.inc +SET GLOBAL innodb_fast_shutdown = 0; --source include/restart_mysqld.inc optimize table t1; @@ -135,7 +130,7 @@ while ($size) } --enable_query_log ---source include/wait_innodb_all_purged.inc +SET GLOBAL innodb_fast_shutdown = 0; --source include/restart_mysqld.inc optimize table t2; @@ -206,5 +201,3 @@ if ($second_before == $second_after) { } DROP TABLE t2; - ---source include/wait_innodb_all_purged.inc