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
259b9452
Commit
259b9452
authored
Feb 12, 2021
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove find_thread_with_thd_data_lock_callback
let the caller take the lock if needed
parent
eac8341d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
25 deletions
+9
-25
sql/sql_parse.cc
sql/sql_parse.cc
+5
-22
sql/sql_show.h
sql/sql_show.h
+0
-1
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+4
-2
No files found.
sql/sql_parse.cc
View file @
259b9452
...
...
@@ -9098,24 +9098,6 @@ THD *find_thread_by_id(longlong id, bool query_id)
return
arg
.
thd
;
}
static
my_bool
find_thread_with_thd_data_lock_callback
(
THD
*
thd
,
find_thread_callback_arg
*
arg
)
{
if
(
arg
->
id
==
(
arg
->
query_id
?
thd
->
query_id
:
(
longlong
)
thd
->
thread_id
))
{
mysql_mutex_lock
(
&
thd
->
LOCK_thd_kill
);
// Lock from delete
mysql_mutex_lock
(
&
thd
->
LOCK_thd_data
);
// XXX DELME
arg
->
thd
=
thd
;
return
1
;
}
return
0
;
}
THD
*
find_thread_by_id_with_thd_data_lock
(
longlong
id
,
bool
query_id
)
{
find_thread_callback_arg
arg
(
id
,
query_id
);
server_threads
.
iterate
(
find_thread_with_thd_data_lock_callback
,
&
arg
);
return
arg
.
thd
;
}
/**
kill one thread.
...
...
@@ -9132,7 +9114,7 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
uint
error
=
(
type
==
KILL_TYPE_QUERY
?
ER_NO_SUCH_QUERY
:
ER_NO_SUCH_THREAD
);
DBUG_ENTER
(
"kill_one_thread"
);
DBUG_PRINT
(
"enter"
,
(
"id: %lld signal: %u"
,
id
,
(
uint
)
kill_signal
));
tmp
=
find_thread_by_id
_with_thd_data_lock
(
id
,
type
==
KILL_TYPE_QUERY
);
tmp
=
find_thread_by_id
(
id
,
type
==
KILL_TYPE_QUERY
);
if
(
!
tmp
)
DBUG_RETURN
(
error
);
...
...
@@ -9159,6 +9141,7 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
faster and do a harder kill than KILL_SYSTEM_THREAD;
*/
mysql_mutex_lock
(
&
tmp
->
LOCK_thd_data
);
// for various wsrep* checks below
#ifdef WITH_WSREP
if
(((
thd
->
security_ctx
->
master_access
&
SUPER_ACL
)
||
thd
->
security_ctx
->
user_matches
(
tmp
->
security_ctx
))
&&
...
...
@@ -9180,8 +9163,8 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
else
#endif
/* WITH_WSREP */
{
WSREP_DEBUG
(
"kill_one_thread %llu, victim: %llu wsrep_aborter %llu by signal %d"
,
thd
->
thread_id
,
id
,
tmp
->
wsrep_aborter
,
kill_signal
);
WSREP_DEBUG
(
"kill_one_thread %llu, victim: %llu wsrep_aborter %llu by signal %d"
,
thd
->
thread_id
,
id
,
tmp
->
wsrep_aborter
,
kill_signal
);
tmp
->
awake_no_mutex
(
kill_signal
);
WSREP_DEBUG
(
"victim: %llu taken care of"
,
id
);
error
=
0
;
...
...
@@ -9190,9 +9173,9 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
else
error
=
(
type
==
KILL_TYPE_QUERY
?
ER_KILL_QUERY_DENIED_ERROR
:
ER_KILL_DENIED_ERROR
);
mysql_mutex_unlock
(
&
tmp
->
LOCK_thd_data
);
}
mysql_mutex_unlock
(
&
tmp
->
LOCK_thd_kill
);
mysql_mutex_unlock
(
&
tmp
->
LOCK_thd_data
);
DBUG_PRINT
(
"exit"
,
(
"%d"
,
error
));
DBUG_RETURN
(
error
);
}
...
...
sql/sql_show.h
View file @
259b9452
...
...
@@ -144,7 +144,6 @@ const char* get_one_variable(THD *thd, const SHOW_VAR *variable,
/* These functions were under INNODB_COMPATIBILITY_HOOKS */
int
get_quote_char_for_identifier
(
THD
*
thd
,
const
char
*
name
,
size_t
length
);
THD
*
find_thread_by_id
(
longlong
id
,
bool
query_id
=
false
);
THD
*
find_thread_by_id_with_thd_data_lock
(
longlong
id
,
bool
query_id
=
false
);
class
select_result_explain_buffer
;
/*
...
...
storage/innobase/handler/ha_innodb.cc
View file @
259b9452
...
...
@@ -18583,8 +18583,10 @@ static void bg_wsrep_kill_trx(void *void_arg)
trx_t
*
victim_trx
;
bool
aborting
=
false
;
bf_thd
=
find_thread_by_id_with_thd_data_lock
(
arg
->
bf_thd_id
);
thd
=
find_thread_by_id_with_thd_data_lock
(
arg
->
thd_id
);
if
((
bf_thd
=
find_thread_by_id
(
arg
->
bf_thd_id
)))
wsrep_thd_LOCK
(
bf_thd
);
if
((
thd
=
find_thread_by_id
(
arg
->
thd_id
)))
wsrep_thd_LOCK
(
thd
);
if
(
!
thd
||
!
bf_thd
||
!
(
victim_trx
=
thd_to_trx
(
thd
)))
goto
ret0
;
...
...
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