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

Fix potential infinite loop in clusterNodeGetPrimary #651

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

PingXie
Copy link
Member

@PingXie PingXie commented Jun 14, 2024

The original function could enter an infinite loop if there was a cycle in the replica chain. This change adds a check to break the loop if the node's replicaof eventually points back to itself. Additionally, a debugAssert has been added to ensure the replica/primary chain forms a tree structure and does not have any cycles.

Fix #609

The original function could enter an infinite loop if there
was a cycle in the replica chain. This change adds a check to
break the loop if the node's replicaof eventually points back
to itself. Additionally, a debugAssert has been added to ensure
the replica/primary chain forms a tree structure and does not
have any cycles.

Signed-off-by: Ping Xie <[email protected]>
@PingXie PingXie force-pushed the circular-replicaof branch from a1cba28 to 61aa3a3 Compare June 14, 2024 00:24
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.22%. Comparing base (5d9d418) to head (113c3e4).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable     #651      +/-   ##
============================================
+ Coverage     70.19%   70.22%   +0.03%     
============================================
  Files           110      110              
  Lines         60049    60051       +2     
============================================
+ Hits          42149    42170      +21     
+ Misses        17900    17881      -19     
Files Coverage Δ
src/cluster_legacy.c 85.95% <100.00%> (+0.32%) ⬆️

... and 11 files with indirect coverage changes

src/cluster_legacy.c Show resolved Hide resolved
@PingXie PingXie merged commit 8a776c3 into valkey-io:unstable Jun 14, 2024
18 checks passed
@PingXie PingXie deleted the circular-replicaof branch July 7, 2024 02:39
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.

[BUG] Flaky cluster tests 11-manual-takeover.tcl in 7.2
2 participants