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
d210df50
Commit
d210df50
authored
Nov 26, 2009
by
Michael Widenius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added protection around usage of thd->mysys_var
(May be changed to 0 by scheduler)
parent
847bab8e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
3 deletions
+21
-3
sql/mysqld.cc
sql/mysqld.cc
+2
-0
sql/scheduler.cc
sql/scheduler.cc
+1
-3
sql/sql_class.cc
sql/sql_class.cc
+13
-0
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_insert.cc
sql/sql_insert.cc
+2
-0
sql/sql_show.cc
sql/sql_show.cc
+2
-0
No files found.
sql/mysqld.cc
View file @
d210df50
...
...
@@ -957,6 +957,7 @@ static void close_connections(void)
tmp
->
killed
=
THD
::
KILL_CONNECTION
;
thread_scheduler
.
post_kill_notification
(
tmp
);
pthread_mutex_lock
(
&
tmp
->
LOCK_thd_data
);
if
(
tmp
->
mysys_var
)
{
tmp
->
mysys_var
->
abort
=
1
;
...
...
@@ -979,6 +980,7 @@ static void close_connections(void)
}
pthread_mutex_unlock
(
&
tmp
->
mysys_var
->
mutex
);
}
pthread_mutex_unlock
(
&
tmp
->
LOCK_thd_data
);
}
(
void
)
pthread_mutex_unlock
(
&
LOCK_thread_count
);
// For unlink from list
...
...
sql/scheduler.cc
View file @
d210df50
...
...
@@ -235,9 +235,7 @@ void thd_scheduler::thread_detach()
if
(
thread_attached
)
{
THD
*
thd
=
(
THD
*
)
list
.
data
;
pthread_mutex_lock
(
&
thd
->
LOCK_thd_data
);
thd
->
mysys_var
=
NULL
;
pthread_mutex_unlock
(
&
thd
->
LOCK_thd_data
);
thd
->
reset_globals
();
thread_attached
=
FALSE
;
#ifndef DBUG_OFF
/*
...
...
sql/sql_class.cc
View file @
d210df50
...
...
@@ -1166,6 +1166,19 @@ bool THD::store_globals()
}
/**
Untie THD from current thread
Used when using --thread-handling=pool-of-threads
*/
void
THD
::
reset_globals
()
{
pthread_mutex_lock
(
&
LOCK_thd_data
);
mysys_var
=
0
;
pthread_mutex_unlock
(
&
LOCK_thd_data
);
}
/*
Cleanup after query.
...
...
sql/sql_class.h
View file @
d210df50
...
...
@@ -1906,6 +1906,7 @@ class THD :public Statement,
void
cleanup
(
void
);
void
cleanup_after_query
();
bool
store_globals
();
void
reset_globals
();
#ifdef SIGNAL_WITH_VIO_CLOSE
inline
void
set_active_vio
(
Vio
*
vio
)
{
...
...
sql/sql_insert.cc
View file @
d210df50
...
...
@@ -2279,6 +2279,7 @@ void kill_delayed_threads(void)
while
((
di
=
it
++
))
{
di
->
thd
.
killed
=
THD
::
KILL_CONNECTION
;
pthread_mutex_lock
(
&
di
->
thd
.
LOCK_thd_data
);
if
(
di
->
thd
.
mysys_var
)
{
pthread_mutex_lock
(
&
di
->
thd
.
mysys_var
->
mutex
);
...
...
@@ -2297,6 +2298,7 @@ void kill_delayed_threads(void)
}
pthread_mutex_unlock
(
&
di
->
thd
.
mysys_var
->
mutex
);
}
pthread_mutex_unlock
(
&
di
->
thd
.
LOCK_thd_data
);
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_delayed_insert
));
// For unlink from list
}
...
...
sql/sql_show.cc
View file @
d210df50
...
...
@@ -1747,6 +1747,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if
((
thd_info
->
db
=
tmp
->
db
))
// Safe test
thd_info
->
db
=
thd
->
strdup
(
thd_info
->
db
);
thd_info
->
command
=
(
int
)
tmp
->
command
;
pthread_mutex_lock
(
&
tmp
->
LOCK_thd_data
);
if
((
mysys_var
=
tmp
->
mysys_var
))
pthread_mutex_lock
(
&
mysys_var
->
mutex
);
thd_info
->
proc_info
=
(
char
*
)
(
tmp
->
killed
==
THD
::
KILL_CONNECTION
?
"Killed"
:
0
);
...
...
@@ -1766,6 +1767,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
#endif
if
(
mysys_var
)
pthread_mutex_unlock
(
&
mysys_var
->
mutex
);
pthread_mutex_unlock
(
&
tmp
->
LOCK_thd_data
);
thd_info
->
start_time
=
tmp
->
start_time
;
thd_info
->
query
=
0
;
...
...
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