Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
a931467e
Commit
a931467e
authored
Jul 07, 2012
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable PERFORMANCE_SCHEMA tracking for SHOW EXPLAIN's conditions.
parent
ae3bc191
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
3 deletions
+102
-3
mysql-test/r/show_explain_ps.result
mysql-test/r/show_explain_ps.result
+27
-0
mysql-test/t/show_explain_ps.test
mysql-test/t/show_explain_ps.test
+48
-0
sql/my_apc.cc
sql/my_apc.cc
+22
-3
sql/my_apc.h
sql/my_apc.h
+4
-0
sql/mysqld.cc
sql/mysqld.cc
+1
-0
No files found.
mysql-test/r/show_explain_ps.result
0 → 100644
View file @
a931467e
drop table if exists t0, t1;
select * from performance_schema.setup_instruments where name like '%show_explain%';
NAME ENABLED TIMED
wait/synch/cond/sql/show_explain YES YES
# We've got no instances
select * from performance_schema.cond_instances where name like '%show_explain%';
NAME OBJECT_INSTANCE_BEGIN
# Check out if our cond is hit.
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
select count(*) from t0 where a < 100000;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
Warnings:
Note 1003 select count(*) from t0 where a < 100000
count(*)
10
set debug_dbug='';
select event_name
from performance_schema.events_waits_history_long
where event_name='wait/synch/cond/sql/show_explain';
event_name
wait/synch/cond/sql/show_explain
drop table t0;
mysql-test/t/show_explain_ps.test
0 → 100644
View file @
a931467e
#
# Test how SHOW EXPLAIN is represented in performance schema
#
--
source
include
/
have_perfschema
.
inc
--
disable_warnings
drop
table
if
exists
t0
,
t1
;
--
enable_warnings
select
*
from
performance_schema
.
setup_instruments
where
name
like
'%show_explain%'
;
--
echo
# We've got no instances
select
*
from
performance_schema
.
cond_instances
where
name
like
'%show_explain%'
;
--
echo
# Check out if our cond is hit.
create
table
t0
(
a
int
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
let
$thr1
=
`select connection_id()`
;
connect
(
con1
,
localhost
,
root
,,);
connection
con1
;
let
$thr2
=
`select connection_id()`
;
connection
default
;
let
$wait_condition
=
select
State
=
'show_explain_trap'
from
information_schema
.
processlist
where
id
=
$thr2
;
#
# Test SHOW EXPLAIN for simple queries
#
connection
con1
;
set
@
show_explain_probe_select_id
=
1
;
set
debug_dbug
=
'd,show_explain_probe_join_exec_start'
;
send
select
count
(
*
)
from
t0
where
a
<
100000
;
connection
default
;
--
source
include
/
wait_condition
.
inc
evalp
show
explain
for
$thr2
;
connection
con1
;
reap
;
set
debug_dbug
=
''
;
select
event_name
from
performance_schema
.
events_waits_history_long
where
event_name
=
'wait/synch/cond/sql/show_explain'
;
drop
table
t0
;
sql/my_apc.cc
View file @
a931467e
...
...
@@ -124,6 +124,26 @@ void Apc_target::dequeue_request(Call_request *qe)
qe
->
next
->
prev
=
qe
->
prev
;
}
#ifdef HAVE_PSI_INTERFACE
/* One key for all conds */
PSI_cond_key
key_show_explain_request_COND
;
static
PSI_cond_info
show_explain_psi_conds
[]
=
{
{
&
key_show_explain_request_COND
,
"show_explain"
,
0
/* not using PSI_FLAG_GLOBAL*/
}
};
void
init_show_explain_psi_keys
(
void
)
{
if
(
PSI_server
==
NULL
)
return
;
PSI_server
->
register_cond
(
"sql"
,
show_explain_psi_conds
,
array_elements
(
show_explain_psi_conds
));
}
#endif
/*
Make an APC (Async Procedure Call) to another thread.
...
...
@@ -154,7 +174,8 @@ bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call,
Call_request
apc_request
;
apc_request
.
call
=
call
;
apc_request
.
processed
=
FALSE
;
mysql_cond_init
(
0
/* do not track in PS */
,
&
apc_request
.
COND_request
,
NULL
);
mysql_cond_init
(
key_show_explain_request_COND
,
&
apc_request
.
COND_request
,
NULL
);
enqueue_request
(
&
apc_request
);
apc_request
.
what
=
"enqueued by make_apc_call"
;
...
...
@@ -174,9 +195,7 @@ bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call,
LOCK_thd_data_ptr
,
&
abstime
);
// &apc_request.LOCK_request, &abstime);
if
(
caller_thd
->
killed
)
{
break
;
}
}
if
(
!
apc_request
.
processed
)
...
...
sql/my_apc.h
View file @
a931467e
...
...
@@ -119,3 +119,7 @@ class Apc_target
}
};
#ifdef HAVE_PSI_INTERFACE
void
init_show_explain_psi_keys
(
void
);
#endif
sql/mysqld.cc
View file @
a931467e
...
...
@@ -3909,6 +3909,7 @@ static int init_thread_environment()
sp_cache_init
();
#ifdef HAVE_EVENT_SCHEDULER
Events
::
init_mutexes
();
init_show_explain_psi_keys
();
#endif
/* Parameter for threads created for connections */
(
void
)
pthread_attr_init
(
&
connection_attrib
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment