Bug #95247 innodb.innodb_bug84958 failed with result mismatch
Submitted: 4 May 2019 10:42 Modified: 10 May 2019 7:50
Reporter: Fungo Wang (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S7 (Test Cases)
Version:8.0.13, 8.0.16 OS:Any
Assigned to: CPU Architecture:Any

[4 May 2019 10:42] Fungo Wang
Description:
Build using debug mode, then run

./mtr innodb.innodb_bug84958

Testcase failed with error msg as bellow,

@@ -43,7 +43,7 @@
 SET @num_pages_2= num_pages_get();
 SELECT @num_pages_2 - @num_pages_1 < 500;
 @num_pages_2 - @num_pages_1 < 500
-1
+0
 #
 # Commit and show the final record.
 #

How to repeat:
To make the failure stable, and also repeatable in release building, you can add a sleep interval:

diff --git a/mysql-test/suite/innodb/t/innodb_bug84958.test b/mysql-test/suite/innodb/t/innodb_bug84958.test
index 7eb59b99478..b430f964f46 100644
--- a/mysql-test/suite/innodb/t/innodb_bug84958.test
+++ b/mysql-test/suite/innodb/t/innodb_bug84958.test
@@ -55,6 +55,7 @@ connection default;
 --echo # when selecting the record using the secondary key.
 --echo #
 SET @num_pages_1 = num_pages_get();
+sleep 5;
 SELECT * FROM t1 force index (b);
 SET @num_pages_2= num_pages_get();

Suggested fix:
The case is interfered by InnoDB background thread, such as purge thread (mainly thread), stats update thread, log checkpoint thread etc. So we can disable such background threads (mainly purge thread), which is only possible in debug mode.

diff --git a/mysql-test/suite/innodb/t/innodb_bug84958.test b/mysql-test/suite/innodb/t/innodb_bug84958.test
index 7eb59b99478..d5ec39d6449 100644
--- a/mysql-test/suite/innodb/t/innodb_bug84958.test
+++ b/mysql-test/suite/innodb/t/innodb_bug84958.test
@@ -1,3 +1,4 @@
+--source include/have_debug.inc
 --echo #
 --echo # Bug #84958 InnoDB's MVCC has O(N^2) behaviors
 --echo # https://bugs.mysql.com/bug.php?id=84958
@@ -23,6 +24,10 @@ BEGIN
 END~~
 DELIMITER ;~~

+SET GLOBAL innodb_purge_stop_now = ON;
+SET GLOBAL innodb_dict_stats_disabled_debug = ON;
+SET GLOBAL innodb_checkpoint_disabled = ON;
+
 --echo #
 --echo # Create a table with one record in it and start an RR transaction
 --echo #
@@ -78,3 +83,6 @@ disconnect con3;
 DROP TABLE t1;
 DROP PROCEDURE insert_n;
 DROP FUNCTION num_pages_get;
+SET GLOBAL innodb_purge_stop_now = default;
+SET GLOBAL innodb_dict_stats_disabled_debug = default;
+SET GLOBAL innodb_checkpoint_disabled = default;
[4 May 2019 16:51] MySQL Verification Team
Hello Fungo Wang,

Thank you for the report and test case.
Observed this with 8.0.16 debug build.

Thanks,
Umesh
[5 May 2019 10:08] Erlend Dahl
IT seems we need

SET GLOBAL innodb_purge_run_now = ON;

otherwise subsequent tests that restart the server will fail (cf. bug#89503).
[5 May 2019 10:58] Fungo Wang
Yes, you're right.

SET GLOBAL innodb_purge_run_now = ON; 
should be used at cleanup, instead of
SET GLOBAL innodb_purge_stop_now = default;

--- a/mysql-test/suite/innodb/t/innodb_bug84958.test
+++ b/mysql-test/suite/innodb/t/innodb_bug84958.test
@@ -1,3 +1,4 @@
+--source include/have_debug.inc
 --echo #
 --echo # Bug #84958 InnoDB's MVCC has O(N^2) behaviors
 --echo # https://bugs.mysql.com/bug.php?id=84958
@@ -23,6 +24,10 @@ BEGIN
 END~~
 DELIMITER ;~~

+SET GLOBAL innodb_purge_stop_now = ON;
+SET GLOBAL innodb_dict_stats_disabled_debug = ON;
+SET GLOBAL innodb_checkpoint_disabled = ON;
+
 --echo #
 --echo # Create a table with one record in it and start an RR transaction
 --echo #
@@ -78,3 +83,6 @@ disconnect con3;
 DROP TABLE t1;
 DROP PROCEDURE insert_n;
 DROP FUNCTION num_pages_get;
+SET GLOBAL innodb_purge_run_now = ON;
+SET GLOBAL innodb_dict_stats_disabled_debug = default;
+SET GLOBAL innodb_checkpoint_disabled = default;
[10 May 2019 7:50] Erlend Dahl
Fixed in 8.0.17 under the heading of

Bug#28623992 INNODB.INNODB_BUG84958 FAILS WITH RESULT CONTENT MISMATCH ON PB2

Thanks for the suggested test improvement.