[CDRIVER-3161] Prohibit starting a transaction for maxWireVersion < 7 Created: 31/May/19  Updated: 28/Oct/23  Resolved: 17/Jun/19

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.14.1

Type: Improvement Priority: Major - P3
Reporter: Jeremy Mikola Assignee: Clyde Bazile III (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by PHPC-1391 Prohibit starting a transaction for m... Closed
Related
related to CDRIVER-3224 mongoc_client_session_start_transacti... Closed
related to DRIVERS-2133 Require startTransaction to report an... Backlog
is related to CDRIVER-3067 Ensure 4.0 drivers return an error wh... Closed

 Description   

The startTransaction section of the Transaction spec states:

startTransaction SHOULD report an error if the driver can detect that transactions are not supported by the deployment. A deployment does not support transactions when the deployment does not support sessions, or maxWireVersion < 7, or the maxWireVersion < 8 and the topology type is Sharded.

CDRIVER-3067 will address the case of a sharded cluster, but libmongoc currently does not prohibit starting a transaction on a server with wire version 6, where sessions are supported but transactions are not (i.e. 3.6). I don't believe we need to worry about wire versions < 6 because it should be impossible to create a session in that topology (it would be wise to confirm this just in case). Nevertheless, we can probably check for maxWireVersion < 7 just to be safe.

I don't believe this is a serious problem, as we can still rely on the server to report an error for an unrecognized command option (e.g. "BSON field 'insert.startTransaction' is an unknown field"); however, libmongoc would still do well to raise a preemptive error in this case to better comply with the spec.



 Comments   
Comment by Clyde Bazile III (Inactive) [ 17/Jun/19 ]

Author:

{'name': 'bazile-clyde', 'email': '34226620+bazile-clyde@users.noreply.github.com', 'username': 'bazile-clyde'}

Message: CDRIVER-3067/3161 error when attempting sharded transactions on 4.2 or maxWireVersion < 7 (#567) (#568)
Branch: r1.14
https://github.com/mongodb/mongo-c-driver/commit/2d7d5f20261eb797afed22a17c397c8c91014605

Comment by Kevin Albertson [ 10/Jun/19 ]

clyde.bazile if this is done in CDRIVER-3067, let's close this after CDRIVER-3067 is merged.

Generated at Wed Feb 07 21:17:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.