Skip to content

Commit a4dc956

Browse files
committed
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.
1 parent d66e111 commit a4dc956

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

mysql-test/r/show_explain_ps.result

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ count(*)
2828
10
2929
set debug_dbug='';
3030
select event_name
31-
from performance_schema.events_waits_history_long
32-
where event_name='wait/synch/cond/sql/show_explain';
31+
from
32+
performance_schema.events_stages_history_long
33+
where
34+
event_name like '%show explain' and
35+
thread_id in(select thread_id
36+
from performance_schema.events_statements_history_long
37+
where EVENT_NAME='statement/sql/show_explain');
3338
event_name
34-
wait/synch/cond/sql/show_explain
39+
stage/sql/show explain
3540
drop table t0;

mysql-test/t/show_explain_ps.test

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# Like all other perfschema tests, we don't work on embedded server:
77
--source include/not_embedded.inc
88

9+
--source include/restart_mysqld.inc
10+
911
--disable_warnings
1012
drop table if exists t0, t1;
1113
--enable_warnings
@@ -45,7 +47,11 @@ reap;
4547
set debug_dbug='';
4648

4749
select event_name
48-
from performance_schema.events_waits_history_long
49-
where event_name='wait/synch/cond/sql/show_explain';
50-
50+
from
51+
performance_schema.events_stages_history_long
52+
where
53+
event_name like '%show explain' and
54+
thread_id in(select thread_id
55+
from performance_schema.events_statements_history_long
56+
where EVENT_NAME='statement/sql/show_explain');
5157
drop table t0;

0 commit comments

Comments
 (0)