PSYNC2: stop sending newlines to sub-slaves when master is down.

This actually includes two changes:

1) No newlines to take the master-slave link up when the upstream master
is down. Doing this is dangerous because the sub-slave often is received
replication protocol for an half-command, so can't receive newlines
without desyncing the replication link, even with the code in order to
cancel out the bytes that PSYNC2 was using. Moreover this is probably
also not needed/sane, because anyway the slave can keep serving
requests, and because if it's configured to don't serve stale data, it's
a good idea, actually, to break the link.

2) When a +CONTINUE with a different ID is received, we now break
connection with the sub-slaves: they need to be notified as well. This
was part of the original specification but for some reason it was not
implemented in the code, and was alter found as a PSYNC2 bug in the
integration testing.
This commit is contained in:
antirez
2016-11-28 17:54:04 +01:00
parent 16559a02fc
commit eab865a0a1
3 changed files with 6 additions and 30 deletions

View File

@ -87,6 +87,7 @@ start_server {} {
set slave_id [randomInt 5]
if {$disconnect} {
$R($slave_id) client kill type master
puts "+++ Breaking link for slave #$slave_id"
}
}
}