-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[JAVA-6033] ServerHeartbeatSucceededEvent is not fired for initial POLL monitoring #1856
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
base: main
Are you sure you want to change the base?
Changes from all commits
bcc22ba
51aa520
4e9b7db
662c519
abdf56a
74a7583
f099711
e3e15d0
2e5d684
2efac78
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 |
|---|---|---|
|
|
@@ -196,7 +196,8 @@ public void close() { | |
|
|
||
| @Override | ||
| public void run() { | ||
| ServerDescription currentServerDescription = unknownConnectingServerDescription(serverId, null); | ||
| ServerDescription unknownConnectingServerDescription = unknownConnectingServerDescription(serverId, null); | ||
| ServerDescription currentServerDescription = unknownConnectingServerDescription; | ||
| try { | ||
| while (!isClosed) { | ||
| ServerDescription previousServerDescription = currentServerDescription; | ||
|
|
@@ -216,6 +217,12 @@ public void run() { | |
| continue; | ||
| } | ||
|
|
||
| // For POLL mode, if we just established initial connection, do an immediate heartbeat | ||
| if (!shouldStreamResponses && connection != null && !connection.isClosed() | ||
| && currentServerDescription.equals(connection.getInitialServerDescription())) { | ||
| continue; | ||
|
Comment on lines
+221
to
+223
Member
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. Currently, we send two hello commands back-to-back but emit only one sequence of events ( When establishing a new connection, the flow in this PR looks like this:
We then call As a result we get:
This conflicts with the SDAM spec, which requires a correlation between started and succeeded/failed events, and also seem to require treating an initial handshake as a heartbeat event:
Judging by the above, the initial handshake appears to be treated as the first heartbeat. The unified tests confirm this expectation, for example, the serverMonitoringMode.yml unified test explicitly expects this sequence in streaming mode: If we run this test with the current implementation, we get: So the correlation between Given the above, it seems we should:
What do you think? P.S: For the regular heartbeat, we send a |
||
| } | ||
|
|
||
| logStateChange(previousServerDescription, currentServerDescription); | ||
| sdamProvider.get().monitorUpdate(currentServerDescription); | ||
|
|
||
|
|
||
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.
I haven't yet looked at the comment left by @vbabanin, so it is possible that Slava covered the same, but given that we found a discrepancy between our behavior and the behavior a spec test expects, we should investigate the relevant specification change that we are missing / implemented incorrectly, and implement / fix it, instead of just doing an ad-hoc driver change without any reference to the specification requirement (I found no reference in this PR or in JAVA-6033).