• zhaozhao.zz's avatar
    PSYNC2: make partial sync possible after master reboot (#8015) · 794442b1
    zhaozhao.zz authored
    The main idea is how to allow a master to load replication info from RDB file when rebooting, if master can load replication info it means that replicas may have the chance to psync with master, it can save much traffic.
    
    The key point is we need guarantee safety and consistency, so there
    are two differences between master and replica:
    
    1. master would load the replication info as secondary ID and
       offset, in case other masters have the same replid.
    2. when master loading RDB, it would propagate expired keys as DEL
       command to replication backlog, then replica can receive these
       commands to delete stale keys.
       p.s. the expired keys when RDB loading is useful for users, so
       we show it as `rdb_last_load_keys_expired` and `rdb_last_load_keys_loaded` in info persistence.
    
    Moreover, after load replication info, master should update
    `no_replica_time` in case loading RDB cost too long time.
    794442b1
server.c 241 KB