summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2016-11-18 22:46:54 +0300
committerSergei Petrunia <psergey@askmonty.org>2016-11-18 22:46:54 +0300
commita4dc9561ee11582c7fa0385caf23d06c073e172d (patch)
treef64aa357a75a460c69579476be4d6aea85ddcb45
parentd66e1119d31fda5d744d0b5bdd5bb91ce434e56e (diff)
downloadmariadb-git-a4dc9561ee11582c7fa0385caf23d06c073e172d.tar.gz
MDEV-10330: main.show_explain_ps fails sporadically in buildbot
The reason is that selecting from events_waits_history_long creates a race condition: it can happen that SHOW EXPLAIN thread was kicked off CPU exactly after posting a SHOW EXPLAIN request and then it wont need to wait. It doesn't seem to make sense to add more waits to stabilize the testcase. Let's instead make a check that SHOW EXPLAIN statement has a "stage/sql/show explain" stage.
-rw-r--r--mysql-test/r/show_explain_ps.result11
-rw-r--r--mysql-test/t/show_explain_ps.test12
2 files changed, 17 insertions, 6 deletions
diff --git a/mysql-test/r/show_explain_ps.result b/mysql-test/r/show_explain_ps.result
index f5c487e9e44..1b38a9ad1e5 100644
--- a/mysql-test/r/show_explain_ps.result
+++ b/mysql-test/r/show_explain_ps.result
@@ -28,8 +28,13 @@ count(*)
10
set debug_dbug='';
select event_name
-from performance_schema.events_waits_history_long
-where event_name='wait/synch/cond/sql/show_explain';
+from
+performance_schema.events_stages_history_long
+where
+event_name like '%show explain' and
+thread_id in(select thread_id
+from performance_schema.events_statements_history_long
+where EVENT_NAME='statement/sql/show_explain');
event_name
-wait/synch/cond/sql/show_explain
+stage/sql/show explain
drop table t0;
diff --git a/mysql-test/t/show_explain_ps.test b/mysql-test/t/show_explain_ps.test
index 4ad1e4304de..e847abe3096 100644
--- a/mysql-test/t/show_explain_ps.test
+++ b/mysql-test/t/show_explain_ps.test
@@ -6,6 +6,8 @@
# Like all other perfschema tests, we don't work on embedded server:
--source include/not_embedded.inc
+--source include/restart_mysqld.inc
+
--disable_warnings
drop table if exists t0, t1;
--enable_warnings
@@ -45,7 +47,11 @@ reap;
set debug_dbug='';
select event_name
-from performance_schema.events_waits_history_long
-where event_name='wait/synch/cond/sql/show_explain';
-
+from
+performance_schema.events_stages_history_long
+where
+ event_name like '%show explain' and
+ thread_id in(select thread_id
+ from performance_schema.events_statements_history_long
+ where EVENT_NAME='statement/sql/show_explain');
drop table t0;