Commit 33ef6a30 authored by Josh Hershberg's avatar Josh Hershberg
Browse files

Cluster refactor: s/clusterNodeGetSlotBit/clusterNodeCoversSlot/



Simple rename, "GetSlotBit" is implementation specific
Signed-off-by: default avatarJosh Hershberg <yehoshua@redis.com>
parent ac151322
...@@ -56,7 +56,7 @@ void clusterUpdateMyselfHostname(void); ...@@ -56,7 +56,7 @@ void clusterUpdateMyselfHostname(void);
void clusterUpdateMyselfAnnouncedPorts(void); void clusterUpdateMyselfAnnouncedPorts(void);
sds clusterGenNodesDescription(client *c, int filter, int tls_primary); sds clusterGenNodesDescription(client *c, int filter, int tls_primary);
sds genClusterInfoString(void); sds genClusterInfoString(void);
int clusterNodeGetSlotBit(clusterNode *n, int slot); int clusterNodeCoversSlot(clusterNode *n, int slot);
void clusterUpdateMyselfHumanNodename(void); void clusterUpdateMyselfHumanNodename(void);
int isValidAuxString(char *s, unsigned int length); int isValidAuxString(char *s, unsigned int length);
int getNodeDefaultClientPort(clusterNode *n); int getNodeDefaultClientPort(clusterNode *n);
......
...@@ -55,7 +55,7 @@ void clusterSendPing(clusterLink *link, int type); ...@@ -55,7 +55,7 @@ void clusterSendPing(clusterLink *link, int type);
void clusterSendFail(char *nodename); void clusterSendFail(char *nodename);
void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request); void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request);
void clusterUpdateState(void); void clusterUpdateState(void);
int clusterNodeGetSlotBit(clusterNode *n, int slot); int clusterNodeCoversSlot(clusterNode *n, int slot);
list *clusterGetNodesInMyShard(clusterNode *node); list *clusterGetNodesInMyShard(clusterNode *node);
int clusterNodeAddSlave(clusterNode *master, clusterNode *slave); int clusterNodeAddSlave(clusterNode *master, clusterNode *slave);
int clusterAddSlot(clusterNode *n, int slot); int clusterAddSlot(clusterNode *n, int slot);
...@@ -4065,7 +4065,7 @@ void clusterFailoverReplaceYourMaster(void) { ...@@ -4065,7 +4065,7 @@ void clusterFailoverReplaceYourMaster(void) {
/* 2) Claim all the slots assigned to our master. */ /* 2) Claim all the slots assigned to our master. */
for (j = 0; j < CLUSTER_SLOTS; j++) { for (j = 0; j < CLUSTER_SLOTS; j++) {
if (clusterNodeGetSlotBit(oldmaster,j)) { if (clusterNodeCoversSlot(oldmaster, j)) {
clusterDelSlot(j); clusterDelSlot(j);
clusterAddSlot(myself,j); clusterAddSlot(myself,j);
} }
...@@ -4843,7 +4843,7 @@ int clusterNodeClearSlotBit(clusterNode *n, int slot) { ...@@ -4843,7 +4843,7 @@ int clusterNodeClearSlotBit(clusterNode *n, int slot) {
} }
/* Return the slot bit from the cluster node structure. */ /* Return the slot bit from the cluster node structure. */
int clusterNodeGetSlotBit(clusterNode *n, int slot) { int clusterNodeCoversSlot(clusterNode *n, int slot) {
return bitmapTestBit(n->slots,slot); return bitmapTestBit(n->slots,slot);
} }
...@@ -4882,7 +4882,7 @@ int clusterDelNodeSlots(clusterNode *node) { ...@@ -4882,7 +4882,7 @@ int clusterDelNodeSlots(clusterNode *node) {
int deleted = 0, j; int deleted = 0, j;
for (j = 0; j < CLUSTER_SLOTS; j++) { for (j = 0; j < CLUSTER_SLOTS; j++) {
if (clusterNodeGetSlotBit(node,j)) { if (clusterNodeCoversSlot(node, j)) {
clusterDelSlot(j); clusterDelSlot(j);
deleted++; deleted++;
} }
...@@ -5234,7 +5234,7 @@ sds clusterGenNodeDescription(client *c, clusterNode *node, int tls_primary) { ...@@ -5234,7 +5234,7 @@ sds clusterGenNodeDescription(client *c, clusterNode *node, int tls_primary) {
for (j = 0; j < CLUSTER_SLOTS; j++) { for (j = 0; j < CLUSTER_SLOTS; j++) {
int bit; int bit;
if ((bit = clusterNodeGetSlotBit(node,j)) != 0) { if ((bit = clusterNodeCoversSlot(node, j)) != 0) {
if (start == -1) start = j; if (start == -1) start = j;
} }
if (start != -1 && (!bit || j == CLUSTER_SLOTS-1)) { if (start != -1 && (!bit || j == CLUSTER_SLOTS-1)) {
......
...@@ -2197,7 +2197,7 @@ int dbExpand(const redisDb *db, uint64_t db_size, dbKeyType keyType, int try_exp ...@@ -2197,7 +2197,7 @@ int dbExpand(const redisDb *db, uint64_t db_size, dbKeyType keyType, int try_exp
dict *d; dict *d;
if (server.cluster_enabled) { if (server.cluster_enabled) {
for (int i = 0; i < CLUSTER_SLOTS; i++) { for (int i = 0; i < CLUSTER_SLOTS; i++) {
if (clusterNodeGetSlotBit(getMyClusterNode(), i)) { if (clusterNodeCoversSlot(getMyClusterNode(), i)) {
/* We don't know exact number of keys that would fall into each slot, but we can approximate it, assuming even distribution. */ /* We don't know exact number of keys that would fall into each slot, but we can approximate it, assuming even distribution. */
if (keyType == DB_MAIN) { if (keyType == DB_MAIN) {
d = db->dict[i]; d = db->dict[i];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment