Skip to content

Commit

Permalink
Rename cluster_update_route to redisClusterUpdateSlotmap
Browse files Browse the repository at this point in the history
  • Loading branch information
bjosv committed Aug 24, 2023
1 parent 53c51ca commit 26b1e77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
12 changes: 6 additions & 6 deletions hircluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ static int updateNodesAndSlotmap(redisClusterContext *cc, dict *nodes) {
return REDIS_ERR;
}

int cluster_update_route(redisClusterContext *cc) {
int redisClusterUpdateSlotmap(redisClusterContext *cc) {
int ret;
int flag_err_not_set = 1;
redisClusterNode *node;
Expand Down Expand Up @@ -1547,7 +1547,7 @@ static int _redisClusterConnect2(redisClusterContext *cc) {
return REDIS_ERR;
}

return cluster_update_route(cc);
return redisClusterUpdateSlotmap(cc);
}

/* Connect to a Redis cluster. On error the field error in the returned
Expand All @@ -1563,7 +1563,7 @@ static redisClusterContext *_redisClusterConnect(redisClusterContext *cc,
return cc;
}

cluster_update_route(cc);
redisClusterUpdateSlotmap(cc);

return cc;
}
Expand Down Expand Up @@ -2333,7 +2333,7 @@ static void *redis_cluster_command_execute(redisClusterContext *cc,
/* Deferred update route using the node that sent the
* redirect. */
c_updating_route = c;
} else if (cluster_update_route(cc) == REDIS_OK) {
} else if (redisClusterUpdateSlotmap(cc) == REDIS_OK) {
/* Synchronous update route successful using new connection. */
cc->err = 0;
cc->errstr[0] = '\0';
Expand Down Expand Up @@ -2412,7 +2412,7 @@ static void *redis_cluster_command_execute(redisClusterContext *cc,
/* Clear error and update synchronously using another node. */
cc->err = 0;
cc->errstr[0] = '\0';
if (cluster_update_route(cc) != REDIS_OK) {
if (redisClusterUpdateSlotmap(cc) != REDIS_OK) {
/* Clear the reply to indicate failure. */
freeReplyObject(reply);
reply = NULL;
Expand Down Expand Up @@ -3535,7 +3535,7 @@ void redisClusterReset(redisClusterContext *cc) {
}

if (cc->need_update_route) {
status = cluster_update_route(cc);
status = redisClusterUpdateSlotmap(cc);
if (status != REDIS_OK) {
/* Specific error already set */
return;
Expand Down
5 changes: 4 additions & 1 deletion hircluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ int redisClusterGetReply(redisClusterContext *cc, void **reply);
/* Reset context after a performed pipelining */
void redisClusterReset(redisClusterContext *cc);

/* Update the slotmap by querying any node. */
int redisClusterUpdateSlotmap(redisClusterContext *cc);

/* Internal functions */
int cluster_update_route(redisClusterContext *cc);
redisContext *ctx_get_by_node(redisClusterContext *cc, redisClusterNode *node);
struct dict *parse_cluster_nodes(redisClusterContext *cc, char *str,
int str_len, int flags);
Expand Down Expand Up @@ -337,6 +339,7 @@ redisClusterNode *redisClusterGetNodeByKey(redisClusterContext *cc, char *key);

/* Old names of renamed functions and types, kept for backward compatibility. */
#ifndef HIRCLUSTER_NO_OLD_NAMES
#define cluster_update_route redisClusterUpdateSlotmap
#define initNodeIterator redisClusterInitNodeIterator
#define nodeNext redisClusterNodeNext
#define redisClusterConnectNonBlock redisClusterConnect
Expand Down
2 changes: 1 addition & 1 deletion hiredis_cluster.def
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
EXPORTS
actx_get_by_node
cluster_update_route
command_destroy
command_get
ctx_get_by_node
Expand Down Expand Up @@ -55,6 +54,7 @@
redisClusterSetOptionTimeout
redisClusterSetOptionUsername
redisClusterSetOptionPassword
redisClusterUpdateSlotmap
redisClustervAppendCommand
redisClustervAsyncCommand
redisClustervCommand
Expand Down

0 comments on commit 26b1e77

Please sign in to comment.