Cluster refactor: s/clusterNodeGetSlotBit/clusterNodeCoversSlot/

Simple rename, "GetSlotBit" is implementation specific

Signed-off-by: Josh Hershberg <yehoshua@redis.com>
This commit is contained in:
Josh Hershberg 2023-11-01 12:37:00 +02:00
parent ac1513221b
commit 33ef6a3003
3 changed files with 7 additions and 7 deletions

View File

@ -56,7 +56,7 @@ void clusterUpdateMyselfHostname(void);
void clusterUpdateMyselfAnnouncedPorts(void);
sds clusterGenNodesDescription(client *c, int filter, int tls_primary);
sds genClusterInfoString(void);
int clusterNodeGetSlotBit(clusterNode *n, int slot);
int clusterNodeCoversSlot(clusterNode *n, int slot);
void clusterUpdateMyselfHumanNodename(void);
int isValidAuxString(char *s, unsigned int length);
int getNodeDefaultClientPort(clusterNode *n);

View File

@ -55,7 +55,7 @@ void clusterSendPing(clusterLink *link, int type);
void clusterSendFail(char *nodename);
void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request);
void clusterUpdateState(void);
int clusterNodeGetSlotBit(clusterNode *n, int slot);
int clusterNodeCoversSlot(clusterNode *n, int slot);
list *clusterGetNodesInMyShard(clusterNode *node);
int clusterNodeAddSlave(clusterNode *master, clusterNode *slave);
int clusterAddSlot(clusterNode *n, int slot);
@ -4065,7 +4065,7 @@ void clusterFailoverReplaceYourMaster(void) {
/* 2) Claim all the slots assigned to our master. */
for (j = 0; j < CLUSTER_SLOTS; j++) {
if (clusterNodeGetSlotBit(oldmaster,j)) {
if (clusterNodeCoversSlot(oldmaster, j)) {
clusterDelSlot(j);
clusterAddSlot(myself,j);
}
@ -4843,7 +4843,7 @@ int clusterNodeClearSlotBit(clusterNode *n, int slot) {
}
/* 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);
}
@ -4882,7 +4882,7 @@ int clusterDelNodeSlots(clusterNode *node) {
int deleted = 0, j;
for (j = 0; j < CLUSTER_SLOTS; j++) {
if (clusterNodeGetSlotBit(node,j)) {
if (clusterNodeCoversSlot(node, j)) {
clusterDelSlot(j);
deleted++;
}
@ -5234,7 +5234,7 @@ sds clusterGenNodeDescription(client *c, clusterNode *node, int tls_primary) {
for (j = 0; j < CLUSTER_SLOTS; j++) {
int bit;
if ((bit = clusterNodeGetSlotBit(node,j)) != 0) {
if ((bit = clusterNodeCoversSlot(node, j)) != 0) {
if (start == -1) start = j;
}
if (start != -1 && (!bit || j == CLUSTER_SLOTS-1)) {

View File

@ -2197,7 +2197,7 @@ int dbExpand(const redisDb *db, uint64_t db_size, dbKeyType keyType, int try_exp
dict *d;
if (server.cluster_enabled) {
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. */
if (keyType == DB_MAIN) {
d = db->dict[i];