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
e52a237f
Commit
e52a237f
authored
Jan 03, 2018
by
Sergei Golubchik
Committed by
Aleksey Midenkov
Jan 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove ifdefs around PSI_THREAD_CALL
same change as for PSI_TABLE_CALL
parent
e577b566
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
59 deletions
+54
-59
include/mysql/psi/mysql_thread.h
include/mysql/psi/mysql_thread.h
+29
-0
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+1
-1
mysys/my_thr_init.c
mysys/my_thr_init.c
+1
-3
sql/mysqld.cc
sql/mysqld.cc
+7
-15
sql/sql_acl.cc
sql/sql_acl.cc
+2
-6
sql/sql_class.h
sql/sql_class.h
+5
-15
sql/threadpool_common.cc
sql/threadpool_common.cc
+4
-12
storage/innobase/include/srv0srv.h
storage/innobase/include/srv0srv.h
+4
-4
storage/maria/ma_checkpoint.c
storage/maria/ma_checkpoint.c
+1
-3
No files found.
include/mysql/psi/mysql_thread.h
View file @
e52a237f
...
...
@@ -62,6 +62,35 @@
@{
*/
#ifdef HAVE_PSI_THREAD_INTERFACE
#define PSI_CALL_delete_current_thread PSI_THREAD_CALL(delete_current_thread)
#define PSI_CALL_get_thread PSI_THREAD_CALL(get_thread)
#define PSI_CALL_new_thread PSI_THREAD_CALL(new_thread)
#define PSI_CALL_register_thread PSI_THREAD_CALL(register_thread)
#define PSI_CALL_set_thread PSI_THREAD_CALL(set_thread)
#define PSI_CALL_set_thread_connect_attrs PSI_THREAD_CALL(set_thread_connect_attrs)
#define PSI_CALL_set_thread_db PSI_THREAD_CALL(set_thread_db)
#define PSI_CALL_set_thread_id PSI_THREAD_CALL(set_thread_id)
#define PSI_CALL_set_thread_info PSI_THREAD_CALL(set_thread_info)
#define PSI_CALL_set_thread_start_time PSI_THREAD_CALL(set_thread_start_time)
#define PSI_CALL_set_thread_user_host PSI_THREAD_CALL(set_thread_user_host)
#define PSI_CALL_spawn_thread PSI_THREAD_CALL(spawn_thread)
#else
#define PSI_CALL_delete_current_thread() do { } while(0)
#define PSI_CALL_get_thread() NULL
#define PSI_CALL_new_thread(A1,A2,A3) NULL
#define PSI_CALL_register_thread(A1,A2,A3) do { } while(0)
#define PSI_CALL_set_thread(A1) do { } while(0)
#define PSI_CALL_set_thread_connect_attrs(A1,A2,A3) 0
#define PSI_CALL_set_thread_db(A1,A2) do { } while(0)
#define PSI_CALL_set_thread_id(A1,A2) do { } while(0)
#define PSI_CALL_set_thread_info(A1, A2) do { } while(0)
#define PSI_CALL_set_thread_start_time(A1) do { } while(0)
#define PSI_CALL_set_thread_user_host(A1, A2, A3, A4) do { } while(0)
#define PSI_CALL_spawn_thread(A1, A2, A3, A4, A5) 0
#endif
/**
An instrumented mutex structure.
@sa mysql_mutex_t
...
...
libmysqld/lib_sql.cc
View file @
e52a237f
...
...
@@ -731,7 +731,7 @@ emb_transfer_connect_attrs(MYSQL *mysql)
ptr
=
buf
=
(
uchar
*
)
my_alloca
(
length
+
9
);
send_client_connect_attrs
(
mysql
,
buf
);
net_field_length_ll
(
&
ptr
);
PSI_
THREAD_CALL
(
set_thread_connect_attrs
)
((
char
*
)
ptr
,
length
,
thd
->
charset
());
PSI_
CALL_set_thread_connect_attrs
((
char
*
)
ptr
,
length
,
thd
->
charset
());
my_afree
(
buf
);
}
#endif
...
...
mysys/my_thr_init.c
View file @
e52a237f
...
...
@@ -341,14 +341,12 @@ void my_thread_end(void)
tmp
,
pthread_self
(),
tmp
?
(
long
)
tmp
->
id
:
0L
);
#endif
#ifdef HAVE_PSI_INTERFACE
/*
Remove the instrumentation for this thread.
This must be done before trashing st_my_thread_var,
because the LF_HASH depends on it.
*/
PSI_THREAD_CALL
(
delete_current_thread
)();
#endif
PSI_CALL_delete_current_thread
();
/*
We need to disable DBUG early for this thread to ensure that the
...
...
sql/mysqld.cc
View file @
e52a237f
...
...
@@ -2977,13 +2977,11 @@ static bool cache_thread(THD *thd)
DBUG_PRINT
(
"info"
,
(
"Adding thread to cache"
));
cached_thread_count
++
;
#ifdef HAVE_PSI_THREAD_INTERFACE
/*
Delete the instrumentation for the job that just completed,
before parking this pthread in the cache (blocked on COND_thread_cache).
*/
PSI_THREAD_CALL
(
delete_current_thread
)();
#endif
PSI_CALL_delete_current_thread
();
#ifndef DBUG_OFF
while
(
_db_is_pushed_
())
...
...
@@ -3030,15 +3028,13 @@ static bool cache_thread(THD *thd)
*/
thd
->
store_globals
();
#ifdef HAVE_PSI_THREAD_INTERFACE
/*
Create new instrumentation for the new THD job,
and attach it to this running pthread.
*/
PSI_thread
*
psi
=
PSI_
THREAD_CALL
(
new_thread
)
(
key_thread_one_connection
,
PSI_thread
*
psi
=
PSI_
CALL_new_thread
(
key_thread_one_connection
,
thd
,
thd
->
thread_id
);
PSI_THREAD_CALL
(
set_thread
)(
psi
);
#endif
PSI_CALL_set_thread
(
psi
);
/* reset abort flag for the thread */
thd
->
mysys_var
->
abort
=
0
;
...
...
@@ -3569,10 +3565,8 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
if
(
!
abort_loop
)
{
abort_loop
=
1
;
// mark abort for threads
#ifdef HAVE_PSI_THREAD_INTERFACE
/* Delete the instrumentation for the signal thread */
PSI_THREAD_CALL
(
delete_current_thread
)();
#endif
PSI_CALL_delete_current_thread
();
#ifdef USE_ONE_SIGNAL_HAND
pthread_t
tmp
;
if
((
error
=
mysql_thread_create
(
0
,
/* Not instrumented */
...
...
@@ -5853,8 +5847,8 @@ int mysqld_main(int argc, char **argv)
*/
init_server_psi_keys
();
/* Instrument the main thread */
PSI_thread
*
psi
=
PSI_
THREAD_CALL
(
new_thread
)
(
key_thread_main
,
NULL
,
0
);
PSI_
THREAD_CALL
(
set_thread
)
(
psi
);
PSI_thread
*
psi
=
PSI_
CALL_new_thread
(
key_thread_main
,
NULL
,
0
);
PSI_
CALL_set_thread
(
psi
);
/*
Now that some instrumentation is in place,
...
...
@@ -6203,13 +6197,11 @@ int mysqld_main(int argc, char **argv)
mysql_mutex_unlock
(
&
LOCK_start_thread
);
#endif
/* __WIN__ */
#ifdef HAVE_PSI_THREAD_INTERFACE
/*
Disable the main thread instrumentation,
to avoid recording events during the shutdown.
*/
PSI_THREAD_CALL
(
delete_current_thread
)();
#endif
PSI_CALL_delete_current_thread
();
/* Wait until cleanup is done */
mysql_mutex_lock
(
&
LOCK_thread_count
);
...
...
sql/sql_acl.cc
View file @
e52a237f
...
...
@@ -12439,12 +12439,10 @@ read_client_connect_attrs(char **ptr, char *end, CHARSET_INFO *from_cs)
if
(
length
>
65535
)
return
true
;
#ifdef HAVE_PSI_THREAD_INTERFACE
if
(
PSI_THREAD_CALL
(
set_thread_connect_attrs
)(
*
ptr
,
(
size_t
)
length
,
from_cs
)
&&
if
(
PSI_CALL_set_thread_connect_attrs
(
*
ptr
,
(
size_t
)
length
,
from_cs
)
&&
current_thd
->
variables
.
log_warnings
)
sql_print_warning
(
"Connection attributes of length %llu were truncated"
,
length
);
#endif
return
false
;
}
...
...
@@ -13517,11 +13515,9 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
else
my_ok
(
thd
);
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL
(
set_thread_user_host
)
PSI_CALL_set_thread_user_host
(
thd
->
main_security_ctx
.
user
,
strlen
(
thd
->
main_security_ctx
.
user
),
thd
->
main_security_ctx
.
host_or_ip
,
strlen
(
thd
->
main_security_ctx
.
host_or_ip
));
#endif
/* Ready to handle queries */
DBUG_RETURN
(
0
);
...
...
sql/sql_class.h
View file @
e52a237f
...
...
@@ -3376,9 +3376,7 @@ class THD :public Statement,
start_time
=
secs
;
start_time_sec_part
=
usecs
;
}
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL
(
set_thread_start_time
)(
start_time
);
#endif
PSI_CALL_set_thread_start_time
(
start_time
);
}
inline
void
set_start_time
()
{
...
...
@@ -3386,9 +3384,7 @@ class THD :public Statement,
{
start_time
=
hrtime_to_my_time
(
user_time
);
start_time_sec_part
=
hrtime_sec_part
(
user_time
);
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL
(
set_thread_start_time
)(
start_time
);
#endif
PSI_CALL_set_thread_start_time
(
start_time
);
}
else
set_current_time
();
...
...
@@ -4035,10 +4031,8 @@ class THD :public Statement,
db_length
=
db
?
new_db_len
:
0
;
bool
result
=
new_db
&&
!
db
;
mysql_mutex_unlock
(
&
LOCK_thd_data
);
#ifdef HAVE_PSI_THREAD_INTERFACE
if
(
result
)
PSI_THREAD_CALL
(
set_thread_db
)(
new_db
,
(
int
)
new_db_len
);
#endif
PSI_CALL_set_thread_db
(
new_db
,
(
int
)
new_db_len
);
return
result
;
}
...
...
@@ -4061,9 +4055,7 @@ class THD :public Statement,
db
=
new_db
;
db_length
=
new_db_len
;
mysql_mutex_unlock
(
&
LOCK_thd_data
);
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL
(
set_thread_db
)(
new_db
,
(
int
)
new_db_len
);
#endif
PSI_CALL_set_thread_db
(
new_db
,
(
int
)
new_db_len
);
}
}
/*
...
...
@@ -4282,9 +4274,7 @@ class THD :public Statement,
set_query_inner
(
string_arg
);
mysql_mutex_unlock
(
&
LOCK_thd_data
);
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL
(
set_thread_info
)(
query
(),
query_length
());
#endif
PSI_CALL_set_thread_info
(
query
(),
query_length
());
}
void
reset_query
()
/* Mutex protected */
{
set_query
(
CSET_STRING
());
}
...
...
sql/threadpool_common.cc
View file @
e52a237f
...
...
@@ -84,17 +84,13 @@ struct Worker_thread_context
void
save
()
{
#ifdef HAVE_PSI_THREAD_INTERFACE
psi_thread
=
PSI_THREAD_CALL
(
get_thread
)();
#endif
psi_thread
=
PSI_CALL_get_thread
();
mysys_var
=
(
st_my_thread_var
*
)
pthread_getspecific
(
THR_KEY_mysys
);
}
void
restore
()
{
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL
(
set_thread
)(
psi_thread
);
#endif
PSI_CALL_set_thread
(
psi_thread
);
pthread_setspecific
(
THR_KEY_mysys
,
mysys_var
);
pthread_setspecific
(
THR_THD
,
0
);
}
...
...
@@ -144,9 +140,7 @@ static void thread_attach(THD* thd)
pthread_setspecific
(
THR_KEY_mysys
,
thd
->
mysys_var
);
thd
->
thread_stack
=
(
char
*
)
&
thd
;
thd
->
store_globals
();
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL
(
set_thread
)(
thd
->
event_scheduler
.
m_psi
);
#endif
PSI_CALL_set_thread
(
thd
->
event_scheduler
.
m_psi
);
mysql_socket_set_thread_owner
(
thd
->
net
.
vio
->
mysql_socket
);
}
...
...
@@ -254,10 +248,8 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
thd
->
event_scheduler
.
data
=
scheduler_data
;
/* Create new PSI thread for use with the THD. */
#ifdef HAVE_PSI_THREAD_INTERFACE
thd
->
event_scheduler
.
m_psi
=
PSI_THREAD_CALL
(
new_thread
)(
key_thread_one_connection
,
thd
,
thd
->
thread_id
);
#endif
PSI_CALL_new_thread
(
key_thread_one_connection
,
thd
,
thd
->
thread_id
);
/* Login. */
...
...
storage/innobase/include/srv0srv.h
View file @
e52a237f
...
...
@@ -611,16 +611,16 @@ extern mysql_pfs_key_t trx_rollback_clean_thread_key;
schema */
# define pfs_register_thread(key) \
do { \
struct PSI_thread* psi = PSI_
THREAD_CALL(new_thread)
(key, NULL, 0);\
struct PSI_thread* psi = PSI_
CALL_new_thread
(key, NULL, 0);\
/* JAN: TODO: MYSQL 5.7 PSI \
PSI_
THREAD_CALL(set_thread_os_id)
(psi); */
\
PSI_
THREAD_CALL(set_thread)
(psi); \
PSI_
CALL_set_thread_os_id
(psi); */
\
PSI_
CALL_set_thread
(psi); \
} while (0)
/* This macro delist the current thread from performance schema */
# define pfs_delete_thread() \
do { \
PSI_
THREAD_CALL(delete_current_thread)
(); \
PSI_
CALL_delete_current_thread
(); \
} while (0)
# else
# define pfs_register_thread(key)
...
...
storage/maria/ma_checkpoint.c
View file @
e52a237f
...
...
@@ -562,9 +562,7 @@ pthread_handler_t ma_checkpoint_background(void *arg)
DBUG_PRINT
(
"info"
,(
"Maria background checkpoint thread starts"
));
DBUG_ASSERT
(
interval
>
0
);
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL
(
set_thread_user_host
)(
0
,
0
,
0
,
0
);
#endif
PSI_CALL_set_thread_user_host
(
0
,
0
,
0
,
0
);
/*
Recovery ended with all tables closed and a checkpoint: no need to take
...
...
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