mirror of
https://github.com/fluencelabs/redis
synced 2025-05-01 05:22:13 +00:00
PSYNC: safer handling of PSYNC requests.
There was a bug that over-esteemed the amount of backlog available, however this could only happen when a slave was asking for an offset that was in the "future" compared to the master replication backlog. Now this case is handled well and logged as an incident in the master log file.
This commit is contained in:
parent
81f614ef6f
commit
c8c1006cf4
@ -356,10 +356,14 @@ int masterTryPartialResynchronization(redisClient *c) {
|
|||||||
REDIS_OK) goto need_full_resync;
|
REDIS_OK) goto need_full_resync;
|
||||||
if (!server.repl_backlog ||
|
if (!server.repl_backlog ||
|
||||||
psync_offset < server.repl_backlog_off ||
|
psync_offset < server.repl_backlog_off ||
|
||||||
psync_offset >= (server.repl_backlog_off + server.repl_backlog_size))
|
psync_offset > (server.repl_backlog_off + server.repl_backlog_histlen))
|
||||||
{
|
{
|
||||||
redisLog(REDIS_NOTICE,
|
redisLog(REDIS_NOTICE,
|
||||||
"Unable to partial resync with the slave for lack of backlog (Slave request was: %lld).", psync_offset);
|
"Unable to partial resync with the slave for lack of backlog (Slave request was: %lld).", psync_offset);
|
||||||
|
if (psync_offset > server.master_repl_offset) {
|
||||||
|
redisLog(REDIS_WARNING,
|
||||||
|
"Warning: slave tried to PSYNC with an offset that is greater than the master replication offset.");
|
||||||
|
}
|
||||||
goto need_full_resync;
|
goto need_full_resync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user