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
81d05cfa
Commit
81d05cfa
authored
Apr 30, 2009
by
Andrei Elkin
Browse files
Options
Browse Files
Download
Plain Diff
merging 5.0-bt to 5.1-bt
parents
fbacc10c
6b39bb5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
20 deletions
+56
-20
mysql-test/r/rpl_bug38694.result
mysql-test/r/rpl_bug38694.result
+6
-0
mysql-test/t/rpl_bug38694-slave.opt
mysql-test/t/rpl_bug38694-slave.opt
+1
-0
mysql-test/t/rpl_bug38694.test
mysql-test/t/rpl_bug38694.test
+10
-0
sql/slave.cc
sql/slave.cc
+39
-20
No files found.
mysql-test/r/rpl_bug38694.result
0 → 100644
View file @
81d05cfa
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
mysql-test/t/rpl_bug38694-slave.opt
0 → 100644
View file @
81d05cfa
--loose-debug=d,simulate_slave_delay_at_terminate_bug38694
mysql-test/t/rpl_bug38694.test
0 → 100644
View file @
81d05cfa
# Testing replication threads stopping concurrency issue
# at the server shutdown
# Related bugs: bug#38694, bug#29968, bug#25306
# The test checks if a delay at the termination phase of slave threads
# DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
# could cause any issue.
source
include
/
master
-
slave
.
inc
;
# End of tests
sql/slave.cc
View file @
81d05cfa
...
...
@@ -143,8 +143,8 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi);
static
Log_event
*
next_event
(
Relay_log_info
*
rli
);
static
int
queue_event
(
Master_info
*
mi
,
const
char
*
buf
,
ulong
event_len
);
static
int
terminate_slave_thread
(
THD
*
thd
,
pthread_mutex_t
*
term_lock
,
pthread_cond_t
*
term_cond
,
pthread_mutex_t
*
term_lock
,
pthread_cond_t
*
term_cond
,
volatile
uint
*
slave_running
,
bool
skip_lock
);
static
bool
check_io_slave_killed
(
THD
*
thd
,
Master_info
*
mi
,
const
char
*
info
);
...
...
@@ -399,24 +399,24 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
int
error
,
force_all
=
(
thread_mask
&
SLAVE_FORCE_ALL
);
pthread_mutex_t
*
sql_lock
=
&
mi
->
rli
.
run_lock
,
*
io_lock
=
&
mi
->
run_lock
;
if
(
(
thread_mask
&
(
SLAVE_IO
|
SLAVE_FORCE_ALL
)
))
if
(
thread_mask
&
(
SLAVE_IO
|
SLAVE_FORCE_ALL
))
{
DBUG_PRINT
(
"info"
,(
"Terminating IO thread"
));
mi
->
abort_slave
=
1
;
if
((
error
=
terminate_slave_thread
(
mi
->
io_thd
,
io_lock
,
&
mi
->
stop_cond
,
&
mi
->
slave_running
,
if
((
error
=
terminate_slave_thread
(
mi
->
io_thd
,
io_lock
,
&
mi
->
stop_cond
,
&
mi
->
slave_running
,
skip_lock
))
&&
!
force_all
)
DBUG_RETURN
(
error
);
}
if
(
(
thread_mask
&
(
SLAVE_SQL
|
SLAVE_FORCE_ALL
)
))
if
(
thread_mask
&
(
SLAVE_SQL
|
SLAVE_FORCE_ALL
))
{
DBUG_PRINT
(
"info"
,(
"Terminating SQL thread"
));
mi
->
rli
.
abort_slave
=
1
;
if
((
error
=
terminate_slave_thread
(
mi
->
rli
.
sql_thd
,
sql_lock
,
&
mi
->
rli
.
stop_cond
,
&
mi
->
rli
.
slave_running
,
if
((
error
=
terminate_slave_thread
(
mi
->
rli
.
sql_thd
,
sql_lock
,
&
mi
->
rli
.
stop_cond
,
&
mi
->
rli
.
slave_running
,
skip_lock
))
&&
!
force_all
)
DBUG_RETURN
(
error
);
...
...
@@ -424,7 +424,6 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
DBUG_RETURN
(
0
);
}
/**
Wait for a slave thread to terminate.
...
...
@@ -452,29 +451,46 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
the condition. In this case, it is assumed that the calling
function acquires the lock before calling this function.
@retval 0 All OK
@retval 0 All OK ER_SLAVE_NOT_RUNNING otherwise.
@note If the executing thread has to acquire term_lock (skip_lock
is false), the negative running status does not represent
any issue therefore no error is reported.
*/
static
int
terminate_slave_thread
(
THD
*
thd
,
pthread_mutex_t
*
term_lock
,
pthread_cond_t
*
term_cond
,
pthread_mutex_t
*
term_lock
,
pthread_cond_t
*
term_cond
,
volatile
uint
*
slave_running
,
bool
skip_lock
)
{
int
error
;
DBUG_ENTER
(
"terminate_slave_thread"
);
if
(
!
skip_lock
)
{
pthread_mutex_lock
(
term_lock
);
safe_mutex_assert_owner
(
term_lock
);
}
else
{
safe_mutex_assert_owner
(
term_lock
);
}
if
(
!*
slave_running
)
{
if
(
!
skip_lock
)
{
/*
if run_lock (term_lock) is acquired locally then either
slave_running status is fine
*/
pthread_mutex_unlock
(
term_lock
);
DBUG_RETURN
(
ER_SLAVE_NOT_RUNNING
);
DBUG_RETURN
(
0
);
}
else
{
DBUG_RETURN
(
ER_SLAVE_NOT_RUNNING
);
}
}
DBUG_ASSERT
(
thd
!=
0
);
THD_CHECK_SENTRY
(
thd
);
...
...
@@ -486,6 +502,7 @@ terminate_slave_thread(THD *thd,
while
(
*
slave_running
)
// Should always be true
{
int
error
;
DBUG_PRINT
(
"loop"
,
(
"killing slave thread"
));
pthread_mutex_lock
(
&
thd
->
LOCK_delete
);
...
...
@@ -627,7 +644,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
&
mi
->
rli
.
slave_running
,
&
mi
->
rli
.
slave_run_id
,
mi
,
0
);
if
(
error
)
terminate_slave_threads
(
mi
,
thread_mask
&
SLAVE_IO
,
0
);
terminate_slave_threads
(
mi
,
thread_mask
&
SLAVE_IO
,
!
need_slave_mutex
);
}
DBUG_RETURN
(
error
);
}
...
...
@@ -2640,6 +2657,7 @@ log space");
delete the mi structure leading to a crash! (see BUG#25306 for details)
*/
pthread_cond_broadcast
(
&
mi
->
stop_cond
);
// tell the world we are done
DBUG_EXECUTE_IF
(
"simulate_slave_delay_at_terminate_bug38694"
,
sleep
(
5
););
pthread_mutex_unlock
(
&
mi
->
run_lock
);
my_thread_end
();
pthread_exit
(
0
);
...
...
@@ -2989,6 +3007,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
delete the mi structure leading to a crash! (see BUG#25306 for details)
*/
pthread_cond_broadcast
(
&
rli
->
stop_cond
);
DBUG_EXECUTE_IF
(
"simulate_slave_delay_at_terminate_bug38694"
,
sleep
(
5
););
pthread_mutex_unlock
(
&
rli
->
run_lock
);
// tell the world we are done
my_thread_end
();
...
...
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