Skip to content

Commit ebd666d

Browse files
committed
Cluster: from 4096 to 16384 hash slots.
1 parent 072c91f commit ebd666d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/cluster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
299299
* Key space handling
300300
* -------------------------------------------------------------------------- */
301301

302-
/* We have 4096 hash slots. The hash slot of a given key is obtained
303-
* as the least significant 12 bits of the crc16 of the key. */
302+
/* We have 16384 hash slots. The hash slot of a given key is obtained
303+
* as the least significant 14 bits of the crc16 of the key. */
304304
unsigned int keyHashSlot(char *key, int keylen) {
305-
return crc16(key,keylen) & 0x0FFF;
305+
return crc16(key,keylen) & 0x3FFF;
306306
}
307307

308308
/* -----------------------------------------------------------------------------

src/redis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ typedef struct redisOpArray {
514514
* Redis cluster data structures
515515
*----------------------------------------------------------------------------*/
516516

517-
#define REDIS_CLUSTER_SLOTS 4096
517+
#define REDIS_CLUSTER_SLOTS 16384
518518
#define REDIS_CLUSTER_OK 0 /* Everything looks ok */
519519
#define REDIS_CLUSTER_FAIL 1 /* The cluster can't work */
520520
#define REDIS_CLUSTER_NEEDHELP 2 /* The cluster works, but needs some help */

0 commit comments

Comments
 (0)