summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-09 02:03:35 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-09 02:03:35 +0400
commit5ef2bdea81a68a5440235bb5c841fff5dcc2b2c7 (patch)
treefaf6e2793eae5ff3a0ec48cebf47e8045db0a6ff /sql/sql_repl.cc
parente94c1ab135e035dea4c2db9508d2d635b70bcf80 (diff)
parent721ec081901b661b9338a47b3144c6c41829165a (diff)
downloadmariadb-git-5ef2bdea81a68a5440235bb5c841fff5dcc2b2c7.tar.gz
Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts: Text conflict in mysql-test/r/grant.result Text conflict in mysql-test/t/grant.test Text conflict in mysys/mf_loadpath.c Text conflict in sql/slave.cc Text conflict in sql/sql_priv.h
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 1ee770f70ef..787f9dcae2c 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1347,6 +1347,10 @@ bool change_master(THD* thd, Master_info* mi)
const char* errmsg= 0;
bool need_relay_log_purge= 1;
bool ret= FALSE;
+ char saved_host[HOSTNAME_LENGTH + 1];
+ uint saved_port;
+ char saved_log_name[FN_REFLEN];
+ my_off_t saved_log_pos;
DBUG_ENTER("change_master");
lock_slave_threads(mi);
@@ -1389,6 +1393,17 @@ bool change_master(THD* thd, Master_info* mi)
*/
/*
+ Before processing the command, save the previous state.
+ */
+ char *pos;
+ pos= strmake(saved_host, mi->host, HOSTNAME_LENGTH);
+ pos= '\0';
+ saved_port= mi->port;
+ pos= strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
+ pos= '\0';
+ saved_log_pos= mi->master_log_pos;
+
+ /*
If the user specified host or port without binlog or position,
reset binlog's name to FIRST and position to 4.
*/
@@ -1586,6 +1601,15 @@ bool change_master(THD* thd, Master_info* mi)
/* Clear the errors, for a clean start */
mi->rli.clear_error();
mi->rli.clear_until_condition();
+
+ sql_print_information("'CHANGE MASTER TO executed'. "
+ "Previous state master_host='%s', master_port='%u', master_log_file='%s', "
+ "master_log_pos='%ld'. "
+ "New state master_host='%s', master_port='%u', master_log_file='%s', "
+ "master_log_pos='%ld'.", saved_host, saved_port, saved_log_name,
+ (ulong) saved_log_pos, mi->host, mi->port, mi->master_log_name,
+ (ulong) mi->master_log_pos);
+
/*
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