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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
86a2d707
Commit
86a2d707
authored
Oct 19, 2011
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
safe_mutex deadlock detector post-merge fixes
parent
957b5590
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
11 deletions
+28
-11
include/my_pthread.h
include/my_pthread.h
+12
-0
include/mysql/psi/mysql_thread.h
include/mysql/psi/mysql_thread.h
+3
-0
mysys/thr_mutex.c
mysys/thr_mutex.c
+1
-1
sql/rpl_mi.cc
sql/rpl_mi.cc
+2
-8
sql/slave.cc
sql/slave.cc
+4
-2
sql/sql_class.cc
sql/sql_class.cc
+5
-0
storage/maria/ma_loghandler.c
storage/maria/ma_loghandler.c
+1
-0
No files found.
include/my_pthread.h
View file @
86a2d707
...
...
@@ -512,11 +512,13 @@ void safe_mutex_free_deadlock_data(safe_mutex_t *mp);
#define safe_mutex_assert_not_owner(mp) \
DBUG_ASSERT(! (mp)->count || \
! pthread_equal(pthread_self(), (mp)->thread))
#define safe_mutex_setflags(mp, F) do { (mp)->create_flags|= (F); } while (0)
#else
#define my_pthread_mutex_init(A,B,C,D) pthread_mutex_init((A),(B))
#define safe_mutex_assert_owner(mp) do {} while(0)
#define safe_mutex_assert_not_owner(mp) do {} while(0)
#define safe_mutex_free_deadlock_data(mp) do {} while(0)
#define safe_mutex_setflags(mp, F) do {} while (0)
#endif
/* SAFE_MUTEX */
#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
...
...
@@ -920,6 +922,16 @@ extern uint thd_lib_detected;
#define status_var_add(V,C) (V)+=(C)
#define status_var_sub(V,C) (V)-=(C)
#ifdef SAFE_MUTEX
#define mysql_mutex_record_order(A,B) \
do { \
mysql_mutex_lock(A); mysql_mutex_lock(B); \
mysql_mutex_unlock(B); mysql_mutex_unlock(A); \
} while(0)
#else
#define mysql_mutex_record_order(A,B) do { } while(0)
#endif
#ifdef __cplusplus
}
#endif
...
...
include/mysql/psi/mysql_thread.h
View file @
86a2d707
...
...
@@ -213,6 +213,9 @@ typedef struct st_mysql_cond mysql_cond_t;
#define mysql_mutex_assert_not_owner(M) \
safe_mutex_assert_not_owner(&(M)->m_mutex)
#define mysql_mutex_setflags(M, F) \
safe_mutex_setflags(&(M)->m_mutex, (F))
/** Wrappers for instrumented prlock objects. */
#define mysql_prlock_assert_write_owner(M) \
...
...
mysys/thr_mutex.c
View file @
86a2d707
...
...
@@ -201,7 +201,7 @@ int safe_mutex_init(safe_mutex_t *mp,
/* Deadlock detection is initialised only lazily, on first use. */
mp
->
create_flags
=
safe_mutex_deadlock_detector
?
MYF_NO_DEADLOCK_DETECTION
:
0
;
mp
->
create_flags
=
safe_mutex_deadlock_detector
?
0
:
MYF_NO_DEADLOCK_DETECTION
;
#ifdef SAFE_MUTEX_DETECT_DESTROY
/*
...
...
sql/rpl_mi.cc
View file @
86a2d707
...
...
@@ -41,17 +41,11 @@ Master_info::Master_info(bool is_slave_recovery)
bzero
((
char
*
)
&
file
,
sizeof
(
file
));
mysql_mutex_init
(
key_master_info_run_lock
,
&
run_lock
,
MY_MUTEX_INIT_FAST
);
mysql_mutex_init
(
key_master_info_data_lock
,
&
data_lock
,
MY_MUTEX_INIT_FAST
);
mysql_mutex_setflags
(
&
run_lock
,
MYF_NO_DEADLOCK_DETECTION
);
mysql_mutex_setflags
(
&
data_lock
,
MYF_NO_DEADLOCK_DETECTION
);
mysql_cond_init
(
key_master_info_data_cond
,
&
data_cond
,
NULL
);
mysql_cond_init
(
key_master_info_start_cond
,
&
start_cond
,
NULL
);
mysql_cond_init
(
key_master_info_stop_cond
,
&
stop_cond
,
NULL
);
#ifdef SAFE_MUTEX
/* Define mutex order for locks to find wrong lock usage */
mysql_mutex_lock
(
&
data_lock
);
mysql_mutex_lock
(
&
run_lock
);
mysql_mutex_unlock
(
&
run_lock
);
mysql_mutex_unlock
(
&
data_lock
);
#endif
}
Master_info
::~
Master_info
()
...
...
sql/slave.cc
View file @
86a2d707
...
...
@@ -3331,6 +3331,10 @@ pthread_handler_t handle_slave_sql(void *arg)
LINT_INIT
(
saved_master_log_pos
);
LINT_INIT
(
saved_log_pos
);
thd
=
new
THD
;
// note that contructor of THD uses DBUG_ !
thd
->
thread_stack
=
(
char
*
)
&
thd
;
// remember where our stack is
DBUG_ASSERT
(
rli
->
inited
);
mysql_mutex_lock
(
&
rli
->
run_lock
);
DBUG_ASSERT
(
!
rli
->
slave_running
);
...
...
@@ -3339,8 +3343,6 @@ pthread_handler_t handle_slave_sql(void *arg)
rli
->
events_till_abort
=
abort_slave_event_count
;
#endif
thd
=
new
THD
;
// note that contructor of THD uses DBUG_ !
thd
->
thread_stack
=
(
char
*
)
&
thd
;
// remember where our stack is
rli
->
sql_thd
=
thd
;
/* Inform waiting threads that slave has started */
...
...
sql/sql_class.cc
View file @
86a2d707
...
...
@@ -828,6 +828,11 @@ THD::THD()
mysql_mutex_init
(
key_LOCK_thd_data
,
&
LOCK_thd_data
,
MY_MUTEX_INIT_FAST
);
mysql_mutex_init
(
key_LOCK_wakeup_ready
,
&
LOCK_wakeup_ready
,
MY_MUTEX_INIT_FAST
);
mysql_cond_init
(
key_COND_wakeup_ready
,
&
COND_wakeup_ready
,
0
);
/*
LOCK_thread_count goes before LOCK_thd_data - the former is called around
'delete thd', the latter - in THD::~THD
*/
mysql_mutex_record_order
(
&
LOCK_thread_count
,
&
LOCK_thd_data
);
/* Variables with default values */
proc_info
=
"login"
;
...
...
storage/maria/ma_loghandler.c
View file @
86a2d707
...
...
@@ -1518,6 +1518,7 @@ static my_bool translog_buffer_init(struct st_translog_buffer *buffer, int num)
mysql_cond_init
(
key_TRANSLOG_BUFFER_prev_sent_to_disk_cond
,
&
buffer
->
prev_sent_to_disk_cond
,
0
))
DBUG_RETURN
(
1
);
mysql_mutex_setflags
(
&
buffer
->
mutex
,
MYF_NO_DEADLOCK_DETECTION
);
buffer
->
is_closing_buffer
=
0
;
buffer
->
prev_sent_to_disk
=
LSN_IMPOSSIBLE
;
buffer
->
prev_buffer_offset
=
LSN_IMPOSSIBLE
;
...
...
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