1. 29 Oct, 2014 1 commit
  2. 08 Oct, 2014 2 commits
    • antirez's avatar
      Cluster: process gossip section only for known nodes. · 5f6950ca
      antirez authored
      With the exception of nodes sending MEET packets: we have to trust them
      since they can send us MEET packets only when the cluster is initially
      created or because sysadmin manual action.
      5f6950ca
    • antirez's avatar
      Cluster: fix logic to detect we are among a minority. · 36e34a65
      antirez authored
      In the cluster evaluation function we are supposed to set the cluster
      state as "fail" if we are among a minority, however the code was not
      detecting to be into a minority partition if exactly half the masters
      were reachable, which is a minority.
      36e34a65
  3. 07 Oct, 2014 1 commit
  4. 29 Sep, 2014 1 commit
    • Matt Stancliff's avatar
      Clean up text throughout project · 12d0195b
      Matt Stancliff authored
        - Remove trailing newlines from redis.conf
        - Fix comment misspelling
        - Clarifies zipEncodeLength usage and a C API mention (#1243, #1242)
        - Fix cluster typos (inspired by @papanikge #1507)
        - Fix rewite -> rewrite in a few places (inspired by #682)
      
      Closes #1243, #1242, #1507
      12d0195b
  5. 17 Sep, 2014 2 commits
  6. 25 Aug, 2014 1 commit
    • Matt Stancliff's avatar
      Cluster: Fix segfault if cluster config corrupt · 60c448b5
      Matt Stancliff authored
      This commit adds a size check after initial config
      line parsing to make sure we have *at least* 8 arguments
      per line.
      
      Also, instead of asserting for cluster->myself, we just test
      and error out normally (since the error does a hard exit anyway).
      
      Closes #1597
      60c448b5
  7. 18 Aug, 2014 2 commits
  8. 13 Aug, 2014 1 commit
  9. 08 Aug, 2014 3 commits
  10. 25 Jul, 2014 1 commit
    • antirez's avatar
      Cluster: don't migrate to a master that never had slaves. · 0d9bcb1c
      antirez authored
      Replica migration algorithm modified so that slaves never try to migrate
      to masters that were never configured to have slaves in the past.
      We want the algorithm to take care of masters that remained without
      *working* slaves, but that used to have slaves according to the cluster
      configuration.
      0d9bcb1c
  11. 22 Jul, 2014 1 commit
    • antirez's avatar
      CLUSTER RESET: Flush dataset if node is a slave. · 89af4631
      antirez authored
      For non-empty masters, CLUSTER RESET is denied, and the user requires to
      start to reset a node by explicitly clearing it with FLUSHALL.
      However CLUSTER RESET when executed with slaves don't have this
      restrictions since data is just a replica of the master, and with
      read-only slaves it is also not possible to remove the data set. However
      the node was turned from slave to master after a reset, without touching
      the old slave data. This is 99.99% of times not appropriate and forces
      full resets to follow this path to work with both slave and master
      nodes:
      
          FLUSHALL
          CLUSTER RESET HARD
          FLUSHALL
      
      Since we need the first flushall for masters, and the second for slaves.
      
      This commit changes the behavior so that CLUSTER RESET removes the data set
      of a slave node during a reset, in the moment it gets turned into a master,
      so the new pattern is simply:
      
          FLUSHALL (that may fail for slaves)
          CLUSTER RESET
      89af4631
  12. 26 Jun, 2014 1 commit
  13. 25 Jun, 2014 4 commits
    • antirez's avatar
      CLUSTER SLOTS: don't output failing slaves. · 75c57d53
      antirez authored
      While we have to output failing masters in order to provide an accurate
      map (that may be the one of a Redis Cluster in down state because not
      all slots are served by a working master), to provide slaves in FAIL
      state is not a good idea since those are not necesarely needed, and the
      client will likely incur into a latency penalty trying to connect with a
      slave which is down.
      
      Note that this means that CLUSTER SLOTS does not provide a *complete*
      map of slaves, however this would not be of any help since slaves may be
      added later, and a client that needs to scale reads and requires to
      stay updated with the list of slaves, need to do a refresh of the map
      from time to time, anyway.
      75c57d53
    • antirez's avatar
    • Matt Stancliff's avatar
      Cluster: Add CLUSTER SLOTS command · e14829de
      Matt Stancliff authored
      CLUSTER SLOTS returns a Redis-formatted mapping from
      slot ranges to IP/Port pairs serving that slot range.
      
      The outer return elements group return values by slot ranges.
      
      The first two entires in each result are the min and max slots for the range.
      
      The third entry in each result is guaranteed to be either
      an IP/Port of the master for that slot range - OR - null
      if that slot range, for some reason, has no master
      
      The 4th and higher entries in each result are replica instances
      for the slot range.
      
      Output comparison:
      127.0.0.1:7001> cluster nodes
      f853501ec8ae1618df0e0f0e86fd7abcfca36207 127.0.0.1:7001 myself,master - 0 0 2 connected 4096-8191
      5a2caa782042187277647661ffc5da739b3e0805 127.0.0.1:7005 slave f853501ec8ae1618df0e0f0e86fd7abcfca36207 0 1402622415859 6 connected
      6c70b49813e2ffc9dd4b8ec1e108276566fcf59f 127.0.0.1:7007 slave 26f4729ca0a5a992822667fc16b5220b13368f32 0 1402622415357 8 connected
      2bd5a0e3bb7afb2b56a2120d3fef2f2e4333de1d 127.0.0.1:7006 slave 32adf4b8474fdc938189dba00dc8ed60ce635b0f 0 1402622419373 7 connected
      5a9450e8279df36ff8e6bb1c139ce4d5268d1390 127.0.0.1:7000 master - 0 1402622418872 1 connected 0-4095
      32adf4b8474fdc938189dba00dc8ed60ce635b0f 127.0.0.1:7002 master - 0 1402622419874 3 connected 8192-12287
      5db7d05c245267afdfe48c83e7de899348d2bdb6 127.0.0.1:7004 slave 5a9450e8279df36ff8e6bb1c139ce4d5268d1390 0 1402622417867 5 connected
      26f4729ca0a5a992822667fc16b5220b13368f32 127.0.0.1:7003 master - 0 1402622420877 4 connected 12288-16383
      
      127.0.0.1:7001> cluster slots
      1) 1) (integer) 0
         2) (integer) 4095
         3) 1) "127.0.0.1"
            2) (integer) 7000
         4) 1) "127.0.0.1"
            2) (integer) 7004
      2) 1) (integer) 12288
         2) (integer) 16383
         3) 1) "127.0.0.1"
            2) (integer) 7003
         4) 1) "127.0.0.1"
            2) (integer) 7007
      3) 1) (integer) 4096
         2) (integer) 8191
         3) 1) "127.0.0.1"
            2) (integer) 7001
         4) 1) "127.0.0.1"
            2) (integer) 7005
      4) 1) (integer) 8192
         2) (integer) 12287
         3) 1) "127.0.0.1"
            2) (integer) 7002
         4) 1) "127.0.0.1"
            2) (integer) 7006
      e14829de
    • antirez's avatar
      Cluster: myself->ip autodiscovery. · f29b12d0
      antirez authored
      Instead of having an hardcoded IP address in the node configuration, we
      autodiscover it via MEET messages for automatic update when the node is
      restarted with a different IP address.
      
      This mechanism was discussed in the context of PR #1782.
      f29b12d0
  14. 23 Jun, 2014 1 commit
  15. 20 Jun, 2014 1 commit
  16. 10 Jun, 2014 6 commits
  17. 07 Jun, 2014 2 commits
    • antirez's avatar
      Cluster: check that configEpoch never goes back. · 32d0a79f
      antirez authored
      Since there are ways to alter the configEpoch outside of the failover
      procedure (for exampel CLUSTER SET-CONFIG-EPOCH and via the configEpoch
      collision resolution algorithm), make always sure, before replacing our
      configEpoch with a new one, that it is greater than the current one.
      32d0a79f
    • antirez's avatar
      Cluster: SET-CONFIG-EPOCH should update currentEpoch. · a2c2ef7d
      antirez authored
      SET-CONFIG-EPOCH, used by redis-trib at cluster creation time, failed to
      update the currentEpoch, making it possible after a failover for a
      server to set its configEpoch to a value smaller than the current one
      (since configEpochs are obtained using currentEpoch).
      
      The bug totally break the Redis Cluster algorithms and protocols
      allowing for permanent split brain conditions about the slots
      configuration as shown in issue #1799.
      a2c2ef7d
  18. 26 May, 2014 1 commit
  19. 22 May, 2014 1 commit
  20. 15 May, 2014 5 commits
    • antirez's avatar
      Cluster: use clusterSetNodeAsMaster() during slave failover. · 67133d2f
      antirez authored
      clusterHandleSlaveFailover() was reimplementing what
      clusterSetNodeAsMaster() without any good reason.
      67133d2f
    • antirez's avatar
      Cluster: clear todo_before_sleep flags when executing actions. · 8c6e92c3
      antirez authored
      Thanks to this change, when there is some code like:
      
          clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|...);
          ... and later before returning to the event loop ...
          clusterUpdateState();
      
      The clusterUpdateState() function will clar the flag and will not be
      repeated in the clusterBeforeSleep() function. This especially important
      for config save/fsync flags which are slow to execute and not a good
      idea to repeat without a good reason.
      
      This is implemented for all the CLUSTER_TODO flags.
      8c6e92c3
    • antirez's avatar
      Fixed typo in CLUSTER RESET implementation. · 7b87cda7
      antirez authored
      7b87cda7
    • antirez's avatar
      CLUSTER RESET implemented. · 796f4ae9
      antirez authored
      The new command is able to reset a cluster node so that it starts again
      as a fresh node. By default the command performs a soft reset (the same
      as calling it as CLUSTER RESET SOFT), and the following steps are
      performed:
      
      1) All slots are set as unassigned.
      2) The list of known nodes is flushed.
      3) Node is set as master if it is a slave.
      
      When an hard reset is performed with CLUSTER RESET HARD the following
      additional operations are performed:
      
      4) A new Node ID is created at random.
      5) Epochs are set to 0.
      
      CLUSTER RESET is useful both when the sysadmin wants to reconfigure a
      node with a different role (for example turning a slave into a master)
      and for testing purposes.
      
      It also may play a role in automatically provisioned Redis Clusters,
      since it allows to reset a node back to the initial state in order to be
      reconfigured.
      796f4ae9
    • antirez's avatar
      Remove trailing spaces from cluster.c file. · 8b9d5ecb
      antirez authored
      8b9d5ecb
  21. 14 May, 2014 2 commits
    • antirez's avatar
      60e5d172
    • antirez's avatar
      Cluster: better handling of stolen slots. · 6baac558
      antirez authored
      The previous code handling a lost slot (by another master with an higher
      configuration for the slot) was defensive, considering it an error and
      putting the cluster in an odd state requiring redis-cli fix.
      
      This was changed, because actually this only happens either in a
      legitimate way, with failovers, or when the admin messed with the config
      in order to reconfigure the cluster. So the new code instead will try to
      make sure that the keys stored match the new slots map, by removing all
      the keys in the slots we lost ownership from.
      
      The function that deletes the keys from the lost slots is called only
      if the node does not lose all its slots (resulting in a reconfiguration
      as a slave of the node that got ownership). This is an optimization
      since the replication code will anyway flush all the instance data in
      a faster way.
      6baac558