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
7180afa0
Commit
7180afa0
authored
Mar 07, 2020
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix perfschema for pool-of-threads
parent
a9b8131d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
23 additions
and
31 deletions
+23
-31
mysql-test/include/maybe_pool_of_threads.combinations
mysql-test/include/maybe_pool_of_threads.combinations
+5
-0
mysql-test/include/maybe_pool_of_threads.inc
mysql-test/include/maybe_pool_of_threads.inc
+1
-0
mysql-test/include/not_threadpool.inc
mysql-test/include/not_threadpool.inc
+1
-2
mysql-test/suite/perfschema/t/show_aggregate.test
mysql-test/suite/perfschema/t/show_aggregate.test
+1
-0
mysql-test/suite/perfschema/t/thread_cache.test
mysql-test/suite/perfschema/t/thread_cache.test
+1
-0
mysql-test/suite/perfschema/t/transaction_nested_events.test
mysql-test/suite/perfschema/t/transaction_nested_events.test
+2
-0
sql/scheduler.h
sql/scheduler.h
+0
-11
sql/sql_class.cc
sql/sql_class.cc
+0
-1
sql/threadpool_common.cc
sql/threadpool_common.cc
+3
-15
storage/perfschema/pfs.cc
storage/perfschema/pfs.cc
+8
-1
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr.cc
+1
-1
No files found.
mysql-test/include/maybe_pool_of_threads.combinations
0 → 100644
View file @
7180afa0
[pot]
thread_handling=pool-of-threads
[1tpc]
thread_handling=one-thread-per-connection
mysql-test/include/maybe_pool_of_threads.inc
0 → 100644
View file @
7180afa0
# run with and without threadpool
mysql-test/include/not_threadpool.inc
View file @
7180afa0
if
(
`SELECT count(*) FROM information_schema.GLOBAL_VARIABLES WHERE
if
(
`SELECT count(*) FROM information_schema.GLOBAL_VARIABLES WHERE
VARIABLE_NAME = 'THREAD_HANDLING' AND
VARIABLE_NAME = 'THREAD_HANDLING' AND VARIABLE_VALUE = 'pool-of-threads'`
){
VARIABLE_VALUE = 'loaded-dynamically'`
){
skip
Test
requires
:
'not_threadpool'
;
skip
Test
requires
:
'not_threadpool'
;
}
}
mysql-test/suite/perfschema/t/show_aggregate.test
View file @
7180afa0
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
--
source
include
/
no_protocol
.
inc
--
source
include
/
no_protocol
.
inc
--
source
include
/
maybe_pool_of_threads
.
inc
--
enable_connect_log
--
enable_connect_log
...
...
mysql-test/suite/perfschema/t/thread_cache.test
View file @
7180afa0
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_perfschema
.
inc
--
source
include
/
have_perfschema
.
inc
--
source
include
/
not_threadpool
.
inc
#
#
# Important note:
# Important note:
...
...
mysql-test/suite/perfschema/t/transaction_nested_events.test
View file @
7180afa0
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
no_protocol
.
inc
--
source
include
/
no_protocol
.
inc
--
source
include
/
maybe_pool_of_threads
.
inc
--
disable_query_log
--
disable_query_log
--
source
../
include
/
transaction_setup
.
inc
--
source
../
include
/
transaction_setup
.
inc
--
enable_query_log
--
enable_query_log
...
...
sql/scheduler.h
View file @
7180afa0
...
@@ -82,17 +82,6 @@ extern void post_kill_notification(THD *);
...
@@ -82,17 +82,6 @@ extern void post_kill_notification(THD *);
struct
thd_scheduler
struct
thd_scheduler
{
{
public:
public:
/*
Thread instrumentation for the user job.
This member holds the instrumentation while the user job is not run
by a thread.
Note that this member is not conditionally declared
(ifdef HAVE_PSI_INTERFACE), because doing so will change the binary
layout of THD, which is exposed to plugin code that may be compiled
differently.
*/
PSI_thread
*
m_psi
;
void
*
data
;
/* scheduler-specific data structure */
void
*
data
;
/* scheduler-specific data structure */
};
};
...
...
sql/sql_class.cc
View file @
7180afa0
...
@@ -758,7 +758,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
...
@@ -758,7 +758,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
thread_stack
=
0
;
thread_stack
=
0
;
scheduler
=
thread_scheduler
;
// Will be fixed later
scheduler
=
thread_scheduler
;
// Will be fixed later
event_scheduler
.
data
=
0
;
event_scheduler
.
data
=
0
;
event_scheduler
.
m_psi
=
0
;
skip_wait_timeout
=
false
;
skip_wait_timeout
=
false
;
catalog
=
(
char
*
)
"std"
;
// the only catalog we have for now
catalog
=
(
char
*
)
"std"
;
// the only catalog we have for now
main_security_ctx
.
init
();
main_security_ctx
.
init
();
...
...
sql/threadpool_common.cc
View file @
7180afa0
...
@@ -151,7 +151,7 @@ static void thread_attach(THD* thd)
...
@@ -151,7 +151,7 @@ static void thread_attach(THD* thd)
pthread_setspecific
(
THR_KEY_mysys
,
thd
->
mysys_var
);
pthread_setspecific
(
THR_KEY_mysys
,
thd
->
mysys_var
);
thd
->
thread_stack
=
(
char
*
)
&
thd
;
thd
->
thread_stack
=
(
char
*
)
&
thd
;
thd
->
store_globals
();
thd
->
store_globals
();
PSI_CALL_set_thread
(
thd
->
event_scheduler
.
m_psi
);
PSI_CALL_set_thread
(
thd
->
get_psi
()
);
mysql_socket_set_thread_owner
(
thd
->
net
.
vio
->
mysql_socket
);
mysql_socket_set_thread_owner
(
thd
->
net
.
vio
->
mysql_socket
);
}
}
...
@@ -235,21 +235,13 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
...
@@ -235,21 +235,13 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
pthread_setspecific
(
THR_KEY_mysys
,
0
);
pthread_setspecific
(
THR_KEY_mysys
,
0
);
my_thread_init
();
my_thread_init
();
st_my_thread_var
*
mysys_var
=
(
st_my_thread_var
*
)
pthread_getspecific
(
THR_KEY_mysys
);
st_my_thread_var
*
mysys_var
=
(
st_my_thread_var
*
)
pthread_getspecific
(
THR_KEY_mysys
);
PSI_CALL_set_thread
(
PSI_CALL_new_thread
(
key_thread_one_connection
,
connect
,
0
));
if
(
!
mysys_var
||!
(
thd
=
connect
->
create_thd
(
NULL
)))
if
(
!
mysys_var
||!
(
thd
=
connect
->
create_thd
(
NULL
)))
{
{
/* Out of memory? */
/* Out of memory? */
connect
->
close_and_delete
();
connect
->
close_and_delete
();
if
(
mysys_var
)
if
(
mysys_var
)
{
#ifdef HAVE_PSI_INTERFACE
/*
current PSI is still from worker thread.
Set to 0, to avoid premature cleanup by my_thread_end
*/
if
(
PSI_server
)
PSI_server
->
set_thread
(
0
);
#endif
my_thread_end
();
my_thread_end
();
}
return
NULL
;
return
NULL
;
}
}
delete
connect
;
delete
connect
;
...
@@ -257,11 +249,6 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
...
@@ -257,11 +249,6 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
thd
->
set_mysys_var
(
mysys_var
);
thd
->
set_mysys_var
(
mysys_var
);
thd
->
event_scheduler
.
data
=
scheduler_data
;
thd
->
event_scheduler
.
data
=
scheduler_data
;
/* Create new PSI thread for use with the THD. */
thd
->
event_scheduler
.
m_psi
=
PSI_CALL_new_thread
(
key_thread_one_connection
,
thd
,
thd
->
thread_id
);
/* Login. */
/* Login. */
thread_attach
(
thd
);
thread_attach
(
thd
);
re_init_net_server_extension
(
thd
);
re_init_net_server_extension
(
thd
);
...
@@ -301,6 +288,7 @@ static void threadpool_remove_connection(THD *thd)
...
@@ -301,6 +288,7 @@ static void threadpool_remove_connection(THD *thd)
end_connection
(
thd
);
end_connection
(
thd
);
close_connection
(
thd
,
0
);
close_connection
(
thd
,
0
);
unlink_thd
(
thd
);
unlink_thd
(
thd
);
PSI_CALL_delete_current_thread
();
// before THD is destroyed
delete
thd
;
delete
thd
;
/*
/*
...
...
storage/perfschema/pfs.cc
View file @
7180afa0
...
@@ -2168,7 +2168,6 @@ extern "C" void* pfs_spawn_thread(void *arg)
...
@@ -2168,7 +2168,6 @@ extern "C" void* pfs_spawn_thread(void *arg)
pfs
=
create_thread
(
klass
,
typed_arg
->
m_child_identity
,
0
);
pfs
=
create_thread
(
klass
,
typed_arg
->
m_child_identity
,
0
);
if
(
likely
(
pfs
!=
NULL
))
if
(
likely
(
pfs
!=
NULL
))
{
{
pfs
->
m_thread_os_id
=
my_thread_os_id
();
clear_thread_account
(
pfs
);
clear_thread_account
(
pfs
);
pfs
->
m_parent_thread_internal_id
=
typed_arg
->
m_thread_internal_id
;
pfs
->
m_parent_thread_internal_id
=
typed_arg
->
m_thread_internal_id
;
...
@@ -2267,7 +2266,15 @@ pfs_new_thread_v1(PSI_thread_key key, const void *identity, ulonglong processlis
...
@@ -2267,7 +2266,15 @@ pfs_new_thread_v1(PSI_thread_key key, const void *identity, ulonglong processlis
PFS_thread_class
*
klass
=
find_thread_class
(
key
);
PFS_thread_class
*
klass
=
find_thread_class
(
key
);
if
(
likely
(
klass
!=
NULL
))
if
(
likely
(
klass
!=
NULL
))
{
pfs
=
create_thread
(
klass
,
identity
,
processlist_id
);
pfs
=
create_thread
(
klass
,
identity
,
processlist_id
);
if
(
pfs
!=
NULL
)
{
PFS_thread
*
parent
=
my_thread_get_THR_PFS
();
if
(
parent
!=
NULL
)
pfs
->
m_parent_thread_internal_id
=
parent
->
m_parent_thread_internal_id
;
}
}
else
else
pfs
=
NULL
;
pfs
=
NULL
;
...
...
storage/perfschema/pfs_instr.cc
View file @
7180afa0
...
@@ -529,7 +529,7 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
...
@@ -529,7 +529,7 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
PFS_atomic
::
add_u64
(
&
thread_internal_id_counter
.
m_u64
,
1
);
PFS_atomic
::
add_u64
(
&
thread_internal_id_counter
.
m_u64
,
1
);
pfs
->
m_parent_thread_internal_id
=
0
;
pfs
->
m_parent_thread_internal_id
=
0
;
pfs
->
m_processlist_id
=
static_cast
<
ulong
>
(
processlist_id
);
pfs
->
m_processlist_id
=
static_cast
<
ulong
>
(
processlist_id
);
pfs
->
m_thread_os_id
=
0
;
pfs
->
m_thread_os_id
=
my_thread_os_id
()
;
pfs
->
m_event_id
=
1
;
pfs
->
m_event_id
=
1
;
pfs
->
m_stmt_lock
.
set_allocated
();
pfs
->
m_stmt_lock
.
set_allocated
();
pfs
->
m_session_lock
.
set_allocated
();
pfs
->
m_session_lock
.
set_allocated
();
...
...
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