• A
    PSYNC initial offset fix. · 292fec05
    antirez 提交于
    This commit attempts to fix a bug involving PSYNC and diskless
    replication (currently experimental) found by Yuval Inbar from Redis Labs
    and that was later found to have even more far reaching effects (the bug also
    exists when diskstore is off).
    
    The gist of the bug is that, a Redis master replies with +FULLRESYNC to
    a PSYNC attempt that fails and requires a full resynchronization.
    However, the baseline offset sent along with FULLRESYNC was always the
    current master replication offset. This is not ok, because there are
    many reasosn that may delay the RDB file creation. And... guess what,
    the master offset we communicate must be the one of the time the RDB
    was created. So for example:
    
    1) When the BGSAVE for replication is delayed since there is one
       already but is not good for replication.
    2) When the BGSAVE is not needed as we attach one currently ongoing.
    3) When because of diskless replication the BGSAVE is delayed.
    
    In all the above cases the PSYNC reply is wrong and the slave may
    reconnect later claiming to need a wrong offset: this may cause
    data curruption later.
    292fec05
server.h 68.6 KB