1. 10 Dec, 2013 3 commits
    • antirez's avatar
      Slaves heartbeats during sync improved. · 11120689
      antirez authored
      The previous fix for false positive timeout detected by master was not
      complete. There is another blocking stage while loading data for the
      first synchronization with the master, that is, flushing away the
      current data from the DB memory.
      
      This commit uses the newly introduced dict.c callback in order to make
      some incremental work (to send "\n" heartbeats to the master) while
      flushing the old data from memory.
      
      It is hard to write a regression test for this issue unfortunately. More
      support for debugging in the Redis core would be needed in terms of
      functionalities to simulate a slow DB loading / deletion.
      11120689
    • antirez's avatar
      dict.c: added optional callback to dictEmpty(). · 2eb781b3
      antirez authored
      Redis hash table implementation has many non-blocking features like
      incremental rehashing, however while deleting a large hash table there
      was no way to have a callback called to do some incremental work.
      
      This commit adds this support, as an optiona callback argument to
      dictEmpty() that is currently called at a fixed interval (one time every
      65k deletions).
      2eb781b3
    • antirez's avatar
      2c4ab8a5
  2. 05 Dec, 2013 1 commit
  3. 04 Dec, 2013 1 commit
  4. 11 Nov, 2013 1 commit
  5. 04 Oct, 2013 4 commits
    • antirez's avatar
      Replication: install the write handler when reusing a cached master. · 0150c70b
      antirez authored
      Sometimes when we resurrect a cached master after a successful partial
      resynchronization attempt, there is pending data in the output buffers
      of the client structure representing the master (likely REPLCONF ACK
      commands).
      
      If we don't reinstall the write handler, it will never be installed
      again by addReply*() family functions as they'll assume that if there is
      already data pending, the write handler is already installed.
      
      This bug caused some slaves after a successful partial sync to never
      send REPLCONF ACK, and continuously being detected as timing out by the
      master, with a disconnection / reconnection loop.
      0150c70b
    • antirez's avatar
      Replication: install the write handler when reusing a cached master. · 1461422c
      antirez authored
      Sometimes when we resurrect a cached master after a successful partial
      resynchronization attempt, there is pending data in the output buffers
      of the client structure representing the master (likely REPLCONF ACK
      commands).
      
      If we don't reinstall the write handler, it will never be installed
      again by addReply*() family functions as they'll assume that if there is
      already data pending, the write handler is already installed.
      
      This bug caused some slaves after a successful partial sync to never
      send REPLCONF ACK, and continuously being detected as timing out by the
      master, with a disconnection / reconnection loop.
      1461422c
    • antirez's avatar
      PSYNC: safer handling of PSYNC requests. · d62ae1ec
      antirez authored
      There was a bug that over-esteemed the amount of backlog available,
      however this could only happen when a slave was asking for an offset
      that was in the "future" compared to the master replication backlog.
      
      Now this case is handled well and logged as an incident in the master
      log file.
      d62ae1ec
    • antirez's avatar
      PSYNC: safer handling of PSYNC requests. · 37e06bd9
      antirez authored
      There was a bug that over-esteemed the amount of backlog available,
      however this could only happen when a slave was asking for an offset
      that was in the "future" compared to the master replication backlog.
      
      Now this case is handled well and logged as an incident in the master
      log file.
      37e06bd9
  6. 30 Sep, 2013 1 commit
  7. 03 Sep, 2013 1 commit
  8. 12 Aug, 2013 4 commits
    • antirez's avatar
    • antirez's avatar
      replicationFeedSlave() reworked for correctness and speed. · dcc48a81
      antirez authored
      The previous code using a static buffer as an optimization was lame:
      
      1) Premature optimization, actually it was *slower* than naive code
         because resulted into the creation / destruction of the object
         encapsulating the output buffer.
      2) The code was very hard to test, since it was needed to have specific
         tests for command lines exceeding the size of the static buffer.
      3) As a result of "2" the code was bugged as the current tests were not
         able to stress specific corner cases.
      
      It was replaced with easy to understand code that is safer and faster.
      dcc48a81
    • antirez's avatar
      Fix a PSYNC bug caused by a variable name typo. · aa05128f
      antirez authored
      aa05128f
    • antirez's avatar
      Replication: better way to send a preamble before RDB payload. · 89ffba91
      antirez authored
      During the replication full resynchronization process, the RDB file is
      transfered from the master to the slave. However there is a short
      preamble to send, that is currently just the bulk payload length of the
      file in the usual Redis form $..length..<CR><LF>.
      
      This preamble used to be sent with a direct write call, assuming that
      there was alway room in the socket output buffer to hold the few bytes
      needed, however this does not scale in case we'll need to send more
      stuff, and is not very robust code in general.
      
      This commit introduces a more general mechanism to send a preamble up to
      2GB in size (the max length of an sds string) in a non blocking way.
      89ffba91
  9. 28 Jul, 2013 1 commit
  10. 22 Jul, 2013 1 commit
  11. 12 Jul, 2013 1 commit
  12. 09 Jul, 2013 1 commit
  13. 08 Jul, 2013 2 commits
  14. 26 Jun, 2013 1 commit
    • antirez's avatar
      Don't disconnect pre PSYNC replication clients for timeout. · 8ca265cd
      antirez authored
      Clients using SYNC to replicate are older implementations, such as
      redis-cli --slave, and are not designed to acknowledge the master with
      REPLCONF ACK commands, so we don't have any feedback and should not
      disconnect them on timeout.
      8ca265cd
  15. 24 Jun, 2013 2 commits
    • antirez's avatar
      Use the RSC to replicate EVALSHA unmodified. · f0bf5fd8
      antirez authored
      This commit uses the Replication Script Cache in order to avoid
      translating EVALSHA into EVAL whenever possible for both the AOF and
      slaves.
      f0bf5fd8
    • antirez's avatar
      Replication of scripts as EVALSHA: sha1 caching implemented. · 94ec7db4
      antirez authored
      This code is only responsible to take an LRU-evicted fixed length cache
      of SHA1 that we are sure all the slaves received.
      
      In this commit only the implementation is provided, but the Redis core
      does not use it to actually send EVALSHA to slaves when possible.
      94ec7db4
  16. 30 May, 2013 2 commits
  17. 27 May, 2013 5 commits
    • antirez's avatar
      Close connection with timedout slaves. · 3c82c85f
      antirez authored
      Now masters, using the time at which the last REPLCONF ACK was received,
      are able to explicitly disconnect slaves that are no longer responding.
      
      Previously the only chance was to see a very long output buffer, that
      was highly suboptimal.
      3c82c85f
    • antirez's avatar
      Send ACK to master once every second. · e06a5604
      antirez authored
      ACKs can be also used as a base for synchronous replication. However in
      that case they'll be explicitly requested by the master when the client
      sends a request that needs to be replicated synchronously.
      e06a5604
    • antirez's avatar
      Don't ACK the master after every command. · efd87031
      antirez authored
      Sending an ACK is now moved into the replicationSendAck() function.
      efd87031
    • antirez's avatar
      dd0adbb7
    • antirez's avatar
      REPLCONF ACK command. · 6b4635f4
      antirez authored
      This special command is used by the slave to inform the master the
      amount of replication stream it currently consumed.
      
      it does not return anything so that we not need to consume additional
      bandwidth needed by the master to reply something.
      
      The master can do a number of things knowing the amount of stream
      processed, such as understanding the "lag" in bytes of the slave, verify
      if a given command was already processed by the slave, and so forth.
      6b4635f4
  18. 05 Mar, 2013 1 commit
  19. 04 Mar, 2013 2 commits
  20. 27 Feb, 2013 1 commit
  21. 13 Feb, 2013 2 commits
  22. 12 Feb, 2013 2 commits