-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Log leader and handshake failures by default #42342
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
Changes from 1 commit
9366fb4
9c64b02
bd0c29c
ed6a2e2
7013637
7a32587
f55db2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
|
|
||
| import org.apache.logging.log4j.LogManager; | ||
| import org.apache.logging.log4j.Logger; | ||
| import org.apache.logging.log4j.message.ParameterizedMessage; | ||
| import org.elasticsearch.Version; | ||
| import org.elasticsearch.action.ActionListener; | ||
| import org.elasticsearch.cluster.node.DiscoveryNode; | ||
|
|
@@ -89,6 +90,13 @@ protected void doRun() throws Exception { | |
| remoteNode = transportService.handshake(connection, probeHandshakeTimeout.millis()); | ||
| // success means (amongst other things) that the cluster names match | ||
| logger.trace("[{}] handshake successful: {}", this, remoteNode); | ||
| } catch (Exception e) { | ||
| // we opened a connection and successfully performed a low-level handshake, so we were definitely talking to an | ||
| // Elasticsearch node, but the high-level handshake failed indicating some kind of mismatched configurations | ||
| // (e.g. cluster name) that the user should address | ||
| logger.warn(new ParameterizedMessage("handshake failed for [{}]", this), e); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we do this only for the handshake bit? Can we avoid logging if it is truly a connection failure? e.g. ConnectTransportException.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't follow. As the comment says, we know that we successfully connected and performed a low-level handshake, so even a
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to avoid for a flaky network connection to cause extra verbose warnings here. I'm fine if you want to leave it this way though |
||
| listener.onFailure(e); | ||
| return; | ||
| } finally { | ||
| IOUtils.closeWhileHandlingException(connection); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of logging here at info level, I would prefer to pass the necessary info (message + exception) to
Coordinator.getOnLeaderFailureand let that one do the logging if it effectively turns the node back to candidate.Also I would prefer not to use the "leader" terminology when logging at info level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've moved the logging to the
Coordinatorin bd0c29c.