Skip to content

Commit

Permalink
Address some feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Roshan Khatri <[email protected]>
  • Loading branch information
roshkhatri committed Jul 16, 2024
1 parent aeeceee commit 3fa9f22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ void clusterInit(void) {
server.cluster->failover_auth_epoch = 0;
server.cluster->cant_failover_reason = CLUSTER_CANT_FAILOVER_NONE;
server.cluster->lastVoteEpoch = 0;
server.cluster->is_light_hdr_supported = 1;
server.cluster->all_nodes_are_known_to_support_light_hdr = 1;

/* Initialize stats */
for (int i = 0; i < CLUSTERMSG_TYPE_COUNT; i++) {
Expand Down Expand Up @@ -3065,7 +3065,7 @@ int clusterProcessPacket(clusterLink *link) {
if (flags & CLUSTER_NODE_LIGHT_HDR_SUPPORTED) {
sender->flags |= CLUSTER_NODE_LIGHT_HDR_SUPPORTED;
} else {
server.cluster->is_light_hdr_supported = 0;
server.cluster->all_nodes_are_known_to_support_light_hdr = 0;
}
}

Expand Down Expand Up @@ -4186,7 +4186,7 @@ void clusterPropagatePublish(robj *channel, robj **messages, int count, int shar
msgblock_light = clusterCreatePublishLightMsgBlock(
channel, messages, count, sharded ? CLUSTERMSG_TYPE_PUBLISHSHARD_LIGHT : CLUSTERMSG_TYPE_PUBLISH_LIGHT);

if (server.cluster->is_light_hdr_supported) {
if (server.cluster->all_nodes_are_known_to_support_light_hdr) {
/* If the cluster is homogeneous broadcast to all nodes */
if (sharded) {
clusterShardBroadcastMessage(msgblock_light);
Expand Down Expand Up @@ -4216,9 +4216,9 @@ void clusterPropagatePublish(robj *channel, robj **messages, int count, int shar
clusterSendMessage(node->link, msgblock_light);
}
iterReset(&iter);
/* If the cluster is not heterogeneous anymore, update the is_light_hdr_supported to 1 */
/* If the cluster is not heterogeneous anymore, update the all_nodes_are_known_to_support_light_hdr to 1 */
if (!nodes_not_supporting_light_header) {
server.cluster->is_light_hdr_supported = 1;
server.cluster->all_nodes_are_known_to_support_light_hdr = 1;
}
clusterMsgSendBlockDecrRefCount(msgblock);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cluster_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ struct clusterState {
clusterNode *migrating_slots_to[CLUSTER_SLOTS];
clusterNode *importing_slots_from[CLUSTER_SLOTS];
clusterNode *slots[CLUSTER_SLOTS];
int is_light_hdr_supported;
int all_nodes_are_known_to_support_light_hdr;
/* The following fields are used to take the replica state on elections. */
mstime_t failover_auth_time; /* Time of previous or next election. */
int failover_auth_count; /* Number of votes received so far. */
Expand Down
4 changes: 2 additions & 2 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -3289,9 +3289,9 @@ int pubsubUnsubscribeShardAllChannels(client *c, int notify);
void pubsubShardUnsubscribeAllChannelsInSlot(unsigned int slot);
int pubsubUnsubscribeAllPatterns(client *c, int notify);
int pubsubPublishMessage(robj *channel, robj *message, int sharded);
int pubsubPublishMessages(robj *channel, robj **message, int count, int sharded);
int pubsubPublishMessages(robj *channel, robj **messages, int count, int sharded);
int pubsubPublishMessageAndPropagateToCluster(robj *channel, robj *message, int sharded);
int pubsubPublishMessagesAndPropagateToCluster(robj *channel, robj **message, int count, int sharded);
int pubsubPublishMessagesAndPropagateToCluster(robj *channel, robj **messages, int count, int sharded);
void addReplyPubsubMessage(client *c, robj *channel, robj *msg, robj *message_bulk);
int serverPubsubSubscriptionCount(void);
int serverPubsubShardSubscriptionCount(void);
Expand Down

0 comments on commit 3fa9f22

Please sign in to comment.