From ebd666db472982391ad8663ddc95e55ed730775b Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 14 Feb 2013 12:49:16 +0100 Subject: [PATCH] Cluster: from 4096 to 16384 hash slots. --- src/cluster.c | 6 +++--- src/redis.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index 6bc165559..60e99df04 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -299,10 +299,10 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) { * Key space handling * -------------------------------------------------------------------------- */ -/* We have 4096 hash slots. The hash slot of a given key is obtained - * as the least significant 12 bits of the crc16 of the key. */ +/* We have 16384 hash slots. The hash slot of a given key is obtained + * as the least significant 14 bits of the crc16 of the key. */ unsigned int keyHashSlot(char *key, int keylen) { - return crc16(key,keylen) & 0x0FFF; + return crc16(key,keylen) & 0x3FFF; } /* ----------------------------------------------------------------------------- diff --git a/src/redis.h b/src/redis.h index 093c70243..a97648e0f 100644 --- a/src/redis.h +++ b/src/redis.h @@ -514,7 +514,7 @@ typedef struct redisOpArray { * Redis cluster data structures *----------------------------------------------------------------------------*/ -#define REDIS_CLUSTER_SLOTS 4096 +#define REDIS_CLUSTER_SLOTS 16384 #define REDIS_CLUSTER_OK 0 /* Everything looks ok */ #define REDIS_CLUSTER_FAIL 1 /* The cluster can't work */ #define REDIS_CLUSTER_NEEDHELP 2 /* The cluster works, but needs some help */