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
dacb3809
Commit
dacb3809
authored
Jun 12, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-4422 SHOW PROCESSLIST reference to THD::db not protected against simultaneous updates
protect THD::db with THD::LOCK_thd_data
parent
f722b15d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
sql/sql_class.h
sql/sql_class.h
+10
-2
sql/sql_show.cc
sql/sql_show.cc
+2
-2
No files found.
sql/sql_class.h
View file @
dacb3809
...
...
@@ -1605,6 +1605,7 @@ class THD :public Statement,
Protects THD data accessed from other threads:
- thd->query and thd->query_length (used by SHOW ENGINE
INNODB STATUS and SHOW PROCESSLIST
- thd->db and thd->db_length (used in SHOW PROCESSLIST)
- thd->mysys_var (used by KILL statement and shutdown).
Is locked when THD is deleted.
*/
...
...
@@ -2838,6 +2839,7 @@ class THD :public Statement,
*/
bool
set_db
(
const
char
*
new_db
,
size_t
new_db_len
)
{
mysql_mutex_lock
(
&
LOCK_thd_data
);
/* Do not reallocate memory if current chunk is big enough. */
if
(
db
&&
new_db
&&
db_length
>=
new_db_len
)
memcpy
(
db
,
new_db
,
new_db_len
+
1
);
...
...
@@ -2850,6 +2852,7 @@ class THD :public Statement,
db
=
NULL
;
}
db_length
=
db
?
new_db_len
:
0
;
mysql_mutex_unlock
(
&
LOCK_thd_data
);
return
new_db
&&
!
db
;
}
...
...
@@ -2866,8 +2869,13 @@ class THD :public Statement,
*/
void
reset_db
(
char
*
new_db
,
size_t
new_db_len
)
{
db
=
new_db
;
db_length
=
new_db_len
;
if
(
new_db
!=
db
||
new_db_len
!=
db_length
)
{
mysql_mutex_lock
(
&
LOCK_thd_data
);
db
=
new_db
;
db_length
=
new_db_len
;
mysql_mutex_unlock
(
&
LOCK_thd_data
);
}
}
/*
Copy the current database to the argument. Use the current arena to
...
...
sql/sql_show.cc
View file @
dacb3809
...
...
@@ -2212,10 +2212,10 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thd_info
->
host
=
thd
->
strdup
(
tmp_sctx
->
host_or_ip
[
0
]
?
tmp_sctx
->
host_or_ip
:
tmp_sctx
->
host
?
tmp_sctx
->
host
:
""
);
if
((
thd_info
->
db
=
tmp
->
db
))
// Safe test
thd_info
->
db
=
thd
->
strdup
(
thd_info
->
db
);
thd_info
->
command
=
(
int
)
tmp
->
command
;
mysql_mutex_lock
(
&
tmp
->
LOCK_thd_data
);
if
((
thd_info
->
db
=
tmp
->
db
))
// Safe test
thd_info
->
db
=
thd
->
strdup
(
thd_info
->
db
);
if
((
mysys_var
=
tmp
->
mysys_var
))
mysql_mutex_lock
(
&
mysys_var
->
mutex
);
thd_info
->
proc_info
=
(
char
*
)
(
tmp
->
killed
>=
KILL_QUERY
?
...
...
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