-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle underflow condition of network out slot stats metric #840
Merged
Conversation
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
Signed-off-by: Harkrishn Patro <[email protected]>
Related #720 |
madolson
reviewed
Jul 29, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #840 +/- ##
============================================
+ Coverage 70.38% 70.41% +0.02%
============================================
Files 112 112
Lines 61462 61467 +5
============================================
+ Hits 43261 43280 +19
+ Misses 18201 18187 -14
|
madolson
added
the
run-extra-tests
Run extra tests on this PR (Runs all tests from daily except valgrind and RESP)
label
Jul 30, 2024
…ot stat calculation Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
Signed-off-by: Harkrishn Patro <[email protected]>
madolson
approved these changes
Jul 30, 2024
mapleFU
pushed a commit
to mapleFU/valkey
that referenced
this pull request
Aug 22, 2024
…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 <[email protected]> Signed-off-by: mwish <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
run-extra-tests
Run extra tests on this PR (Runs all tests from daily except valgrind and RESP)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
len
which is ofunsigned long
type and multiplied withlen
(which could be negative). This is a risky operation and behaves differently based on the architecture.sdslen
method returnssize_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.Scenario:
Test code:
64 bit build
32 bit build: