Skip to content

Conversation

@jyemin
Copy link
Collaborator

@jyemin jyemin commented Mar 1, 2023

Instead, check for session support during operation execution after the connection is checked out.

JAVA-4860

Instead, check for session support during operation execution
after the connection is checked out.

JAVA-4860
@jyemin jyemin self-assigned this Mar 1, 2023
jyemin added 3 commits March 1, 2023 19:26
JAVA-4860
JAVA-4860
JAVA-4860
}
if (sessionContext.hasSession() && responseExpected) {
extraElements.add(new BsonElement("lsid", sessionContext.getSessionId()));
if (sessionContext.hasSession()) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is really the crux of the whole change. A few notes:

  • All application-initiated messages now have a session, so the only time this is false is for SDAM-related connection
  • This seems a bit late to be checking for unsupported explicit sessions, but it's the only place to put it that wouldn't result in code duplication, since sync and async paths all end up here
  • In practice, almost every server that the driver could actually connect to (3.6+) supports sessions, so the only time isSessionSupported will return false is a 3.6 server in 3.4 FCV mode, or a mongocryptd server.

@jyemin jyemin requested review from katcharov and rozza March 2, 2023 22:50
@jyemin jyemin requested a review from katcharov March 3, 2023 21:49
Copy link
Collaborator

@katcharov katcharov left a comment

Choose a reason for hiding this comment

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

LGTM!

@jyemin jyemin merged commit dfd6e7c into mongodb:master Mar 9, 2023
@jyemin jyemin deleted the j4860 branch March 9, 2023 13:30
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.

3 participants