Skip to content
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

MONGOID-5552 session should not change the client that created it #2831

Closed

Conversation

jamis
Copy link
Contributor

@jamis jamis commented Feb 5, 2024

This isn't the complete solution (yet), but this is a step towards it.

The Mongo::Session class was previously setting the session instance's @client variable to client.use(:admin) for some reason. I suspect it is because the spec requires certain commands (startSession and endSessions) to be executed against the admin database. However, we don't ever issue those commands; startSession is only needed if you want the server to generate session IDs (and we do it ourselves), and endSessions...well...I don't know why that's not present.

So, the point is: the session doesn't need a handle to the admin database. And even if it needed one to execute those commands, the session's client shouldn't be changed in any way from the client that initialized it.

@jamis jamis requested a review from comandeo February 5, 2024 21:00
@jamis jamis closed this Jun 5, 2024
@jamis jamis deleted the mongoid-5552-detect-client-in-transaction branch June 5, 2024 14:10
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.

1 participant