[SERVER-49858] Reconsider API parameters for config server commands Created: 24/Jul/20  Updated: 29/Oct/23  Resolved: 10/Sep/20

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.8.0

Type: Task Priority: Major - P3
Reporter: A. Jesse Jiryu Davis 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:
Related
related to SERVER-58794 _configsvrCreateDatabase and _flushDa... Closed
related to SERVER-58785 Unable to create a new collection on ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Repl 2020-08-24, Repl 2020-09-07, Repl 2020-09-21
Participants:

 Description   

There are two mongos commands in API Version 1 that forward their parameters to internal commands: "drop" forwards to "_configsvrDropCollection" and "dropDatabase" forwards to "_configsvrDropDatabase". Users should be permitted to call the mongos commands with apiVersion: "1", apiStrict: true, but if the internal commands aren't in Version 1 they'll reject these parameters.

In detail: a client call to "drop" (or "dropDatabase") on mongos with apiVersion: "1" and apiStrict: true follows these steps:

  1. mongos receives the "drop" request with apiVersion: "1" and apiStrict: true in cluster_drop_cmd.cpp 
  2. mongos builds a "_configsvrDropCollection" command for the config primary
  3. mongos copies some fields from the "drop" request to the "_configsvrDropCollection" command with CommandHelpers::appendPassthroughFields. The API parameters are copied since they are not marked stripFromRequest in command_generic_argument.cpp
  4. The config primary receives "_configsvrDropCollection" with apiVersion: "1" and apiStrict: true
  5. The "_configsvrDropCollection" command rejects the request because it isn't in API Version 1.

In SERVER-49065 we fixed this by marking _configsvrDropCollection and _configsvrDropDatabase as part of API Version 1. But since _configsvrDropCollection/Database are internal commands they probably shouldn't be in API V1. Let's find a different way to support API version parameters in drop and dropDatabase on mongos.



 Comments   
Comment by Githook User [ 11/Sep/20 ]

Author:

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

Message: SERVER-49858 Add Command::acceptsAnyApiVersionParameters
Branch: svilen-optimizer-poc
https://github.com/mongodb/mongo/commit/ce0487190cf69d200028e7f9f4bcd3cefeea805d

Comment by Githook User [ 10/Sep/20 ]

Author:

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

Message: SERVER-49858 Add Command::acceptsAnyApiVersionParameters
Branch: master
https://github.com/mongodb/mongo/commit/ce0487190cf69d200028e7f9f4bcd3cefeea805d

Comment by A. Jesse Jiryu Davis [ 31/Aug/20 ]

Although including _configsvrDropCollection/Database in API Version 1 works, it still seems odd. Let's reconsider again.

Comment by Githook User [ 25/Aug/20 ]

Author:

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

Message: Revert "SERVER-49858 Don't forward API params from drop/dropDatabase to config servers"

This reverts commit f4ed96b5a788003322a2dc36b46063475a0b36ca.

For SERVER-50375 we must forward API parameters from mongos commands to
shard commands, so commit f4ed96b5 was, in retrospect, a step in the
wrong direction.
Branch: master
https://github.com/mongodb/mongo/commit/152ea482d58e610e12539cec0be3c4f03e30a213

Comment by A. Jesse Jiryu Davis [ 24/Aug/20 ]

Might revert this for SERVER-50375's sake, it turns out that we should forward API params from mongos commands so that they can be interpreted on all shards.

Comment by Githook User [ 13/Aug/20 ]

Author:

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

Message: SERVER-49858 Don't forward API params from drop/dropDatabase to config servers

There are two mongos commands in API Version 1 that forward their parameters to internal commands: "drop" forwards to "_configsvrDropCollection" and "dropDatabase" forwards to "_configsvrDropDatabase".
Users should be permitted to call the mongos commands with apiVersion: "1", apiStrict: true, but the internal commands aren't in Version 1 and they'll reject these parameters. So, strip the API version parameters when forwarding.
Branch: master
https://github.com/mongodb/mongo/commit/f4ed96b5a788003322a2dc36b46063475a0b36ca

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