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
110d78e2
Commit
110d78e2
authored
Dec 14, 2009
by
Alexey Kopytov
Browse files
Options
Browse Files
Download
Plain Diff
Automerge
parents
30e9b381
40468572
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
7 deletions
+101
-7
mysql-test/suite/rpl/r/rpl_stm_until.result
mysql-test/suite/rpl/r/rpl_stm_until.result
+28
-0
mysql-test/suite/rpl/t/rpl_stm_until.test
mysql-test/suite/rpl/t/rpl_stm_until.test
+64
-0
sql/rpl_rli.cc
sql/rpl_rli.cc
+6
-2
sql/rpl_rli.h
sql/rpl_rli.h
+1
-1
sql/slave.cc
sql/slave.cc
+2
-4
No files found.
mysql-test/suite/rpl/r/rpl_stm_until.result
View file @
110d78e2
...
...
@@ -212,3 +212,31 @@ start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=776;
Warnings:
Note 1254 Slave is already running
include/stop_slave.inc
drop table if exists t1;
reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
drop table if exists t1;
reset master;
create table t1 (a int primary key auto_increment);
start slave;
include/stop_slave.inc
master and slave are in sync now
select 0 as zero;
zero
0
insert into t1 set a=null;
insert into t1 set a=null;
select count(*) as two from t1;
two
2
start slave until master_log_file='master-bin.000001', master_log_pos= UNTIL_POS;;
slave stopped at the prescribed position
select 0 as zero;
zero
0
select count(*) as one from t1;
one
1
drop table t1;
start slave;
mysql-test/suite/rpl/t/rpl_stm_until.test
View file @
110d78e2
...
...
@@ -98,3 +98,67 @@ start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
start
slave
sql_thread
;
start
slave
until
master_log_file
=
'master-bin.000001'
,
master_log_pos
=
776
;
#
# bug#47210 first execution of "start slave until" stops too early
#
# testing that a slave rotate event that is caused by stopping the slave
# does not intervene anymore in UNTIL condition.
#
connection
slave
;
source
include
/
stop_slave
.
inc
;
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
reset
slave
;
--
replace_result
$MASTER_MYPORT
MASTER_PORT
eval
change
master
to
master_host
=
'127.0.0.1'
,
master_port
=
$MASTER_MYPORT
,
master_user
=
'root'
;
connection
master
;
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
reset
master
;
create
table
t1
(
a
int
primary
key
auto_increment
);
save_master_pos
;
let
$master_pos
=
query_get_value
(
SHOW
MASTER
STATUS
,
Position
,
1
);
connection
slave
;
start
slave
;
sync_with_master
;
# at this point slave will close the relay log stamping it with its own
# Rotate log event. This event won't be examined on matter of the master
# UNTIL pos anymore.
source
include
/
stop_slave
.
inc
;
let
$slave_exec_pos
=
query_get_value
(
SHOW
SLAVE
STATUS
,
Exec_Master_Log_Pos
,
1
);
--
echo
master
and
slave
are
in
sync
now
let
$diff_pos
=
`select $master_pos - $slave_exec_pos`
;
eval
select
$diff_pos
as
zero
;
connection
master
;
insert
into
t1
set
a
=
null
;
let
$until_pos
=
query_get_value
(
SHOW
MASTER
STATUS
,
Position
,
1
);
insert
into
t1
set
a
=
null
;
select
count
(
*
)
as
two
from
t1
;
connection
slave
;
--
replace_result
$until_pos
UNTIL_POS
;
eval
start
slave
until
master_log_file
=
'master-bin.000001'
,
master_log_pos
=
$until_pos
;
source
include
/
wait_for_slave_sql_to_stop
.
inc
;
let
$slave_exec_pos
=
query_get_value
(
SHOW
SLAVE
STATUS
,
Exec_Master_Log_Pos
,
1
);
--
echo
slave
stopped
at
the
prescribed
position
let
$diff_pos
=
`select $until_pos - $slave_exec_pos`
;
eval
select
$diff_pos
as
zero
;
select
count
(
*
)
as
one
from
t1
;
connection
master
;
drop
table
t1
;
connection
slave
;
start
slave
;
sync_with_master
;
# End of tests
sql/rpl_rli.cc
View file @
110d78e2
...
...
@@ -1022,7 +1022,7 @@ err:
false - condition not met
*/
bool
Relay_log_info
::
is_until_satisfied
(
my_off_t
master_beg_pos
)
bool
Relay_log_info
::
is_until_satisfied
(
THD
*
thd
,
Log_event
*
ev
)
{
const
char
*
log_name
;
ulonglong
log_pos
;
...
...
@@ -1032,8 +1032,12 @@ bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos)
if
(
until_condition
==
UNTIL_MASTER_POS
)
{
if
(
ev
&&
ev
->
server_id
==
(
uint32
)
::
server_id
&&
!
replicate_same_server_id
)
DBUG_RETURN
(
FALSE
);
log_name
=
group_master_log_name
;
log_pos
=
master_beg_pos
;
log_pos
=
(
!
ev
)
?
group_master_log_pos
:
((
thd
->
options
&
OPTION_BEGIN
||
!
ev
->
log_pos
)
?
group_master_log_pos
:
ev
->
log_pos
-
ev
->
data_written
);
}
else
{
/* until_condition == UNTIL_RELAY_POS */
...
...
sql/rpl_rli.h
View file @
110d78e2
...
...
@@ -303,7 +303,7 @@ public:
void
close_temporary_tables
();
/* Check if UNTIL condition is satisfied. See slave.cc for more. */
bool
is_until_satisfied
(
my_off_t
master_beg_pos
);
bool
is_until_satisfied
(
THD
*
thd
,
Log_event
*
ev
);
inline
ulonglong
until_pos
()
{
return
((
until_condition
==
UNTIL_MASTER_POS
)
?
group_master_log_pos
:
...
...
sql/slave.cc
View file @
110d78e2
...
...
@@ -2258,9 +2258,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
hits the UNTIL barrier.
*/
if
(
rli
->
until_condition
!=
Relay_log_info
::
UNTIL_NONE
&&
rli
->
is_until_satisfied
((
rli
->
is_in_group
()
||
!
ev
->
log_pos
)
?
rli
->
group_master_log_pos
:
ev
->
log_pos
-
ev
->
data_written
))
rli
->
is_until_satisfied
(
thd
,
ev
))
{
char
buf
[
22
];
sql_print_information
(
"Slave SQL thread stopped because it reached its"
...
...
@@ -3003,7 +3001,7 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
*/
pthread_mutex_lock
(
&
rli
->
data_lock
);
if
(
rli
->
until_condition
!=
Relay_log_info
::
UNTIL_NONE
&&
rli
->
is_until_satisfied
(
rli
->
group_master_log_pos
))
rli
->
is_until_satisfied
(
thd
,
NULL
))
{
char
buf
[
22
];
sql_print_information
(
"Slave SQL thread stopped because it reached its"
...
...
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