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
# 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;
--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;
......@@ -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
......
......@@ -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
......
......@@ -6,7 +6,6 @@
#
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_innodb_16k.inc
# turn on flags
......
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
......
......@@ -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;
......@@ -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
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