• zhaozhao.zz's avatar
    Free backlog only if rsi is invalid when master reboot (#12088) · 88682ca3
    zhaozhao.zz authored
    When master reboot from RDB, if rsi in RDB is valid we should not free replication backlog, even if master_repl_offset or repl-offset is 0.
    
    Since if master doesn't send any data to replicas master_repl_offset is 0, it's a valid number.
    
    A clear example:
    
    1. start a master and apply some write commands, the master's master_repl_offset is 0 since it has no replicas.
    2. stop write commands on master, and start another instance and replicaof the master, trigger an FULLRESYNC
    3. the master's master_repl_offset is still 0 (set a large number for repl-ping-replica-period), do BGSAVE and restart the master
    4. master load master_repl_offset from RDB's rsi and it's still 0, and we should make sure replica can partially resync with master.
    
    (cherry picked from commit b0dd7b32)
    88682ca3
psync2-master-restart.tcl 8.35 KB