Commit 86e0a73e authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 03f3bdce
# 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
}
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 # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION
# ON INDEXED VIRTUAL COLUMNS # ON INDEXED VIRTUAL COLUMNS
...@@ -21,6 +23,7 @@ connection con1; ...@@ -21,6 +23,7 @@ connection con1;
COMMIT; COMMIT;
UPDATE t1 SET a=1; UPDATE t1 SET a=1;
connection default; connection default;
InnoDB 0 transactions not purged
CHECK TABLE t1; CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
...@@ -119,6 +122,7 @@ connection con1; ...@@ -119,6 +122,7 @@ connection con1;
COMMIT; COMMIT;
disconnect con1; disconnect con1;
connection default; connection default;
InnoDB 0 transactions not purged
CHECK TABLE t1; CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK 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 ...@@ -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)); CREATE INDEX idx ON t1(a2(10), b, a2(20));
ERROR 42S21: Duplicate column name 'a2' ERROR 42S21: Duplicate column name 'a2'
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/count_sessions.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 #
--echo # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION --echo # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION
--echo # ON INDEXED VIRTUAL COLUMNS --echo # ON INDEXED VIRTUAL COLUMNS
...@@ -32,8 +36,7 @@ COMMIT; ...@@ -32,8 +36,7 @@ COMMIT;
UPDATE t1 SET a=1; UPDATE t1 SET a=1;
connection default; connection default;
# wait for purge to process the update_undo record (in debug builds) --source ../../innodb/include/wait_all_purged.inc
--source include/wait_innodb_all_purged.inc
CHECK TABLE t1; CHECK TABLE t1;
SELECT b1 FROM t1; SELECT b1 FROM t1;
...@@ -118,8 +121,7 @@ COMMIT; ...@@ -118,8 +121,7 @@ COMMIT;
disconnect con1; disconnect con1;
connection default; connection default;
# wait for purge to process the update_undo record (in debug builds) --source ../../innodb/include/wait_all_purged.inc
--source include/wait_innodb_all_purged.inc
CHECK TABLE t1; CHECK TABLE t1;
SELECT b1 FROM t1; SELECT b1 FROM t1;
...@@ -136,3 +138,4 @@ CREATE INDEX idx ON t1(a2(10), b, a2(20)); ...@@ -136,3 +138,4 @@ CREATE INDEX idx ON t1(a2(10), b, a2(20));
DROP TABLE t1; DROP TABLE t1;
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
# #
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_innodb_16k.inc --source include/have_innodb_16k.inc
# turn on flags # turn on flags
...@@ -47,17 +46,17 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 ...@@ -47,17 +46,17 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; 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 = 12;
delete from tab1 where a = 13; delete from tab1 where a = 13;
delete from tab1 where a = 14; delete from tab1 where a = 14;
delete from tab1 where a = 5; delete from tab1 where a = 5;
delete from tab1 where a = 6; delete from tab1 where a = 6;
delete from tab1 where a = 7; 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) # 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 # not merged yet
# | 1,2,3,4 | 8,9,10,11 | # | 1,2,3,4 | 8,9,10,11 |
...@@ -72,34 +71,27 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 ...@@ -72,34 +71,27 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS;
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 11; delete from tab1 where a = 11;
set global innodb_purge_run_now=ON;
# wait for purge view progress (records are deleted actually by purge) # 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) --echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 10; delete from tab1 where a = 10;
set global innodb_purge_run_now=ON;
# wait for purge view progress (records are deleted actually by purge) # 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) --echo # check page merge happens (MERGE_THRESHOLD=35 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 9; delete from tab1 where a = 9;
set global innodb_purge_run_now=ON;
# wait for purge view progress (records are deleted actually by purge) # 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) --echo # check page merge happens (MERGE_THRESHOLD=25 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
# #
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_innodb_16k.inc --source include/have_innodb_16k.inc
# turn on flags # turn on flags
...@@ -79,7 +78,7 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2 ...@@ -79,7 +78,7 @@ INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; 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 = 33;
delete from tab1 where a = 34; delete from tab1 where a = 34;
delete from tab1 where a = 35; delete from tab1 where a = 35;
...@@ -100,10 +99,10 @@ delete from tab1 where a = 18; ...@@ -100,10 +99,10 @@ delete from tab1 where a = 18;
delete from tab1 where a = 19; delete from tab1 where a = 19;
delete from tab1 where a = 20; delete from tab1 where a = 20;
delete from tab1 where a = 21; 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) # 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 # secondary index is not merged yet
# | 1,..,11 | 22,..,32 | # | 1,..,11 | 22,..,32 |
...@@ -119,33 +118,27 @@ where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%' ...@@ -119,33 +118,27 @@ where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS; and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS;
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 32; delete from tab1 where a = 32;
set global innodb_purge_run_now=ON;
# wait for purge view progress (records are deleted actually by purge) # 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) --echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 31; delete from tab1 where a = 31;
set global innodb_purge_run_now=ON;
# wait for purge view progress (records are deleted actually by purge) # 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) --echo # check page merge happens (MERGE_THRESHOLD=45 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 30; delete from tab1 where a = 30;
set global innodb_purge_run_now=ON;
# wait for purge view progress (records are deleted actually by purge) # 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) --echo # check page merge happens (MERGE_THRESHOLD=40 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
# #
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_innodb_16k.inc --source include/have_innodb_16k.inc
# turn on flags # turn on flags
......
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, CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT,
c4 TINYBLOB,c5 BLOB,c6 MEDIUMBLOB,c7 LONGBLOB) ENGINE=InnoDB; 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'; CREATE INDEX index1 ON tab(c1(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51';
...@@ -205,14 +207,15 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -205,14 +207,15 @@ PAGE_NUMBER NUMBER_RECORDS
3 2 3 2
4 7 4 7
5 7 5 7
set global innodb_purge_stop_now=ON; begin;
delete from tab1 where a = 12; delete from tab1 where a = 12;
delete from tab1 where a = 13; delete from tab1 where a = 13;
delete from tab1 where a = 14; delete from tab1 where a = 14;
delete from tab1 where a = 5; delete from tab1 where a = 5;
delete from tab1 where a = 6; delete from tab1 where a = 6;
delete from tab1 where a = 7; 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) # check page merge happens (nothing is expected)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -228,27 +231,24 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -228,27 +231,24 @@ PAGE_NUMBER NUMBER_RECORDS
3 2 3 2
4 4 4 4
5 4 5 4
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 11; 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) # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 1 index_page_merge_attempts 1
index_page_merge_successful 1 index_page_merge_successful 1
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 10; 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) # check page merge happens (MERGE_THRESHOLD=35 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 2 index_page_merge_attempts 2
index_page_merge_successful 2 index_page_merge_successful 2
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 9; 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) # check page merge happens (MERGE_THRESHOLD=25 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -288,14 +288,15 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -288,14 +288,15 @@ PAGE_NUMBER NUMBER_RECORDS
3 2 3 2
4 7 4 7
5 7 5 7
set global innodb_purge_stop_now=ON; begin;
delete from tab1 where a = 12; delete from tab1 where a = 12;
delete from tab1 where a = 13; delete from tab1 where a = 13;
delete from tab1 where a = 14; delete from tab1 where a = 14;
delete from tab1 where a = 5; delete from tab1 where a = 5;
delete from tab1 where a = 6; delete from tab1 where a = 6;
delete from tab1 where a = 7; 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) # check page merge happens (nothing is expected)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -311,27 +312,24 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -311,27 +312,24 @@ PAGE_NUMBER NUMBER_RECORDS
3 2 3 2
4 4 4 4
5 4 5 4
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 11; 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) # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 0 index_page_merge_attempts 0
index_page_merge_successful 0 index_page_merge_successful 0
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 10; 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) # check page merge happens (MERGE_THRESHOLD=35 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 1 index_page_merge_attempts 1
index_page_merge_successful 1 index_page_merge_successful 1
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 9; 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) # check page merge happens (MERGE_THRESHOLD=25 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -371,14 +369,15 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -371,14 +369,15 @@ PAGE_NUMBER NUMBER_RECORDS
3 2 3 2
4 7 4 7
5 7 5 7
set global innodb_purge_stop_now=ON; begin;
delete from tab1 where a = 12; delete from tab1 where a = 12;
delete from tab1 where a = 13; delete from tab1 where a = 13;
delete from tab1 where a = 14; delete from tab1 where a = 14;
delete from tab1 where a = 5; delete from tab1 where a = 5;
delete from tab1 where a = 6; delete from tab1 where a = 6;
delete from tab1 where a = 7; 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) # check page merge happens (nothing is expected)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -394,27 +393,24 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -394,27 +393,24 @@ PAGE_NUMBER NUMBER_RECORDS
3 2 3 2
4 4 4 4
5 4 5 4
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 11; 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) # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 0 index_page_merge_attempts 0
index_page_merge_successful 0 index_page_merge_successful 0
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 10; 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) # check page merge happens (MERGE_THRESHOLD=35 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 0 index_page_merge_attempts 0
index_page_merge_successful 0 index_page_merge_successful 0
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 9; 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) # check page merge happens (MERGE_THRESHOLD=25 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -459,14 +455,15 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -459,14 +455,15 @@ PAGE_NUMBER NUMBER_RECORDS
3 2 3 2
4 7 4 7
5 7 5 7
set global innodb_purge_stop_now=ON; begin;
delete from tab1 where a = 12; delete from tab1 where a = 12;
delete from tab1 where a = 13; delete from tab1 where a = 13;
delete from tab1 where a = 14; delete from tab1 where a = 14;
delete from tab1 where a = 5; delete from tab1 where a = 5;
delete from tab1 where a = 6; delete from tab1 where a = 6;
delete from tab1 where a = 7; 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) # check page merge happens (nothing is expected)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -483,27 +480,24 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -483,27 +480,24 @@ PAGE_NUMBER NUMBER_RECORDS
3 2 3 2
4 4 4 4
5 4 5 4
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 11; 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) # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 0 index_page_merge_attempts 0
index_page_merge_successful 0 index_page_merge_successful 0
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 10; 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) # check page merge happens (MERGE_THRESHOLD=35 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 1 index_page_merge_attempts 1
index_page_merge_successful 1 index_page_merge_successful 1
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 9; 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) # check page merge happens (MERGE_THRESHOLD=25 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -872,7 +866,7 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -872,7 +866,7 @@ PAGE_NUMBER NUMBER_RECORDS
4 2 4 2
27 21 27 21
28 21 28 21
set global innodb_purge_stop_now=ON; begin;
delete from tab1 where a = 33; delete from tab1 where a = 33;
delete from tab1 where a = 34; delete from tab1 where a = 34;
delete from tab1 where a = 35; delete from tab1 where a = 35;
...@@ -893,7 +887,8 @@ delete from tab1 where a = 18; ...@@ -893,7 +887,8 @@ delete from tab1 where a = 18;
delete from tab1 where a = 19; delete from tab1 where a = 19;
delete from tab1 where a = 20; delete from tab1 where a = 20;
delete from tab1 where a = 21; 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) # check page merge happens (nothing is expected)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -910,27 +905,24 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -910,27 +905,24 @@ PAGE_NUMBER NUMBER_RECORDS
4 2 4 2
27 11 27 11
28 11 28 11
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 32; 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) # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 1 index_page_merge_attempts 1
index_page_merge_successful 1 index_page_merge_successful 1
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 31; 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) # check page merge happens (MERGE_THRESHOLD=45 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 2 index_page_merge_attempts 2
index_page_merge_successful 2 index_page_merge_successful 2
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 30; 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) # check page merge happens (MERGE_THRESHOLD=40 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -1000,7 +992,7 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -1000,7 +992,7 @@ PAGE_NUMBER NUMBER_RECORDS
4 2 4 2
27 21 27 21
28 21 28 21
set global innodb_purge_stop_now=ON; begin;
delete from tab1 where a = 33; delete from tab1 where a = 33;
delete from tab1 where a = 34; delete from tab1 where a = 34;
delete from tab1 where a = 35; delete from tab1 where a = 35;
...@@ -1021,7 +1013,8 @@ delete from tab1 where a = 18; ...@@ -1021,7 +1013,8 @@ delete from tab1 where a = 18;
delete from tab1 where a = 19; delete from tab1 where a = 19;
delete from tab1 where a = 20; delete from tab1 where a = 20;
delete from tab1 where a = 21; 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) # check page merge happens (nothing is expected)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -1038,27 +1031,24 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -1038,27 +1031,24 @@ PAGE_NUMBER NUMBER_RECORDS
4 2 4 2
27 11 27 11
28 11 28 11
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 32; 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) # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 0 index_page_merge_attempts 0
index_page_merge_successful 0 index_page_merge_successful 0
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 31; 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) # check page merge happens (MERGE_THRESHOLD=45 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 1 index_page_merge_attempts 1
index_page_merge_successful 1 index_page_merge_successful 1
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 30; 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) # check page merge happens (MERGE_THRESHOLD=40 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -1128,7 +1118,7 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -1128,7 +1118,7 @@ PAGE_NUMBER NUMBER_RECORDS
4 2 4 2
27 21 27 21
28 21 28 21
set global innodb_purge_stop_now=ON; begin;
delete from tab1 where a = 33; delete from tab1 where a = 33;
delete from tab1 where a = 34; delete from tab1 where a = 34;
delete from tab1 where a = 35; delete from tab1 where a = 35;
...@@ -1149,7 +1139,8 @@ delete from tab1 where a = 18; ...@@ -1149,7 +1139,8 @@ delete from tab1 where a = 18;
delete from tab1 where a = 19; delete from tab1 where a = 19;
delete from tab1 where a = 20; delete from tab1 where a = 20;
delete from tab1 where a = 21; 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) # check page merge happens (nothing is expected)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -1166,27 +1157,24 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -1166,27 +1157,24 @@ PAGE_NUMBER NUMBER_RECORDS
4 2 4 2
27 11 27 11
28 11 28 11
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 32; 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) # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 0 index_page_merge_attempts 0
index_page_merge_successful 0 index_page_merge_successful 0
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 31; 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) # check page merge happens (MERGE_THRESHOLD=45 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 0 index_page_merge_attempts 0
index_page_merge_successful 0 index_page_merge_successful 0
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 30; 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) # check page merge happens (MERGE_THRESHOLD=40 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -1257,7 +1245,7 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -1257,7 +1245,7 @@ PAGE_NUMBER NUMBER_RECORDS
4 2 4 2
27 21 27 21
28 21 28 21
set global innodb_purge_stop_now=ON; begin;
delete from tab1 where a = 33; delete from tab1 where a = 33;
delete from tab1 where a = 34; delete from tab1 where a = 34;
delete from tab1 where a = 35; delete from tab1 where a = 35;
...@@ -1278,7 +1266,8 @@ delete from tab1 where a = 18; ...@@ -1278,7 +1266,8 @@ delete from tab1 where a = 18;
delete from tab1 where a = 19; delete from tab1 where a = 19;
delete from tab1 where a = 20; delete from tab1 where a = 20;
delete from tab1 where a = 21; 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) # check page merge happens (nothing is expected)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -1295,27 +1284,24 @@ PAGE_NUMBER NUMBER_RECORDS ...@@ -1295,27 +1284,24 @@ PAGE_NUMBER NUMBER_RECORDS
4 2 4 2
27 11 27 11
28 11 28 11
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 32; 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) # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 0 index_page_merge_attempts 0
index_page_merge_successful 0 index_page_merge_successful 0
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 31; 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) # check page merge happens (MERGE_THRESHOLD=45 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
name count_reset name count_reset
index_page_merge_attempts 1 index_page_merge_attempts 1
index_page_merge_successful 1 index_page_merge_successful 1
set global innodb_purge_stop_now=ON;
delete from tab1 where a = 30; 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) # check page merge happens (MERGE_THRESHOLD=40 causes merge here)
SELECT name,count_reset FROM information_schema.innodb_metrics SELECT name,count_reset FROM information_schema.innodb_metrics
WHERE name like 'index_page_merge_%'; WHERE name like 'index_page_merge_%';
...@@ -1323,3 +1309,4 @@ name count_reset ...@@ -1323,3 +1309,4 @@ name count_reset
index_page_merge_attempts 2 index_page_merge_attempts 2
index_page_merge_successful 2 index_page_merge_successful 2
DROP TABLE tab1; DROP TABLE tab1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
DROP TABLE if exists t1;
DROP TABLE if exists t2;
Testing tables with large records 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; 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)); INSERT INTO t1 VALUES (1, REPEAT('A', 256), REPEAT('B', 256));
...@@ -13,6 +11,7 @@ INSERT INTO t1 (b) SELECT b from t1; ...@@ -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; 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; optimize table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize status OK test.t1 optimize status OK
...@@ -57,6 +56,7 @@ insert into t1 values (204, REPEAT('A', 256), REPEAT('B', 256)); ...@@ -57,6 +56,7 @@ insert into t1 values (204, REPEAT('A', 256), REPEAT('B', 256));
DROP TABLE t1; DROP TABLE t1;
Testing table with small records 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; 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; optimize table t2;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t2 optimize status OK test.t2 optimize status OK
......
...@@ -11,9 +11,11 @@ ...@@ -11,9 +11,11 @@
# Check actual behavior for table, partitioned table and temporary table # Check actual behavior for table, partitioned table and temporary table
# ############################################################# # #############################################################
--source include/have_innodb_16k.inc --source include/have_innodb_16k.inc
--source include/have_debug.inc
--source include/have_partition.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 # Check index merge threshold by create index on all datatypes
CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT, 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'; ...@@ -187,3 +189,4 @@ CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=45';
--source suite/innodb/include/innodb_merge_threshold_secondary.inc --source suite/innodb/include/innodb_merge_threshold_secondary.inc
DROP TABLE tab1; DROP TABLE tab1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
...@@ -4,11 +4,6 @@ ...@@ -4,11 +4,6 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_innodb_16k.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 --echo Testing tables with large records
# Create table. # 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; 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) ...@@ -36,7 +31,7 @@ while ($size)
} }
--enable_query_log --enable_query_log
--source include/wait_innodb_all_purged.inc SET GLOBAL innodb_fast_shutdown = 0;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
optimize table t1; optimize table t1;
...@@ -135,7 +130,7 @@ while ($size) ...@@ -135,7 +130,7 @@ while ($size)
} }
--enable_query_log --enable_query_log
--source include/wait_innodb_all_purged.inc SET GLOBAL innodb_fast_shutdown = 0;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
optimize table t2; optimize table t2;
...@@ -206,5 +201,3 @@ if ($second_before == $second_after) { ...@@ -206,5 +201,3 @@ if ($second_before == $second_after) {
} }
DROP TABLE t2; DROP TABLE t2;
--source include/wait_innodb_all_purged.inc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment