forked from valkey-io/valkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle underflow condition of network out slot stats metric (valkey-i…
…o#840) Fixes test failure (https://github.com/valkey-io/valkey/actions/runs/10146979329/job/28056316421?pr=837) on 32 bit system for slot stats metric underflow on the following condition: ``` server.cluster->slot_stats[c->slot].network_bytes_out += (len * listLength(server.replicas)); ``` * Here listLength accesses `len` which is of `unsigned long` type and multiplied with `len` (which could be negative). This is a risky operation and behaves differently based on the architecture. ``` clusterSlotStatsAddNetworkBytesOutForReplication(-sdslen(selectcmd->ptr)); ``` * `sdslen` method returns `size_t`. applying `-` operation to decrement network bytes out is also incorrect. This change adds assertion on `len` being negative and handles the wrapping of overall value. --------- Signed-off-by: Harkrishn Patro <harkrisp@amazon.com>
- Loading branch information
Showing
3 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters