Skip to content

Conversation

@enjoy-binbin
Copy link
Member

For corrupted (human-made) or program-error-recovered nodes.conf files,
check for duplicate nodeids when loading nodes.conf. If a duplicate is
found, panic is triggered to prevent nodes from starting up unexpectedly.

The node ID is used to identify every node across the whole cluster,
we do not expect to find duplicate nodeids in nodes.conf.

For corrupted (human-made) or program-error-recovered nodes.conf files,
check for duplicate nodeids when loading nodes.conf. If a duplicate is
found, panic is triggered to prevent nodes from starting up unexpectedly.

The node ID is used to identify every node across the whole cluster,
we do not expect to find duplicate nodeids in nodes.conf.

Signed-off-by: Binbin <[email protected]>
Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

This is very unusual? Only human edited nodes.conf and similar errors?

Signed-off-by: Binbin <[email protected]>
@enjoy-binbin
Copy link
Member Author

This is very unusual? Only human edited nodes.conf and similar errors?

yes, i did manually edited and test it locally, and the node attributes were overridden in various ways. Adding a safeguard doesn't seem like a bad thing.

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.35%. Comparing base (86db609) to head (96159e0).
⚠️ Report is 2 commits behind head on unstable.

Files with missing lines Patch % Lines
src/cluster_legacy.c 72.72% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #2852      +/-   ##
============================================
+ Coverage     72.26%   72.35%   +0.09%     
============================================
  Files           128      128              
  Lines         70370    70382      +12     
============================================
+ Hits          50851    50926      +75     
+ Misses        19519    19456      -63     
Files with missing lines Coverage Δ
src/cluster_legacy.c 87.32% <72.72%> (-0.19%) ⬇️

... and 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


zfree(line);
fclose(fp);
if (tmp_cluster_nodes) dictRelease(tmp_cluster_nodes);
Copy link
Member

Choose a reason for hiding this comment

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

tmp_cluster_nodes is always non-null at this point, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, you are right. I will remove it later.


zfree(line);
fclose(fp);
if (tmp_cluster_nodes) dictRelease(tmp_cluster_nodes);
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a serverAssert (tmp_cluster_nodes!= NULL) before this

/* Check if the node (nodeid) has already been loaded. The nodeid is used to
* identify every node across the entire cluster, we do not expect to find
* duplicate nodeids in nodes.conf. */
sds nodename = sdsnewlen(argv[0], sdslen(argv[0]));
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to create a new sds for dictfind?

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.

6 participants