-
Notifications
You must be signed in to change notification settings - Fork 891
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
GODRIVER-2966 Remove the heartbeat events after a connection is closed / a check is canceled. #1378
Conversation
…n is closed / a check is canceled.
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.
LGTM! Did you notice any freezing with the lambda update? Which CI tasks would this be tested in?
Unfortunately, we don't have a CI task to test against the lambda freezing. I can try to add one. |
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.
Looks good 👍
@qingyang-hu Currently there is no clear requirement in the SDAM specifications that requires us to publish heartbeat events when attempting to establish a connection. However, many drivers do this including Python, Node, and Rust. Go Driver only publishes the "started" event when the connection is not nil. So we don't publish this event on the initial connection, per se. Only when we re-establish connections. The reason we do this comes from PR #1133 , where IIUC it was determined that passing an empty value for the connection ID is not appropriate. There is a Drivers ticket open for this right now, DRIVERS-2677 , where it has been suggested that passing a "0" value for the connectionID is a viable solution in this case since connectionID starts at "1". I suggest we do three things to resolve this PR:
CC: @matthewdale , @ShaneHarvey |
The publications in the else block are required by the specification, i.e. before we send a hello command and whether or not the hello failed/succeeded: https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring-logging-and-monitoring.rst#events-api |
26368d8
if s.conn == nil || s.conn.closed() || s.checkWasCancelled() { | ||
// Create a new connection if this is the first check, the connection was closed after an error during the previous | ||
// check, or the previous check was cancelled. | ||
connID := "0" |
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.
A connection ID of "0"
doesn't match the existing pattern of "<addr>[-<number>]"
(see here). Using an empty string seems more correct for when the connection is nil.
} | ||
s.publishServerHeartbeatStartedEvent(connID, false) |
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.
We should do something similar for the subsequent publishServerHeartbeatSucceededEvent
and publishServerHeartbeatFailedEvent
so they always get published, even if the conn is nil. That's especially important for the failed event so we can report the error.
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.
LGTM
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.
Looks good 👍
…d / a check is canceled. (mongodb#1378) (cherry picked from commit 4a26e6c)
GODRIVER-2966
Summary
Remove the heartbeat events when checking on the server after a connection is closed / a check is canceled.
Background & Motivation