Skip to content

Commit

Permalink
Assert network bytes out for replication slot stat computation is onl…
Browse files Browse the repository at this point in the history
…y allowed on primary

Signed-off-by: Harkrishn Patro <[email protected]>
  • Loading branch information
hpatro committed Jul 30, 2024
1 parent fa238dc commit 06908e4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/cluster_slot_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ static void clusterSlotStatsUpdateNetworkBytesOutForReplication(long long len) {
if (c == NULL || !canAddNetworkBytesOut(c)) return;

serverAssert(c->slot >= 0 && c->slot < CLUSTER_SLOTS);
serverAssert(nodeIsPrimary(server.cluster->myself));
if (len < 0) serverAssert(server.cluster->slot_stats[c->slot].network_bytes_out >= (uint64_t)llabs(len));
server.cluster->slot_stats[c->slot].network_bytes_out += (len * listLength(server.replicas));
}
Expand Down

0 comments on commit 06908e4

Please sign in to comment.