The master should not feed ping and replconf to its backlog. #9401
1000happiness
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The master feeds all commands which will be sent to its slaves to its backlog.
But some commands in backlog like ping and replconf are useless when failover happens or slaves try to psync.
If the master doesn't feed these useless commands to backlog and just sent them to slaves, while slaves use their backlog offset(server.master_repl_offset) instead of master client offset as the psync_offset to reconnect with master, all commands
in backlog will be "data command".
The strategy helps Redis to save a little memory space or save more commands in backlog. More importantly, the backlog may be useful even if master disconnect with slaves for a long time.
In addition, the connection between slaves and sub-slave will not be influenced by master, so they can achieve independent connections.
master会把一些配置命令,比如ping命令和replconf命令写入backlog。但是在故障恢复或者增量同步的过程中这些命令实际上没有作用。
如果master只是单纯地传输这些命令而不写入backlog,同时slave使用自己的backlog offset(而不是现在的master客户端的offset)作为psync的offset,那么backlog中的所有命令都是“数据命令”。
这种策略能够节约一点内存。而且backlog的数据不会随时间淘汰,如果主从连接断开了很长时间,也有可能部分重同步。除此之外,slave和sub-slave之间的配置命令将不受到master的影响(现在的slave只能转发命令给sub-slave,不能改动也不能增加命令)。
Beta Was this translation helpful? Give feedback.
All reactions