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

Filter out Stargate/coordinator nodes from calls to get live nodes or list tokens #1433

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

adejanovski
Copy link
Contributor

Fixes #1432

@adejanovski adejanovski force-pushed the fix-untranslated-host branch 6 times, most recently from d851b0a to 6e4bf68 Compare October 23, 2023 11:26
… list tokens.

The http management implementation uses endpoint states for listing nodes and tokens, unlike JMX, which also contains Stargate nodes.
This breaks some calls which expect the Stargate nodes to behave like standard Cassandra nodes.
This commit filters out the endpoint state entries that don't have tokens to make sure Stargate nodes aren't accounted for when they shouldn't be.
@adejanovski adejanovski changed the title Fix untranslated host Filter out Stargate/coordinator nodes from calls to get live nodes or list tokens Oct 23, 2023
@adejanovski adejanovski marked this pull request as ready for review October 23, 2023 12:26
Copy link
Collaborator

@emerkle826 emerkle826 left a comment

Choose a reason for hiding this comment

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

small nit.

Comment on lines 411 to 413
if (states.containsKey("IS_ALIVE")
&& Boolean.parseBoolean(states.get("IS_ALIVE"))
&& !isCoordinatorNode(states)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion:
I think it would be a small optimization to check if it's a coordinator node first as the states should almost always have an "IS_ALIVE" key. For coordinator-only nodes(i.e. Stargate), changing the order of the checks here will reduce the number of map reads I think.

Suggested change
if (states.containsKey("IS_ALIVE")
&& Boolean.parseBoolean(states.get("IS_ALIVE"))
&& !isCoordinatorNode(states)) {
if (!isCoordinatorNode(states)
&& states.containsKey("IS_ALIVE")
&& Boolean.parseBoolean(states.get("IS_ALIVE"))) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed 👍

@adejanovski adejanovski merged commit 0c1c835 into master Oct 23, 2023
2 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.

Exceptions are being raised when using LOCAL mode with the mgmt-api
2 participants