summaryrefslogtreecommitdiff
path: root/sql/repl_failsafe.cc
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2009-12-18 02:54:54 +0000
committerLuis Soares <luis.soares@sun.com>2009-12-18 02:54:54 +0000
commit9db8801077b88d00de920788c343685b7a523c8d (patch)
treef5a1703b47079e380498d198eda240d2c4ffec40 /sql/repl_failsafe.cc
parente83c9f627377f05e093f092cee227da1b43d8e94 (diff)
downloadmariadb-git-9db8801077b88d00de920788c343685b7a523c8d.tar.gz
BUG#49259: Slave I/O thread could not register on master
The slave thread changed the format of the information it used to connect to the master after patch for BUG 13963. This resulted in old master getting confused, thence rejecting the slave connection attempt. In particular, patch for BUG 13963 removed the rpl_recovery_rank variable which was, at that time, packed together with the rest of the information which the slave would use to register itself on the master. Based on this data, the master would then assert that the number of bytes received in the connection command was consistent to what it was expecting. Therefore, given that a slave, patched with the aforementioned patch, would not pack the four bytes related to the rpl_recovery_rank variable, the old master would reject the connection attempt. It would assume that the data was inconsistent (fewer bytes than it was expecting) and return an error. We fix this by faking an rpl_recovery_rank variable when registering the slave on the master. In practice this reverts a small part of patch for BUG 13963, the one related to the slave connecting to the master. sql/repl_failsafe.cc: Added bypassing of removed rpl_recovery_rank variable information in packet. This should also make more sense when old servers connect to a new master (ie, master with patch for BUG 13963). If this was not done, the new master could interpert information an old slave sends as master_id, when in fact it could be the rpl_recovery_rank data. sql/slave.cc: Faking a rpl_recovery_rank so that we can register as a slave in an old master.
Diffstat (limited to 'sql/repl_failsafe.cc')
-rw-r--r--sql/repl_failsafe.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index cbc22406460..544063bf337 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -183,11 +183,18 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
get_object(p,si->host, "Failed to register slave: too long 'report-host'");
get_object(p,si->user, "Failed to register slave: too long 'report-user'");
get_object(p,si->password, "Failed to register slave; too long 'report-password'");
- /*6 is the total length of port and master_id*/
- if (p+6 != p_end)
+ if (p+10 > p_end)
goto err;
si->port= uint2korr(p);
p += 2;
+ /*
+ We need to by pass the bytes used in the fake rpl_recovery_rank
+ variable. It was removed in patch for BUG#13963. But this would
+ make a server with that patch unable to connect to an old master.
+ See: BUG#49259
+ */
+ // si->rpl_recovery_rank= uint4korr(p);
+ p += 4;
if (!(si->master_id= uint4korr(p)))
si->master_id= server_id;
si->thd= thd;