• antirez's avatar
    PSYNC2: fix master cleanup when caching it. · 469d6e2b
    antirez authored
    The master client cleanup was incomplete: resetClient() was missing and
    the output buffer of the client was not reset, so pending commands
    related to the previous connection could be still sent.
    
    The first problem caused the client argument vector to be, at times,
    half populated, so that when the correct replication stream arrived the
    protcol got mixed to the arugments creating invalid commands that nobody
    called.
    
    Thanks to @yangsiran for also investigating this problem, after
    already providing important design / implementation hints for the
    original PSYNC2 issues (see referenced Github issue).
    
    Note that this commit adds a new function to the list library of Redis
    in order to be able to reset a list without destroying it.
    
    Related to issue #3899.
    469d6e2b
replication.c 107 KB