1. 04 May, 2015 1 commit
    • antirez's avatar
      Sentinel: remove useless sentinelFlushConfig() call · 99c93f34
      antirez authored
      To rewrite the config in the loop that adds slaves back after a master
      reset, in order to handle switching to another master, is useless: it
      just adds latency since there is an fsync call in the inner loop,
      without providing any additional guarantee, but the contrary, since if
      after the first loop iteration the server crashes we end with just a
      single slave entry losing all the other informations.
      
      It is wiser to rewrite the config at the end when the full new
      state is configured.
      99c93f34
  2. 29 Apr, 2015 1 commit
  3. 28 Apr, 2015 1 commit
  4. 27 Apr, 2015 1 commit
  5. 26 Apr, 2015 1 commit
  6. 01 Apr, 2015 1 commit
    • antirez's avatar
      Net: improve prepareClientToWrite() error handling and comments. · 6c60526d
      antirez authored
      When we fail to setup the write handler it does not make sense to take
      the client around, it is missing writes: whatever is a client or a slave
      anyway the connection should terminated ASAP.
      
      Moreover what the function does exactly with its return value, and in
      which case the write handler is installed on the socket, was not clear,
      so the functions comment are improved to make the goals of the function
      more obvious.
      
      Also related to #2485.
      6c60526d
  7. 31 Mar, 2015 2 commits
    • Oran Agra's avatar
      fixes to diskless replication. · 159875b5
      Oran Agra authored
      master was closing the connection if the RDB transfer took long time.
      and also sent PINGs to the slave before it got the initial ACK, in which case the slave wouldn't be able to find the EOF marker.
      159875b5
    • antirez's avatar
      Fix setTypeNext call assuming NULL can be passed. · 66f9393e
      antirez authored
      Segfault introduced during a refactoring / warning suppression a few
      commits away. This particular call assumed that it is safe to pass NULL
      to the object pointer argument when we are sure the set has a given
      encoding. This can't be assumed and is now guaranteed to segfault
      because of the new API of setTypeNext().
      66f9393e
  8. 30 Mar, 2015 3 commits
  9. 27 Mar, 2015 2 commits
  10. 24 Mar, 2015 2 commits
    • antirez's avatar
      Replication: disconnect blocked clients when switching to slave role. · c3ad7090
      antirez authored
      Bug as old as Redis and blocking operations. It's hard to trigger since
      only happens on instance role switch, but the results are quite bad
      since an inconsistency between master and slave is created.
      
      How to trigger the bug is a good description of the bug itself.
      
      1. Client does "BLPOP mylist 0" in master.
      2. Master is turned into slave, that replicates from New-Master.
      3. Client does "LPUSH mylist foo" in New-Master.
      4. New-Master propagates write to slave.
      5. Slave receives the LPUSH, the blocked client get served.
      
      Now Master "mylist" key has "foo", Slave "mylist" key is empty.
      
      Highlights:
      
      * At step "2" above, the client remains attached, basically escaping any
        check performed during command dispatch: read only slave, in that case.
      * At step "5" the slave (that was the master), serves the blocked client
        consuming a list element, which is not consumed on the master side.
      
      This scenario is technically likely to happen during failovers, however
      since Redis Sentinel already disconnects clients using the CLIENT
      command when changing the role of the instance, the bug is avoided in
      Sentinel deployments.
      
      Closes #2473.
      c3ad7090
    • antirez's avatar
      Cluster: redirection refactoring + handling of blocked clients. · 9b7f8b1c
      antirez authored
      There was a bug in Redis Cluster caused by clients blocked in a blocking
      list pop operation, for keys no longer handled by the instance, or
      in a condition where the cluster became down after the client blocked.
      
      A typical situation is:
      
      1) BLPOP <somekey> 0
      2) <somekey> hash slot is resharded to another master.
      
      The client will block forever int this case.
      
      A symmentrical non-cluster-specific bug happens when an instance is
      turned from master to slave. In that case it is more serious since this
      will desynchronize data between slaves and masters. This other bug was
      discovered as a side effect of thinking about the bug explained and
      fixed in this commit, but will be fixed in a separated commit.
      9b7f8b1c
  11. 22 Mar, 2015 1 commit
  12. 21 Mar, 2015 5 commits
  13. 20 Mar, 2015 5 commits
    • antirez's avatar
    • antirez's avatar
      Cluster: separate unknown master check from the rest. · 230d1414
      antirez authored
      In no case we should try to attempt to failover if myself->slaveof is
      NULL.
      230d1414
    • antirez's avatar
      Cluster: refactoring around configEpoch handling. · 4f2555aa
      antirez authored
      This commit moves the process of generating a new config epoch without
      consensus out of the clusterCommand() implementation, in order to make
      it reusable for other reasons (current target is to have a CLUSTER
      FAILOVER option forcing the failover when no master majority is
      reachable).
      
      Moreover the commit moves other functions which are similarly related to
      config epochs in a new logical section of the cluster.c file, just for
      clarity.
      4f2555aa
    • antirez's avatar
      Cluster: better cluster state transiction handling. · 25c0f5ac
      antirez authored
      Before we relied on the global cluster state to make sure all the hash
      slots are linked to some node, when getNodeByQuery() is called. So
      finding the hash slot unbound was checked with an assertion. However
      this is fragile. The cluster state is often updated in the
      clusterBeforeSleep() function, and not ASAP on state change, so it may
      happen to process clients with a cluster state that is 'ok' but yet
      certain hash slots set to NULL.
      
      With this commit the condition is also checked in getNodeByQuery() and
      reported with a identical error code of -CLUSTERDOWN but slightly
      different error message so that we have more debugging clue in the
      future.
      
      Root cause of issue #2288.
      25c0f5ac
    • antirez's avatar
      Cluster: move clusterBeforeSleep() call before unblocked clients processing. · 2ecb5edf
      antirez authored
      Related to issue #2288.
      2ecb5edf
  14. 18 Mar, 2015 1 commit
  15. 13 Mar, 2015 2 commits
  16. 12 Mar, 2015 2 commits
  17. 11 Mar, 2015 4 commits
  18. 10 Mar, 2015 3 commits
  19. 08 Mar, 2015 1 commit
  20. 04 Mar, 2015 1 commit
    • antirez's avatar
      Fix iterator for issue #2438. · 509a6cc1
      antirez authored
      Itereator misuse due to analyzeLatencyForEvent() accessing the
      dictionary during the iteration, without the iterator being
      reclared as safe.
      509a6cc1