Skip to content
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

Add check in CLUSTERLINK KILL cmd to avoid freeing links to myself #689

Merged
merged 1 commit into from
Jun 25, 2024
Merged

Add check in CLUSTERLINK KILL cmd to avoid freeing links to myself #689

merged 1 commit into from
Jun 25, 2024

Conversation

pieturin
Copy link
Contributor

Add check in CLUSTERLINK KILL cmd to avoid freeing cluster bus links to myself. Also add an assert in freeClusterLink().

Testing:

127.0.0.1:6379> debug clusterlink kill all c0404ee68574c6aa1048aaebfe90283afe51d2fc
(error) ERR Cannot free cluster link(s) to myself

@madolson
Copy link
Member

@pieturin Do you want to add some more information about why you added the assert? The debug check seems fine, since the node will exist but it won't have any links.

@pieturin
Copy link
Contributor Author

Adding the assert should avoid more errors like the one fixed by this commit for example.

Copy link
Collaborator

@hpatro hpatro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Also add an assert in freeClusterLink().

Signed-off-by: Pierre Turin <[email protected]>
Copy link
Member

@madolson madolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, the server assert seems like a good defense to make sure we aren't accessing random memory.

Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 70.03%. Comparing base (32ca6e5) to head (ccd9108).
Report is 3 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable     #689      +/-   ##
============================================
- Coverage     70.17%   70.03%   -0.14%     
============================================
  Files           110      110              
  Lines         60092    60104      +12     
============================================
- Hits          42170    42096      -74     
- Misses        17922    18008      +86     
Files Coverage Δ
src/cluster_legacy.c 85.81% <50.00%> (-0.19%) ⬇️

... and 12 files with indirect coverage changes

@madolson madolson merged commit 495c35d into valkey-io:unstable Jun 25, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants