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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃敶 Transactions are not used now! #86
Comments
Nice catch @Olegt0rr 馃
Do you have some references about this ? |
To find out if we're connected to a replicaset or not, i found another way, using the db.serverStatus command: server_status = await self.database.command({'serverStatus' :1})
is_standalone = "repl" not in server_status I tried to use the |
https://docs.mongodb.com/manual/core/transactions-production-consideration/#feature-compatibility Replica Set (4.0+) and Sharded Cluster (4.2+) support transactions.
This way requires server admin role: For Also added request to MongoDB jira: https://jira.mongodb.org/browse/PYTHON-2476 |
Yes 馃槶, I totally forgot this initial constraint. Thanks for creating the request in Jira !
This looks like a very good solution. We will have to check the version as well to make sure sharded cluster are 4.2+. |
Seems calling |
Need some help to finish tests coverage |
Hey, yes I will merge #91 as soon as possible, this should help you with the coverage :) |
Closed by #227 |
Bug
In the
_save()
method transaction'ssession
is not passed toupdate_one()
request.odmantic/odmantic/engine.py
Lines 315 to 320 in 541d411
It means that transaction is NOT USED NOW!
How to fix?
It's not enough to just pass the
session
to request.In MongoDB transactions are not available for Standalone.
This simple way Standalone users will get exceptions for every
save()
call 馃槩So we need to define the users of Standalone version and not start a transaction for them.
Example:
P.S.: I don't know how to properly check
ServerType
without protected_server_property
method :(The text was updated successfully, but these errors were encountered: