Skip to content

Improve exception message when DruidLeaderClient doesn't find leader node - #14775

Merged
abhishekagarwal87 merged 4 commits into
apache:masterfrom
findingrish:update_exception_message
Aug 10, 2023
Merged

abhishekagarwal87 merged 4 commits into
apache:masterfrom
findingrish:update_exception_message

Conversation

@findingrish

@findingrish findingrish commented Aug 8, 2023 •

Copy link
Copy Markdown
Contributor

The existing exception message No known server thrown in DruidLeaderClient is unhelpful.
This pr updates the message to be informative and actionable.

if (leader == null) {
throw new IOE("No known server");
throw DruidException.forPersona(DruidException.Persona.ADMIN)
.ofCategory(DruidException.Category.NOT_FOUND)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it should be RUNTIME_FAILURE and not NOT_FOUND.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure between the two. I also think RUNTIME_FAILURE is apt since the leader server wasn't set and hence couldn't be found due to some failure.

throw DruidException.forPersona(DruidException.Persona.ADMIN)
.ofCategory(DruidException.Category.NOT_FOUND)
.build(
"No leader server found for NodeRole [%s] and leaderRequestPath [%s].",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NodeRole is a technical internal term. Instead, you can do something like below

"A leader node could not be found for [%s] service. check the logs of [%s] service to validate that service is healthy. ", nodeRole, nodeRole

);
}

private String getCurrentKnownLeader(final boolean cached) throws IOException

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am a bit hesitant of changing the type of exception here. Since callers might be catching this right now. Maybe keep it IOException for now and just change the error message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that makes sense. Let me just update the exception message.

@findingrish findingrish changed the title Throw DruidException when DruidLeaderClient doesn't find leader server Improve exception message when DruidLeaderClient doesn't find leader node Aug 8, 2023
@abhishekagarwal87

Copy link
Copy Markdown
Contributor

there are test failures that need to be addressed.

Comment on lines +268 to +269
"A leader node could not be found for [%s] service. Check logs to validate service health.",
nodeRoleToWatch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"A leader node could not be found for [%s] service. Check logs to validate service health.",
nodeRoleToWatch
"A leader node could not be found for [%s] service. Check logs of service [%s] to confirm it is healthy.",
nodeRoleToWatch, nodeRoleToWatch

@abhishekagarwal87
abhishekagarwal87 merged commit 4b9846b into apache:master Aug 10, 2023
@LakshSingla LakshSingla added this to the 28.0 milestone Oct 12, 2023
riovic918data pushed a commit to riovic918data/druid that referenced this pull request Jun 12, 2026
…node (apache#14775)

The existing exception message No known server thrown in DruidLeaderClient is unhelpful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants