Commit 03f3bdce authored by Marko Mäkelä's avatar Marko Mäkelä

Deterministically wait for purge using wait_all_purged.inc

parent 6f623907
set default_storage_engine=innodb; set default_storage_engine=innodb;
set @old_dbug=@@global.debug_dbug; set @old_dbug=@@global.debug_dbug;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
CREATE TABLE `t` ( CREATE TABLE `t` (
`a` BLOB, `a` BLOB,
`b` BLOB, `b` BLOB,
...@@ -12,9 +14,7 @@ INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2); ...@@ -12,9 +14,7 @@ INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100)); CREATE INDEX idx ON t(c(100));
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="+d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%";
select sleep(3); InnoDB 0 transactions not purged
sleep(3)
0
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
DROP TABLE t; DROP TABLE t;
CREATE TABLE t ( CREATE TABLE t (
...@@ -29,9 +29,7 @@ INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); ...@@ -29,9 +29,7 @@ INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100)); CREATE INDEX idx ON t(c(100));
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="+d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%";
select sleep(3); InnoDB 0 transactions not purged
sleep(3)
0
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
DROP TABLE t; DROP TABLE t;
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -52,9 +50,7 @@ insert into t1 values(4, 18, default); ...@@ -52,9 +50,7 @@ insert into t1 values(4, 18, default);
CREATE INDEX idx ON t1(x); CREATE INDEX idx ON t1(x);
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="+d,ib_purge_virtual_index_callback";
UPDATE t1 SET id = 10 WHERE id = 1; UPDATE t1 SET id = 10 WHERE id = 1;
select sleep(3); InnoDB 0 transactions not purged
sleep(3)
0
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
DROP TABLE t1; DROP TABLE t1;
connect con1,localhost,root,,; connect con1,localhost,root,,;
...@@ -80,7 +76,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; ...@@ -80,7 +76,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR uncommitted';
# enable purge # enable purge
COMMIT; COMMIT;
# wait for purge to process the deleted records. # wait for purge to process the deleted records.
Timeout in wait_innodb_all_purged.inc for INNODB_PURGE_TRX_ID_AGE = 4 InnoDB 0 transactions not purged
SET DEBUG_SYNC= 'now SIGNAL purged'; SET DEBUG_SYNC= 'now SIGNAL purged';
connection default; connection default;
/* connection default */ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED; /* connection default */ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED;
...@@ -119,6 +115,7 @@ INSERT INTO t1(a, b) VALUES (8, 8); ...@@ -119,6 +115,7 @@ INSERT INTO t1(a, b) VALUES (8, 8);
# enable purge # enable purge
COMMIT; COMMIT;
# wait for purge to process the deleted/updated records. # wait for purge to process the deleted/updated records.
InnoDB 1 transactions not purged
SET DEBUG_SYNC= 'now SIGNAL purged'; SET DEBUG_SYNC= 'now SIGNAL purged';
disconnect con1; disconnect con1;
connection default; connection default;
...@@ -141,20 +138,26 @@ DROP TABLE t0, t1; ...@@ -141,20 +138,26 @@ DROP TABLE t0, t1;
create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100)));
insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk");
insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm");
set global innodb_purge_stop_now = 1;
set global debug_dbug="+d,ib_purge_virtual_index_callback"; set global debug_dbug="+d,ib_purge_virtual_index_callback";
connect prevent_purge, localhost, root;
start transaction with consistent snapshot;
connection default;
update t set a = repeat('m', 16000) where a like "aaa%"; update t set a = repeat('m', 16000) where a like "aaa%";
connect con1, localhost, root; connect con1, localhost, root;
lock table t write; lock table t write;
disconnect prevent_purge;
connection default; connection default;
set global innodb_purge_run_now=1;
select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age';
variable_value>1 variable_value>1
1 1
disconnect con1; disconnect con1;
start transaction with consistent snapshot;
commit;
InnoDB 0 transactions not purged
select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age';
variable_value>1 variable_value>1
0 0
set global debug_dbug=@old_dbug; set global debug_dbug=@old_dbug;
drop table t; drop table t;
set debug_sync=reset; set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
set default_storage_engine=innodb; set default_storage_engine=innodb;
set @old_dbug=@@global.debug_dbug; set @old_dbug=@@global.debug_dbug;
# 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;
CREATE TABLE `t` ( CREATE TABLE `t` (
`a` BLOB, `a` BLOB,
...@@ -21,11 +24,10 @@ CREATE INDEX idx ON t(c(100)); ...@@ -21,11 +24,10 @@ CREATE INDEX idx ON t(c(100));
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="+d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%";
select sleep(3); --source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
DROP TABLE t; DROP TABLE t;
CREATE TABLE t ( CREATE TABLE t (
a TINYBLOB, a TINYBLOB,
b TINYBLOB, b TINYBLOB,
...@@ -41,7 +43,7 @@ CREATE INDEX idx ON t(c(100)); ...@@ -41,7 +43,7 @@ CREATE INDEX idx ON t(c(100));
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="+d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%";
select sleep(3); --source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
DROP TABLE t; DROP TABLE t;
...@@ -68,7 +70,7 @@ CREATE INDEX idx ON t1(x); ...@@ -68,7 +70,7 @@ CREATE INDEX idx ON t1(x);
SET global debug_dbug="+d,ib_purge_virtual_index_callback"; SET global debug_dbug="+d,ib_purge_virtual_index_callback";
UPDATE t1 SET id = 10 WHERE id = 1; UPDATE t1 SET id = 10 WHERE id = 1;
select sleep(3); --source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug; SET global debug_dbug=@old_dbug;
DROP TABLE t1; DROP TABLE t1;
...@@ -109,7 +111,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; ...@@ -109,7 +111,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR uncommitted';
COMMIT; COMMIT;
--echo # wait for purge to process the deleted records. --echo # wait for purge to process the deleted records.
--source include/wait_innodb_all_purged.inc --source ../../innodb/include/wait_all_purged.inc
SET DEBUG_SYNC= 'now SIGNAL purged'; SET DEBUG_SYNC= 'now SIGNAL purged';
...@@ -154,7 +156,7 @@ INSERT INTO t1(a, b) VALUES (8, 8); ...@@ -154,7 +156,7 @@ INSERT INTO t1(a, b) VALUES (8, 8);
COMMIT; COMMIT;
--echo # wait for purge to process the deleted/updated records. --echo # wait for purge to process the deleted/updated records.
--source include/wait_innodb_all_purged.inc --source ../../innodb/include/wait_all_purged.inc
SET DEBUG_SYNC= 'now SIGNAL purged'; SET DEBUG_SYNC= 'now SIGNAL purged';
...@@ -175,20 +177,24 @@ DROP TABLE t0, t1; ...@@ -175,20 +177,24 @@ DROP TABLE t0, t1;
create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100))); create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100)));
insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk"); insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk");
insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm"); insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm");
set global innodb_purge_stop_now = 1;
set global debug_dbug="+d,ib_purge_virtual_index_callback"; set global debug_dbug="+d,ib_purge_virtual_index_callback";
connect(prevent_purge, localhost, root);
start transaction with consistent snapshot;
connection default;
update t set a = repeat('m', 16000) where a like "aaa%"; update t set a = repeat('m', 16000) where a like "aaa%";
connect(con1, localhost, root); connect(con1, localhost, root);
lock table t write; lock table t write;
disconnect prevent_purge;
connection default; connection default;
set global innodb_purge_run_now=1;
sleep 3;
select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age';
disconnect con1; disconnect con1;
sleep 3; start transaction with consistent snapshot;
commit;
--source ../../innodb/include/wait_all_purged.inc
select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age'; select variable_value>1 from information_schema.global_status where variable_name='innodb_purge_trx_id_age';
set global debug_dbug=@old_dbug; set global debug_dbug=@old_dbug;
drop table t; drop table t;
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
set debug_sync=reset; set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
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