summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-06-10 23:29:49 +0200
committerunknown <guilhem@mysql.com>2003-06-10 23:29:49 +0200
commit9f782d1eccc2c2b394b03f9b04f789b8804438b8 (patch)
treefb4220000a5221b9fe835c16793ea056ca5466eb /sql/sql_repl.cc
parentf933dddf27c4c85df878342b0f6c28176f4e2889 (diff)
downloadmariadb-git-9f782d1eccc2c2b394b03f9b04f789b8804438b8.tar.gz
More error messages. This is intended to help debugging; presently I have a
support issue with an unclear message which can have N reasons for appearing. This should help us know at which point it failed, and get the errno when my_open was involved (as the reason for the unclear message is often a permission problem). RESET SLAVE resets last_error and last_errno in SHOW SLAVE STATUS (without this, rpl_loaddata.test, which is expected to generate an error in last_error, influenced rpl_log_pos.test). A small test update. Added STOP SLAVE to mysql-test-run to get rid of several stupid error messages which are printed while the master restarts and the slave attempts/manages to connect to it and sends it nonsense binlog requests. mysql-test/mysql-test-run.sh: Before running a test, stop slave threads if they exist (if they don't the script goes on fine). This also works fine with the manager. Before this change, when the master was stopped/restarted (which happened before the slave server was stopped/restarted), the slave threads noticed the stop (so printed an error message in slave.err), then managed to reconnect (to the new master, the one that is running for the _next_ test), and this reconnection had time to produce error messages (because, for example, the binlog the slave thread was asking had been deleted) before the slave server was killed. This change reduces by 10% (40 lines) slave.err in replication tests. mysql-test/r/rpl000018.result: Result update. mysql-test/t/rpl000018.test: This test does "show master logs" so should do "reset master" instead of relying on the previous tests. sql/slave.cc: More error messages. sql/sql_repl.cc: More error messages. RESET SLAVE resets last_error and last_errno in SHOW SLAVE STATUS.
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index ca993c053a1..a651d8002fd 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -159,10 +159,18 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
File file;
DBUG_ENTER("open_binlog");
- if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0 ||
- init_io_cache(log, file, IO_SIZE*2, READ_CACHE, 0, 0,
+ if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0)
+ {
+ sql_print_error("Failed to open log (\
+file '%s', errno %d)", log_file_name, my_errno);
+ *errmsg = "Could not open log file"; // This will not be sent
+ goto err;
+ }
+ if (init_io_cache(log, file, IO_SIZE*2, READ_CACHE, 0, 0,
MYF(MY_WME | MY_DONT_CHECK_FILESIZE)))
{
+ sql_print_error("Failed to create a cache on log (\
+file '%s')", log_file_name);
*errmsg = "Could not open log file"; // This will not be sent
goto err;
}
@@ -743,6 +751,9 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
//Clear master's log coordinates (only for good display of SHOW SLAVE STATUS)
mi->master_log_name[0]= 0;
mi->master_log_pos= BIN_LOG_HEADER_SIZE;
+ //Clear the errors displayed by SHOW SLAVE STATUS
+ mi->rli.last_slave_error[0]=0;
+ mi->rli.last_slave_errno=0;
//close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
end_master_info(mi);
//and delete these two files