1. 17 Oct, 2014 2 commits
  2. 16 Oct, 2014 5 commits
  3. 15 Oct, 2014 1 commit
  4. 14 Oct, 2014 1 commit
  5. 10 Oct, 2014 1 commit
  6. 29 Sep, 2014 2 commits
  7. 26 Jun, 2014 1 commit
  8. 21 Jun, 2014 1 commit
  9. 07 Jun, 2014 2 commits
    • antirez's avatar
      ROLE output improved for slaves. · 6a13193d
      antirez authored
      Info about the replication state with the master added.
      6a13193d
    • antirez's avatar
      ROLE command added. · d34c2fa3
      antirez authored
      The new ROLE command is designed in order to provide a client with
      informations about the replication in a fast and easy to use way
      compared to the INFO command where the same information is also
      available.
      d34c2fa3
  10. 28 Apr, 2014 1 commit
    • antirez's avatar
      CLIENT LIST speedup via peerid caching + smart allocation. · 0bcc7cb4
      antirez authored
      This commit adds peer ID caching in the client structure plus an API
      change and the use of sdsMakeRoomFor() in order to improve the
      reallocation pattern to generate the CLIENT LIST output.
      
      Both the changes account for a very significant speedup.
      0bcc7cb4
  11. 05 Feb, 2014 1 commit
    • antirez's avatar
      Check for EAGAIN in sendBulkToSlave(). · 970de3e9
      antirez authored
      Sometime an osx master with a Linux server over a slow link caused
      a strange error where osx called the writable function for
      the socket but actually apparently there was no room in the socket
      buffer to accept the write: write(2) call returned an EAGAIN error,
      that was not checked, so we considered write(2) == 0 always as a connection
      reset, which was unfortunate since the bulk transfer has to start again.
      
      Also more errors are logged with the WARNING level in the same code path
      now.
      970de3e9
  12. 29 Jan, 2014 1 commit
    • antirez's avatar
      Cluster: function clusterGetSlaveRank() added. · 6f540320
      antirez authored
      Return the number of slaves for the same master having a better
      replication offset of the current slave, that is, the slave "rank" used
      to pick a delay before the request for election.
      6f540320
  13. 17 Jan, 2014 1 commit
  14. 08 Jan, 2014 2 commits
    • antirez's avatar
      Don't send REPLCONF ACK to old masters. · 90a81b4e
      antirez authored
      Masters not understanding REPLCONF ACK will reply with errors to our
      requests causing a number of possible issues.
      
      This commit detects a global replication offest set to -1 at the end of
      the replication, and marks the client representing the master with the
      REDIS_PRE_PSYNC flag.
      
      Note that this flag was called REDIS_PRE_PSYNC_SLAVE but now it is just
      REDIS_PRE_PSYNC as it is used for both slaves and masters starting with
      this commit.
      
      This commit fixes issue #1488.
      90a81b4e
    • antirez's avatar
      3f92e056
  15. 22 Dec, 2013 1 commit
    • antirez's avatar
      Make new masters inherit replication offsets. · 94e8c9e7
      antirez authored
      Currently replication offsets could be used into a limited way in order
      to understand, out of a set of slaves, what is the one with the most
      updated data. For example this comparison is possible of N slaves
      were replicating all with the same master.
      
      However the replication offset was not transferred from master to slaves
      (that are later promoted as masters) in any way, so for instance if
      there were three instances A, B, C, with A master and B and C
      replication from A, the following could happen:
      
      C disconnects from A.
      B is turned into master.
      A is switched to master of B.
      B receives some write.
      
      In this context there was no way to compare the offset of A and C,
      because B would use its own local master replication offset as
      replication offset to initialize the replication with A.
      
      With this commit what happens is that when B is turned into master it
      inherits the replication offset from A, making A and C comparable.
      In the above case assuming no inconsistencies are created during the
      disconnection and failover process, A will show to have a replication
      offset greater than C.
      
      Note that this does not mean offsets are always comparable to understand
      what is, in a set of instances, since in more complex examples the
      replica with the higher replication offset could be partitioned away
      when picking the instance to elect as new master. However this in
      general improves the ability of a system to try to pick a good replica
      to promote to master.
      94e8c9e7
  16. 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
  17. 05 Dec, 2013 1 commit
  18. 04 Dec, 2013 1 commit
  19. 11 Nov, 2013 1 commit
  20. 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
  21. 30 Sep, 2013 1 commit
  22. 03 Sep, 2013 1 commit
  23. 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
  24. 28 Jul, 2013 1 commit