summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-04-07 01:14:11 +0200
committerunknown <guilhem@mysql.com>2004-04-07 01:14:11 +0200
commit1f50a0345c78ff969ddabf52322d3feeb163ec67 (patch)
tree523f5ec0957debf067041771f817f8f48a98b8e8
parentaacdf1ee142212499d5492f9a6280f7b3bc83502 (diff)
downloadmariadb-git-1f50a0345c78ff969ddabf52322d3feeb163ec67.tar.gz
Fix for BUG#3401 "Rare replication bug which leads to "Binlog has bad magic number" from slave":
Backport of a part of this changeset of 4.1: ChangeSet@1.1753.1.1, 2004-04-05 13:56:05+03:00, monty@mysql.com which fixes the bug. sql/slave.cc: even if mi is already inited (replication already run once before), we need to seek back to the beginning of the relay log to be able to later check the binlog's magic number.
-rw-r--r--sql/slave.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index 9e82a521cb3..1ef572e3a0a 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1609,7 +1609,18 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
DBUG_ENTER("init_master_info");
if (mi->inited)
+ {
+ /*
+ We have to reset read position of relay-log-bin as we may have
+ already been reading from 'hotlog' when the slave was stopped
+ last time. If this case pos_in_file would be set and we would
+ get a crash when trying to read the signature for the binary
+ relay log.
+ */
+ my_b_seek(mi->rli.cur_log, (my_off_t) 0);
DBUG_RETURN(0);
+ }
+
mi->mysql=0;
mi->file_id=1;
mi->ignore_stop_event=0;