diff options
author | unknown <dlenev@mysql.com> | 2003-09-14 01:57:09 +0400 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2003-09-14 01:57:09 +0400 |
commit | 95a16b697abde8ae0631bdad0fee0f578f573084 (patch) | |
tree | 9b95250006febf53e90b41329026267482bcd75e /sql | |
parent | 1179d87a38d5f96b9dec23e7944c341cdd1cbf51 (diff) | |
parent | df7707c397e78a78bebcb8b5e395bbdc71024419 (diff) | |
download | mariadb-git-95a16b697abde8ae0631bdad0fee0f578f573084.tar.gz |
Manual merge after commiting START SLAVE UNTIL
sql/lex.h:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/repl_failsafe.cc:
Auto merged
include/mysqld_error.h:
Manual merge
mysql-test/r/rpl000015.result:
Manual merge
mysql-test/r/rpl_empty_master_crash.result:
Manual merge
mysql-test/r/rpl_flush_log_loop.result:
Manual merge
mysql-test/r/rpl_log.result:
Manual merge
mysql-test/r/rpl_log_pos.result:
Manual merge
mysql-test/r/rpl_redirect.result:
Manual merge
mysql-test/r/rpl_replicate_do.result:
Manual merge
mysql-test/r/rpl_rotate_logs.result:
Manual merge
sql/share/czech/errmsg.txt:
Manual merge
sql/share/danish/errmsg.txt:
Manual merge
sql/share/dutch/errmsg.txt:
Manual merge
sql/share/english/errmsg.txt:
Manual merge
sql/share/estonian/errmsg.txt:
Manual merge
sql/share/french/errmsg.txt:
Manual merge
sql/share/german/errmsg.txt:
Manual merge
sql/share/greek/errmsg.txt:
Manual merge
sql/share/hungarian/errmsg.txt:
Manual merge
sql/share/italian/errmsg.txt:
Manual merge
sql/share/japanese/errmsg.txt:
Manual merge
sql/share/korean/errmsg.txt:
Manual merge
sql/share/norwegian-ny/errmsg.txt:
Manual merge
sql/share/norwegian/errmsg.txt:
Manual merge
sql/share/polish/errmsg.txt:
Manual merge
sql/share/portuguese/errmsg.txt:
Manual merge
sql/share/romanian/errmsg.txt:
Manual merge
sql/share/russian/errmsg.txt:
Manual merge
sql/share/serbian/errmsg.txt:
Manual merge
sql/share/slovak/errmsg.txt:
Manual merge
sql/share/spanish/errmsg.txt:
Manual merge
sql/share/swedish/errmsg.txt:
Manual merge
sql/share/ukrainian/errmsg.txt:
Manual merge
sql/slave.cc:
Manual merge
sql/slave.h:
Manual merge
sql/sql_repl.cc:
Manual merge
sql/sql_yacc.yy:
Manual merge
Diffstat (limited to 'sql')
31 files changed, 436 insertions, 61 deletions
diff --git a/sql/lex.h b/sql/lex.h index aa6d96d4029..fb3c018de42 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -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}, diff --git a/sql/log.cc b/sql/log.cc index f279d6d679c..33464d0ab29 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -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 */ diff --git a/sql/log_event.cc b/sql/log_event.cc index 6be8fe54854..c0d27f672ca 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -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; diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 8f0e18999b3..5e040d26dc3 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -929,6 +929,12 @@ int load_master_data(THD* thd) 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. */ diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 31b52d71531..e920a2139db 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -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" diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index c0b2eb84a39..beea26d5f51 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -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" diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 9c04e097a06..6eca86deba2 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -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" diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index a803f6673f4..8b9ed103cbb 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -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" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 024c3038719..b4c17303ef0 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -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" diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 74b07e983a1..9f321a908b6 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -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" diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 724d37bd2da..b5b47091035 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -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" diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 968867f80ed..cf6f45eea84 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -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" diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 9a547e09a91..43dcfcd16d3 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -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" diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 869ebfb7e5d..125dca5310e 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -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" diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 77036d2d46b..1b73380df1c 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -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" diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 7f2fb47c8fb..a32a8f1033e 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -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" diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 45a07600df6..83da00a5955 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -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" diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 953f628fd62..81cfad7e494 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -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" diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 97ec0745c37..69b9c898ae7 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -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" diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 5ed3c198402..2862e8036dc 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -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" diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index b0056ba5b7a..0591a082490 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -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" diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 4d328f2babe..fe276396d92 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -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" diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index 1683d354d63..5869fa62c04 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -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" diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index b4ce439bdc3..9cf4d874339 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -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" diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 5f73463e157..72f4249b4c9 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -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" diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index a550ff891b8..cf7859712ee 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -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" diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 7b09e2ce94a..2e7a01d9573 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -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" diff --git a/sql/slave.cc b/sql/slave.cc index 0c8db2fe6cc..8490881f5dc 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -238,10 +238,12 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, *errmsg=0; pthread_mutex_t *log_lock=rli->relay_log.get_log_lock(); - pthread_mutex_lock(log_lock); + if (need_data_lock) pthread_mutex_lock(&rli->data_lock); + pthread_mutex_lock(log_lock); + /* Close log file and free buffers if it's already open */ if (rli->cur_log_fd >= 0) { @@ -304,10 +306,12 @@ err: if (!relay_log_purge) rli->log_space_limit= 0; pthread_cond_broadcast(&rli->data_cond); + + pthread_mutex_unlock(log_lock); + if (need_data_lock) pthread_mutex_unlock(&rli->data_lock); - pthread_mutex_unlock(log_lock); DBUG_RETURN ((*errmsg) ? 1 : 0); } @@ -1543,6 +1547,7 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli) DBUG_RETURN(0); } + void init_master_info_with_options(MASTER_INFO* mi) { mi->master_log_name[0] = 0; @@ -1570,6 +1575,7 @@ void init_master_info_with_options(MASTER_INFO* mi) strmake(mi->ssl_key, master_ssl_key, sizeof(mi->ssl_key)-1); } + void clear_last_slave_error(RELAY_LOG_INFO* rli) { //Clear the errors displayed by SHOW SLAVE STATUS @@ -1578,6 +1584,20 @@ void clear_last_slave_error(RELAY_LOG_INFO* rli) } +/* + Reset UNTIL condition for RELAY_LOG_INFO + SYNOPSYS + clear_until_condition() + rli - RELAY_LOG_INFO structure where UNTIL condition should be reset + */ +void clear_until_condition(RELAY_LOG_INFO* rli) +{ + rli->until_condition= RELAY_LOG_INFO::UNTIL_NONE; + rli->until_log_name[0]= 0; + rli->until_log_pos= 0; +} + + #define LINES_IN_MASTER_INFO_WITH_SSL 14 @@ -1901,6 +1921,10 @@ int show_master_info(THD* thd, MASTER_INFO* mi) MYSQL_TYPE_LONGLONG)); field_list.push_back(new Item_return_int("Relay_log_space", 10, MYSQL_TYPE_LONGLONG)); + field_list.push_back(new Item_empty_string("Until_condition", 6)); + field_list.push_back(new Item_empty_string("Until_Log_File", FN_REFLEN)); + field_list.push_back(new Item_return_int("Until_Log_pos", 10, + MYSQL_TYPE_LONGLONG)); field_list.push_back(new Item_empty_string("Master_SSL_Allowed", 7)); field_list.push_back(new Item_empty_string("Master_SSL_CA_File", sizeof(mi->ssl_ca))); @@ -1961,6 +1985,14 @@ int show_master_info(THD* thd, MASTER_INFO* mi) protocol->store((uint32) mi->rli.slave_skip_counter); protocol->store((ulonglong) mi->rli.group_master_log_pos); protocol->store((ulonglong) mi->rli.log_space_total); + + protocol->store( + mi->rli.until_condition==RELAY_LOG_INFO::UNTIL_NONE ? "None": + ( mi->rli.until_condition==RELAY_LOG_INFO::UNTIL_MASTER_POS? "Master": + "Relay"), &my_charset_bin); + protocol->store(mi->rli.until_log_name, &my_charset_bin); + protocol->store((ulonglong) mi->rli.until_log_pos); + #ifdef HAVE_OPENSSL protocol->store(mi->ssl? "Yes":"No", &my_charset_bin); #else @@ -2016,11 +2048,11 @@ st_relay_log_info::st_relay_log_info() cur_log_old_open_count(0), group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0), slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), sql_thd(0), last_slave_errno(0), inited(0), abort_slave(0), - slave_running(0) + slave_running(0), until_condition(UNTIL_NONE), until_log_pos(0) { group_relay_log_name[0]= event_relay_log_name[0]= group_master_log_name[0]= 0; - last_slave_error[0]=0; - + last_slave_error[0]=0; until_log_name[0]= 0; + bzero((char*) &info_file, sizeof(info_file)); bzero((char*) &cache_buf, sizeof(cache_buf)); pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST); @@ -2457,13 +2489,126 @@ point. If you are sure that your master is ok, run this query manually on the\ } } +/* + Check if condition stated in UNTIL clause of START SLAVE is reached. + SYNOPSYS + st_relay_log_info::is_until_satisfied() + DESCRIPTION + Checks if UNTIL condition is reached. Uses caching result of last + comparison of current log file name and target log file name. So cached + value should be invalidated if current log file name changes + (see st_relay_log_info::notify_... functions). + + This caching is needed to avoid of expensive string comparisons and + strtol() conversions needed for log names comparison. We don't need to + compare them each time this function is called, we only need to do this + when current log name changes. If we have UNTIL_MASTER_POS condition we + need to do this only after Rotate_log_event::exec_event() (which is + rare, so caching gives real benifit), and if we have UNTIL_RELAY_POS + condition then we should invalidate cached comarison value after + inc_group_relay_log_pos() which called for each group of events (so we + have some benefit if we have something like queries that use + autoincrement or if we have transactions). + + Should be called ONLY if until_condition != UNTIL_NONE ! + RETURN VALUE + true - condition met or error happened (condition seems to have + bad log file name) + false - condition not met +*/ + +bool st_relay_log_info::is_until_satisfied() +{ + const char *log_name; + ulonglong log_pos; + + DBUG_ASSERT(until_condition != UNTIL_NONE); + + if (until_condition == UNTIL_MASTER_POS) + { + log_name= group_master_log_name; + log_pos= group_master_log_pos; + } + else + { /* until_condition == UNTIL_RELAY_POS */ + log_name= group_relay_log_name; + log_pos= group_relay_log_pos; + } + + if (until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_UNKNOWN) + { + /* + We have no cached comaprison results so we should compare log names + and cache result + */ + + DBUG_ASSERT(*log_name || log_pos == 0); + + if (*log_name) + { + const char *basename= log_name + dirname_length(log_name); + + const char *q= (const char*)(fn_ext(basename)+1); + if (strncmp(basename, until_log_name, (int)(q-basename)) == 0) + { + /* Now compare extensions. */ + char *q_end; + ulong log_name_extension= strtoul(q, &q_end, 10); + if (log_name_extension < until_log_name_extension) + until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_LESS; + else + until_log_names_cmp_result= + (log_name_extension > until_log_name_extension) ? + UNTIL_LOG_NAMES_CMP_GREATER : UNTIL_LOG_NAMES_CMP_EQUAL ; + } + else + { + /* Probably error so we aborting */ + sql_print_error("Slave SQL thread is stopped because UNTIL " + "condition is bad."); + return true; + } + } + else + return until_log_pos == 0; + } + + return ((until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_EQUAL && + log_pos >= until_log_pos) || + until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_GREATER); +} + static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) { + /* + We acquire this mutex since we need it for all operations except + event execution. But we will release it in places where we will + wait for something for example inside of next_event(). + */ + pthread_mutex_lock(&rli->data_lock); + + if (rli->until_condition!=RELAY_LOG_INFO::UNTIL_NONE && + rli->is_until_satisfied()) + { + sql_print_error("Slave SQL thread stopped because it reached its" + " UNTIL position"); + /* + Setting abort_slave flag because we do not want additional message about + error in query execution to be printed. + */ + rli->abort_slave= 1; + pthread_mutex_unlock(&rli->data_lock); + return 1; + } + Log_event * ev = next_event(rli); + DBUG_ASSERT(rli->sql_thd==thd); + if (sql_slave_killed(thd,rli)) { + pthread_mutex_unlock(&rli->data_lock); delete ev; return 1; } @@ -2471,7 +2616,6 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) { int type_code = ev->get_type_code(); int exec_res; - pthread_mutex_lock(&rli->data_lock); /* Skip queries originating from this server or number of @@ -2500,7 +2644,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) pthread_mutex_unlock(&rli->data_lock); delete ev; return 0; // avoid infinite update loops - } + } pthread_mutex_unlock(&rli->data_lock); thd->server_id = ev->server_id; // use the original server id for logging @@ -2516,6 +2660,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) } else { + pthread_mutex_unlock(&rli->data_lock); slave_print_error(rli, 0, "\ Could not parse relay log event entry. The possible reasons are: the master's \ binary log is corrupted (you can check this by running 'mysqlbinlog' on the \ @@ -3593,17 +3738,18 @@ Log_event* next_event(RELAY_LOG_INFO* rli) pthread_mutex_t *log_lock = rli->relay_log.get_log_lock(); const char* errmsg=0; THD* thd = rli->sql_thd; + DBUG_ENTER("next_event"); DBUG_ASSERT(thd != 0); /* For most operations we need to protect rli members with data_lock, - so we will hold it for the most of the loop below - However, we will release it whenever it is worth the hassle, - and in the cases when we go into a pthread_cond_wait() with the - non-data_lock mutex + so we assume calling function acquired this mutex for us and we will + hold it for the most of the loop below However, we will release it + whenever it is worth the hassle, and in the cases when we go into a + pthread_cond_wait() with the non-data_lock mutex */ - pthread_mutex_lock(&rli->data_lock); + safe_mutex_assert_owner(&rli->data_lock); while (!sql_slave_killed(thd,rli)) { @@ -3662,7 +3808,6 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s", DBUG_ASSERT(thd==rli->sql_thd); if (hot_log) pthread_mutex_unlock(log_lock); - pthread_mutex_unlock(&rli->data_lock); DBUG_RETURN(ev); } DBUG_ASSERT(thd==rli->sql_thd); @@ -3838,7 +3983,6 @@ event(errno: %d cur_log->error: %d)", errmsg = "slave SQL thread was killed"; err: - pthread_mutex_unlock(&rli->data_lock); if (errmsg) sql_print_error("Error reading relay log event: %s", errmsg); DBUG_RETURN(0); diff --git a/sql/slave.h b/sql/slave.h index 7dc33ffcefe..b52648005d3 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -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, diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 2489bc8df68..8e2c024e7b3 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -663,7 +663,7 @@ err: 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 diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 4046aef892b..54d708fef04 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -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 {} |