Commit 2850b8d8 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-20389 The test innodb.innodb_bug84958 fails intermittently

* Ensure no background purge is done;
* Better result showing actual number in case of failure;
* Higher and more safe difference threshold.
parent 6dd1d6cb
...@@ -4,13 +4,18 @@ ...@@ -4,13 +4,18 @@
# #
# Set up the test with a procedure and a function. # Set up the test with a procedure and a function.
# #
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency= 1;
InnoDB 0 transactions not purged
CREATE PROCEDURE insert_n(start int, end int) CREATE PROCEDURE insert_n(start int, end int)
BEGIN BEGIN
DECLARE i INT DEFAULT start; DECLARE i INT DEFAULT start;
START TRANSACTION;
WHILE i <= end do WHILE i <= end do
INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i; INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i;
SET i = i + 1; SET i = i + 1;
END WHILE; END WHILE;
COMMIT;
END~~ END~~
CREATE FUNCTION num_pages_get() CREATE FUNCTION num_pages_get()
RETURNS INT RETURNS INT
...@@ -51,9 +56,9 @@ SET @num_pages_1 = num_pages_get(); ...@@ -51,9 +56,9 @@ SET @num_pages_1 = num_pages_get();
SELECT * FROM t1 force index (b); SELECT * FROM t1 force index (b);
a b c a b c
SET @num_pages_2= num_pages_get(); SET @num_pages_2= num_pages_get();
SELECT @num_pages_2 - @num_pages_1 < 500; SELECT IF(@num_pages_2 - @num_pages_1 < 5000, 'OK', @num_pages_2 - @num_pages_1) num_pages_diff;
@num_pages_2 - @num_pages_1 < 500 num_pages_diff
1 OK
# #
# Commit and show the final record. # Commit and show the final record.
# #
...@@ -76,6 +81,7 @@ test.t1 check status OK ...@@ -76,6 +81,7 @@ test.t1 check status OK
# #
disconnect con2; disconnect con2;
disconnect con3; disconnect con3;
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE insert_n; DROP PROCEDURE insert_n;
DROP FUNCTION num_pages_get; DROP FUNCTION num_pages_get;
...@@ -6,15 +6,20 @@ ...@@ -6,15 +6,20 @@
--echo # --echo #
--source include/have_innodb.inc --source include/have_innodb.inc
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency= 1;
--source include/wait_all_purged.inc
DELIMITER ~~; DELIMITER ~~;
CREATE PROCEDURE insert_n(start int, end int) CREATE PROCEDURE insert_n(start int, end int)
BEGIN BEGIN
DECLARE i INT DEFAULT start; DECLARE i INT DEFAULT start;
START TRANSACTION;
WHILE i <= end do WHILE i <= end do
INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i; INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i;
SET i = i + 1; SET i = i + 1;
END WHILE; END WHILE;
COMMIT;
END~~ END~~
CREATE FUNCTION num_pages_get() CREATE FUNCTION num_pages_get()
...@@ -64,7 +69,7 @@ SET @num_pages_1 = num_pages_get(); ...@@ -64,7 +69,7 @@ SET @num_pages_1 = num_pages_get();
SELECT * FROM t1 force index (b); SELECT * FROM t1 force index (b);
SET @num_pages_2= num_pages_get(); SET @num_pages_2= num_pages_get();
SELECT @num_pages_2 - @num_pages_1 < 500; SELECT IF(@num_pages_2 - @num_pages_1 < 5000, 'OK', @num_pages_2 - @num_pages_1) num_pages_diff;
--echo # --echo #
--echo # Commit and show the final record. --echo # Commit and show the final record.
...@@ -81,6 +86,7 @@ CHECK TABLE t1; ...@@ -81,6 +86,7 @@ CHECK TABLE t1;
--echo # --echo #
disconnect con2; disconnect con2;
disconnect con3; disconnect con3;
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE insert_n; DROP PROCEDURE insert_n;
DROP FUNCTION num_pages_get; DROP FUNCTION num_pages_get;
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