[MDEV-17748] innodb.alter_inplace_perfschema fails in buildbot with wrong result Created: 2018-11-16  Updated: 2019-01-08  Resolved: 2019-01-08

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Tests
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.2.22, 10.3.13

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-17532 Performance_schema reports wrong dire... Closed

 Description   

http://buildbot.askmonty.org/buildbot/builders/kvm-rpm-centos74-amd64-debug/builds/1109

10.3 45769429d9a3bfa37ead21aa0d36214f

innodb.alter_inplace_perfschema 'innodb' w3 [ fail ]
        Test ended at 2018-11-14 12:56:58
 
CURRENT_TEST: innodb.alter_inplace_perfschema
--- /usr/share/mysql-test/suite/innodb/r/alter_inplace_perfschema.result	2018-11-14 10:19:55.000000000 +0000
+++ /dev/shm/var/3/log/alter_inplace_perfschema.reject	2018-11-14 12:56:58.235306852 +0000
@@ -11,7 +11,6 @@
 SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
 WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
 object_name
-tmp/Innodb Merge Temp File
 SET DEBUG_SYNC = 'now SIGNAL gone';
 connection ddl;
 disconnect ddl;
 
mysqltest: Result length mismatch



 Comments   
Comment by Marko Mäkelä [ 2018-11-16 ]

I think that this could occasionally fail in 10.2 as well.
Starting with MariaDB 10.2 (and MySQL 5.7), temporary file creation for the merge sort in ALGORITHM=INPLACE is deferred until the main memory buffer runs out.
I determined a tight limit for this in 10.2, but apparently that is too tight.

Comment by Thirunarayanan Balathandayuthapani [ 2019-01-04 ]

diff --git a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test b/mysql-test/sui
te/innodb/t/alter_inplace_perfschema.test
index b832596..d5851e8 100644
--- a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
+++ b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
@@ -10,7 +10,7 @@ update performance_schema.setup_consumers set enabled='yes';
 CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB;
 
 BEGIN;
-let $n=247;
+let $n=260;
 --disable_query_log
 while ($n) {
 dec $n;

The limit could be too tight. we can increase the limit

Comment by Marko Mäkelä [ 2019-01-04 ]

Yes, increasing the limit should fix this. But can you please find out what exactly causes the occasional failures? Could it be because the size of the main-memory buffer is not always the same, and we could need more data to fill that buffer, to force the temporary file to be created?

Comment by Thirunarayanan Balathandayuthapani [ 2019-01-07 ]

Afaik, temporary file creation happens for the problematic test case scenario. May be some how, temporary file creation is not reflecting in performance schema query result.

Comment by Thirunarayanan Balathandayuthapani [ 2019-01-08 ]

diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def
index aea780e..35c941f 100644
--- a/mysql-test/suite/innodb/disabled.def
+++ b/mysql-test/suite/innodb/disabled.def
@@ -11,4 +11,3 @@
 ##############################################################################
 
 create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails
-alter_inplace_perfschema : MDEV-17748 nnodb.alter_inplace_perfschema fails in buildbot with wrong result
diff --git a/mysql-test/suite/innodb/r/alter_inplace_perfschema.result b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
index 68e25664..83daa3d 100644
--- a/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
+++ b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
@@ -8,6 +8,7 @@ SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
 ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
 connection default;
 SET DEBUG_SYNC = 'now WAIT_FOR go';
+11
 SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
 WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
 object_name
diff --git a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
index b832596..e663735 100644
--- a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
+++ b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
@@ -18,12 +18,19 @@ INSERT INTO t1 SELECT NULL, REPEAT('b',255);
 }
 --enable_query_log
 COMMIT;
+let $init_count = `select count_star from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'`;
 
 SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
 send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
 
 connection default;
 SET DEBUG_SYNC = 'now WAIT_FOR go';
+
+let $final_count = `select count_star from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'`;
+
+let $diff = `SELECT $final_count - $init_count`;
+echo $diff;
+
 --replace_regex /.*[\\\/]tmp/tmp/
 SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
 WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';

The above patch can solve the issue.

Generated at Thu Feb 08 08:38:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.