[SERVER-55614] Permit Versioned API options for getMore and transaction-continuing commands Created: 30/Mar/21  Updated: 29/Oct/23  Resolved: 07/May/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Andreas Braun Assignee: A. Jesse Jiryu Davis
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 SERVER-56550 Require Versioned API options for get... Closed
Documented
is documented by DOCS-14397 Investigate changes in SERVER-55614: ... Closed
Related
related to SERVER-55593 Iterating cursor fails when the shell... Closed
Backwards Compatibility: Fully Compatible
Sprint: Repl 2021-05-17
Participants:

 Description   

The Versioned API design requires drivers and users to omit Versioned API parameters in the following two instances:
1. When calling getMore
2. In any command that is part of a transaction, except for the command starting the transaction.

The reason for not allowing them on getMore calls is that it's bound to the API Version declared when creating the cursor. For transactions, the entire transaction operates under the same declared API Version, so later commands should not be able to override this.

While this approach makes sense, it creates unnecessary workload in drivers. Drivers have to inspect command documents to know whether they should append Versioned API options for this instance. This can have a performance impact for drivers that already have raw BSON documents at this point.

To fix this, Drivers and users should be required to include API versioning options for getMore and transaction-continuing commands, with the server emitting a command error if there is an API Version mismatch (exact comparison, e.g. apiVersion, apiStrict, and apiDeprecationErrors match).

To aid with the transition to this new requirement, the options should be optional at first and can become required options once all drivers have updated their logic to always include these options.



 Comments   
Comment by Githook User [ 07/May/21 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'}

Message: SERVER-55614 getMore accepts API version params
Branch: master
https://github.com/mongodb/mongo/commit/99fe7a8349fbe620e0ee4a7c070fa7a908635e01

Comment by A. Jesse Jiryu Davis [ 05/May/21 ]

When I said "4 commits", I'd forgotten that I'd accidentally made the shell already pass API params in getMore and transaction-continuing commands (SERVER-55593). So it might just be 2.

Comment by Githook User [ 04/May/21 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'}

Message: SERVER-55614 Make API params optional for cmds in txns
Branch: master
https://github.com/mongodb/mongo/commit/4aa27885874b90e098c1225fccb10f4daa3b3d38

Comment by A. Jesse Jiryu Davis [ 03/May/21 ]

I plan on 4 commits:

  • Accept API params in transaction-continuing commands. If present they must match the transaction-initiating command's params. Update mongos to forward API params to shards with all commands in transactions, including commit/abortTransaction.
  • Update the shell to include API params in transaction-continuing commands if the shell was started with --apiVersion 1 etc.
  • Accept API params in getMore. If present they must match the cursor-initiating command's params. Update mongos's getMore to forward params to shards.
  • Update the shell to include API params in getMore if the shell was started with --apiVersion 1 etc.
Comment by A. Jesse Jiryu Davis [ 30/Mar/21 ]

I've been involved in Slack conversations about this change. Since the driver authors say it will make their code simpler, I'm in favor.

Generated at Thu Feb 08 05:36:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.