Commit 2c24b2e9 authored by dlenev@mysql.com's avatar dlenev@mysql.com

Manual merge after commiting START SLAVE UNTIL

parents cde0c369 c0cfae1c
......@@ -292,4 +292,7 @@
#define ER_SLAVE_IGNORED_SSL_PARAMS 1273
#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1274
#define ER_WARN_FIELD_RESOLVED 1275
#define ER_ERROR_MESSAGES 276
#define ER_BAD_SLAVE_UNTIL_COND 1276
#define ER_MISSING_SKIP_SLAVE 1277
#define ER_UNTIL_COND_IGNORED 1278
#define ER_ERROR_MESSAGES 279
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;
stop slave;
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
drop table t1;
create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: 4.1.1-alpha-debug-log, Binlog ver: 3
master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 172 Query 1 172 use `test`; insert into t1 values (1),(2),(3),(4)
master-bin.000001 244 Query 1 244 use `test`; drop table t1
master-bin.000001 292 Query 1 292 use `test`; create table t2(n int not null auto_increment primary key)
master-bin.000001 385 Query 1 385 use `test`; insert into t2 values (1),(2)
master-bin.000001 449 Query 1 449 use `test`; insert into t2 values (3),(4)
master-bin.000001 513 Query 1 513 use `test`; drop table t2
start slave until master_log_file='master-bin.000001', master_log_pos=244;
select * from t1;
n
1
2
3
4
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 288 master-bin.000001 Yes No 0 0 244 609 Master master-bin.000001 244
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
1
2
3
4
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 288 master-bin.000001 Yes No 0 0 244 609 Master master-no-such-bin.000001 291
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=493;
select * from t2;
n
1
2
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 493 master-bin.000001 Yes No 0 0 449 609 Relay slave-relay-bin.000002 493
start slave;
stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=561;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos
127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 605 master-bin.000001 Yes No 0 0 561 609 Master master-bin.000001 561
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001';
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002';
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=561;
Warnings:
Note 1252 The slave was already running
source include/master-slave.inc;
# stop slave before he will start replication
connection slave;
stop slave;
connection master;
# create some events on master
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
drop table t1;
create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
show binlog events;
# try to replicate all queries until drop of t1
connection slave;
start slave until master_log_file='master-bin.000001', master_log_pos=244;
sleep 2;
# here table should be still not deleted
select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT
show slave status;
# this should fail right after start
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
# again this table should be still not deleted
select * from t1;
sleep 2;
--replace_result $MASTER_MYPORT MASTER_MYPORT
show slave status;
# try replicate all until second insert to t2;
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=493;
sleep 2;
select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT
show slave status;
# clean up
start slave;
connection master;
save_master_pos;
connection slave;
sync_with_master;
stop slave;
# this should stop immideately
start slave until master_log_file='master-bin.000001', master_log_pos=561;
sleep 2;
# here the sql slave thread should be stopped
--replace_result $MASTER_MYPORT MASTER_MYPORT
show slave status;
#testing various error conditions
--error 1272
start slave until master_log_file='master-bin', master_log_pos=561;
--error 1272
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
--error 1272
start slave until master_log_file='master-bin.000001';
--error 1272
start slave until relay_log_file='slave-relay-bin.000002';
--error 1272
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=561;
......@@ -411,6 +411,7 @@ static SYMBOL symbols[] = {
{ "USE", SYM(USE_SYM),0,0},
{ "USE_FRM", SYM(USE_FRM),0,0},
{ "USER", SYM(USER),0,0},
{ "UNTIL", SYM(UNTIL_SYM),0,0},
{ "USING", SYM(USING),0,0},
{ "UTC_DATE", SYM(UTC_DATE_SYM),0,0},
{ "UTC_TIME", SYM(UTC_TIME_SYM),0,0},
......
......@@ -705,6 +705,7 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included)
rli->group_relay_log_pos = BIN_LOG_HEADER_SIZE;
strmake(rli->group_relay_log_name,rli->linfo.log_file_name,
sizeof(rli->group_relay_log_name)-1);
rli->notify_group_relay_log_name_update();
}
/* Store where we are in the new file for the execution thread */
......
......@@ -1897,6 +1897,7 @@ transaction.");
#endif
memcpy(log_name, new_log_ident, ident_len+1);
rli->notify_group_master_log_name_update();
rli->group_master_log_pos = pos;
rli->event_relay_log_pos += get_event_len();
rli->group_relay_log_pos = rli->event_relay_log_pos;
......
......@@ -928,6 +928,12 @@ int load_master_data(THD* thd)
active_mi->rli.group_master_log_pos = active_mi->master_log_pos;
strmake(active_mi->rli.group_master_log_name,active_mi->master_log_name,
sizeof(active_mi->rli.group_master_log_name)-1);
/*
Cancel the previous START SLAVE UNTIL, as the fact to download
a new copy logically makes UNTIL irrelevant.
*/
clear_until_condition(&active_mi->rli);
/*
No need to update rli.event* coordinates, they will be when the slave
threads start ; only rli.group* coordinates are necessary here.
......
......@@ -286,3 +286,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -280,3 +280,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -288,3 +288,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -277,3 +277,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -282,3 +282,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -277,3 +277,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -286,3 +286,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -277,3 +277,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -279,3 +279,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -277,3 +277,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -279,3 +279,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -277,3 +277,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -279,3 +279,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -279,3 +279,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -281,3 +281,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -277,3 +277,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -281,3 +281,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -279,3 +279,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
" --secure-auth ( ), '%s@%s' Σ ; "
" '%-.64s%s%-.64s%s%-.64s' SELECT #%d SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -272,3 +272,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -285,3 +285,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -278,3 +278,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -277,3 +277,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
......@@ -282,3 +282,6 @@
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started."
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format"
" '%-.64s%s%-.64s%s%-.64s' SELECT #%d SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
This diff is collapsed.
......@@ -233,9 +233,55 @@ typedef struct st_relay_log_info
bool inited;
volatile bool abort_slave, slave_running;
/*
Condition and its parameters from START SLAVE UNTIL clause.
UNTIL condition is tested with is_until_satisfied() method that is
called by exec_relay_log_event(). is_until_satisfied() caches the result
of the comparison of log names because log names don't change very often;
this cache is invalidated by parts of code which change log names with
notify_*_log_name_updated() methods. (They need to be called only if SQL
thread is running).
*/
enum {UNTIL_NONE= 0, UNTIL_MASTER_POS, UNTIL_RELAY_POS} until_condition;
char until_log_name[FN_REFLEN];
ulonglong until_log_pos;
/* extension extracted from log_name and converted to int */
ulong until_log_name_extension;
/*
Cached result of comparison of until_log_name and current log name
-2 means unitialised, -1,0,1 are comarison results
*/
enum
{
UNTIL_LOG_NAMES_CMP_UNKNOWN= -2, UNTIL_LOG_NAMES_CMP_LESS= -1,
UNTIL_LOG_NAMES_CMP_EQUAL= 0, UNTIL_LOG_NAMES_CMP_GREATER= 1
} until_log_names_cmp_result;
st_relay_log_info();
~st_relay_log_info();
/*
Invalidate cached until_log_name and group_relay_log_name comparison
result. Should be called after any update of group_realy_log_name if
there chances that sql_thread is running.
*/
inline void notify_group_relay_log_name_update()
{
if (until_condition==UNTIL_RELAY_POS)
until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_UNKNOWN;
}
/*
The same as previous but for group_master_log_name.
*/
inline void notify_group_master_log_name_update()
{
if (until_condition==UNTIL_MASTER_POS)
until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_UNKNOWN;
}
inline void inc_event_relay_log_pos(ulonglong val)
{
event_relay_log_pos+= val;
......@@ -249,6 +295,9 @@ typedef struct st_relay_log_info
group_relay_log_pos= event_relay_log_pos;
strmake(group_relay_log_name,event_relay_log_name,
sizeof(group_relay_log_name)-1);
notify_group_relay_log_name_update();
/*
If the slave does not support transactions and replicates a transaction,
users should not trust group_master_log_pos (which they can display with
......@@ -268,6 +317,10 @@ typedef struct st_relay_log_info
int wait_for_pos(THD* thd, String* log_name, longlong log_pos,
longlong timeout);
/* Check if UNTIL condition is satisfied. See slave.cc for more. */
bool is_until_satisfied();
} RELAY_LOG_INFO;
......@@ -457,6 +510,7 @@ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...);
void end_slave(); /* clean up */
void init_master_info_with_options(MASTER_INFO* mi);
void clear_until_condition(RELAY_LOG_INFO* rli);
void clear_last_slave_error(RELAY_LOG_INFO* rli);
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
const char* slave_info_fname,
......
......@@ -663,7 +663,7 @@ Increase max_allowed_packet on master";
int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
{
int slave_errno;
int slave_errno= 0;
if (!thd)
thd = current_thd;
int thread_mask;
......@@ -687,21 +687,88 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
if (init_master_info(mi,master_info_file,relay_log_info_file, 0))
slave_errno=ER_MASTER_INFO;
else if (server_id_supplied && *mi->host)
slave_errno = start_slave_threads(0 /*no mutex */,
{
/*
If we will start SQL thread we will care about UNTIL options
If not and they are specified we will ignore them and warn user
about this fact.
*/
if (thread_mask & SLAVE_SQL)
{
pthread_mutex_lock(&mi->rli.data_lock);
if (thd->lex.mi.pos)
{
mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_MASTER_POS;
mi->rli.until_log_pos= thd->lex.mi.pos;
/*
We don't check thd->lex.mi.log_file_name for NULL here
since it is checked in sql_yacc.yy
*/
strmake(mi->rli.until_log_name, thd->lex.mi.log_file_name,
sizeof(mi->rli.until_log_name)-1);
}
else if (thd->lex.mi.relay_log_pos)
{
mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_RELAY_POS;
mi->rli.until_log_pos= thd->lex.mi.relay_log_pos;
strmake(mi->rli.until_log_name, thd->lex.mi.relay_log_name,
sizeof(mi->rli.until_log_name)-1);
}
else
clear_until_condition(&mi->rli);
if (mi->rli.until_condition != RELAY_LOG_INFO::UNTIL_NONE)
{
/* Preparing members for effective until condition checking */
const char *p= fn_ext(mi->rli.until_log_name);
char *p_end;
if (*p)
{
//p points to '.'
mi->rli.until_log_name_extension= strtoul(++p,&p_end, 10);
/*
p_end points to the first invalid character. If it equals
to p, no digits were found, error. If it contains '\0' it
means conversion went ok.
*/
if(p_end==p || *p_end)
slave_errno=ER_BAD_SLAVE_UNTIL_COND;
}
else
slave_errno=ER_BAD_SLAVE_UNTIL_COND;
/* mark the cached result of the UNTIL comparison as "undefined" */
mi->rli.until_log_names_cmp_result=
RELAY_LOG_INFO::UNTIL_LOG_NAMES_CMP_UNKNOWN;
/* Issuing warning then started without --skip-slave-start */
if (!opt_skip_slave_start)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_MISSING_SKIP_SLAVE,
ER(ER_MISSING_SKIP_SLAVE));
}
pthread_mutex_unlock(&mi->rli.data_lock);
}
else if (thd->lex.mi.pos || thd->lex.mi.relay_log_pos)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED,
ER(ER_UNTIL_COND_IGNORED));
if(!slave_errno)
slave_errno = start_slave_threads(0 /*no mutex */,
1 /* wait for start */,
mi,
master_info_file,relay_log_info_file,
thread_mask);
}
else
slave_errno = ER_BAD_SLAVE;
}
else
{
//no error if all threads are already started, only a warning
slave_errno= 0;
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SLAVE_WAS_RUNNING,
ER(ER_SLAVE_WAS_RUNNING));
}
unlock_slave_threads(mi);
......@@ -814,6 +881,8 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
*/
init_master_info_with_options(mi);
clear_last_slave_error(&mi->rli);
clear_until_condition(&mi->rli);
// close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
end_master_info(mi);
// and delete these two files
......@@ -1027,6 +1096,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */
/* Clear the error, for a clean start. */
clear_last_slave_error(&mi->rli);
clear_until_condition(&mi->rli);
/*
If we don't write new coordinates to disk now, then old will remain in
relay-log.info until START SLAVE is issued; but if mysqld is shutdown
......
......@@ -168,6 +168,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token SUPER_SYM
%token TRUNCATE_SYM
%token UNLOCK_SYM
%token UNTIL_SYM
%token UPDATE_SYM
%token ACTION
......@@ -677,7 +678,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
insert_values update delete truncate rename
show describe load alter optimize preload flush
reset purge begin commit rollback savepoint
slave master_def master_defs
slave master_def master_defs master_file_def
repair restore backup analyze check start checksum
field_list field_list_item field_spec kill column_def key_def
preload_list preload_keys
......@@ -816,49 +817,15 @@ master_def:
Lex->mi.password = $3.str;
}
|
MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
{
Lex->mi.log_file_name = $3.str;
}
|
MASTER_PORT_SYM EQ ULONG_NUM
{
Lex->mi.port = $3;
}
|
MASTER_LOG_POS_SYM EQ ulonglong_num
{
Lex->mi.pos = $3;
/*
If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
instead of causing subsequent errors.
We need to do it in this file, because only there we know that
MASTER_LOG_POS has been explicitely specified. On the contrary
in change_master() (sql_repl.cc) we cannot distinguish between 0
(MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified),
whereas we want to distinguish (specified 0 means "read the binlog
from 0" (4 in fact), unspecified means "don't change the position
(keep the preceding value)").
*/
Lex->mi.pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
}
|
MASTER_CONNECT_RETRY_SYM EQ ULONG_NUM
{
Lex->mi.connect_retry = $3;
}
|
RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
{
Lex->mi.relay_log_name = $3.str;
}
|
RELAY_LOG_POS_SYM EQ ULONG_NUM
{
Lex->mi.relay_log_pos = $3;
/* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
}
| MASTER_SSL_SYM EQ ULONG_NUM
{
Lex->mi.ssl= $3 ?
......@@ -883,9 +850,43 @@ master_def:
| MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
{
Lex->mi.ssl_key= $3.str;
}
}
|
master_file_def
;
master_file_def:
MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
{
Lex->mi.log_file_name = $3.str;
}
| MASTER_LOG_POS_SYM EQ ulonglong_num
{
Lex->mi.pos = $3;
/*
If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
instead of causing subsequent errors.
We need to do it in this file, because only there we know that
MASTER_LOG_POS has been explicitely specified. On the contrary
in change_master() (sql_repl.cc) we cannot distinguish between 0
(MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified),
whereas we want to distinguish (specified 0 means "read the binlog
from 0" (4 in fact), unspecified means "don't change the position
(keep the preceding value)").
*/
Lex->mi.pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
}
| RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
{
Lex->mi.relay_log_name = $3.str;
}
| RELAY_LOG_POS_SYM EQ ULONG_NUM
{
Lex->mi.relay_log_pos = $3;
/* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
}
;
/* create a table */
......@@ -1752,12 +1753,16 @@ opt_to:
*/
slave:
START_SYM SLAVE slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_START;
lex->type = 0;
}
START_SYM SLAVE slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_START;
lex->type = 0;
/* We'll use mi structure for UNTIL options */
bzero((char*) &lex->mi, sizeof(lex->mi));
}
slave_until
{}
| STOP_SYM SLAVE slave_thread_opts
{
LEX *lex=Lex;
......@@ -1774,6 +1779,7 @@ start:
slave_thread_opts:
{ Lex->slave_thd_opt= 0; }
slave_thread_opt_list
{}
;
slave_thread_opt_list:
......@@ -1787,6 +1793,28 @@ slave_thread_opt:
| RELAY_THREAD { Lex->slave_thd_opt|=SLAVE_IO; }
;
slave_until:
/*empty*/ {}
| UNTIL_SYM slave_until_opts
{
LEX *lex=Lex;
if ((lex->mi.log_file_name || lex->mi.pos) &&
(lex->mi.relay_log_name || lex->mi.relay_log_pos) ||
!((lex->mi.log_file_name && lex->mi.pos) ||
(lex->mi.relay_log_name && lex->mi.relay_log_pos)))
{
send_error(lex->thd, ER_BAD_SLAVE_UNTIL_COND);
YYABORT;
}
}
;
slave_until_opts:
master_file_def
| slave_until_opts ',' master_file_def ;
restore:
RESTORE_SYM table_or_tables
{
......@@ -4605,6 +4633,7 @@ keyword:
| UDF_SYM {}
| UNCOMMITTED_SYM {}
| UNICODE_SYM {}
| UNTIL_SYM {}
| USER {}
| USE_FRM {}
| VARIABLES {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment