[SERVER-24389] Fix or remove Command::parseNs() Created: 03/Jun/16  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-24387 FTDC invokes the 'collStats' command ... Closed
Related
is related to SERVER-24128 Namespace parsing in commands code mu... Closed
Assigned Teams:
Query Optimization
Participants:

 Description   

The default implementation of Command::parseNs is pretty lenient with respect to the formatting of the database or the namespace part of the commands. We should change the default implementation to use parseNsCollectionRequired.



 Comments   
Comment by David Storch [ 05/Dec/16 ]

Except for a few odd ducks like the group command (which was deprecated in 3.4.0), commands have three styles in which they accept namespace strings:

  1. The command takes the collection name as its first parameter. This is true of commands like find and aggregate. This this case, the fully-qualified namespace string is computed by combining the database string against which the command was run with the collection string extracted from the command parameters. This process is implemented by Command::parseNsCollectionRequired().
  2. The command takes a fully-qualified namespace as its first parameter. This is true of commands like shardCollection and moveChunk. Parsing of such namespace strings is handled by Command::parseNsFullyQualified().
  3. The command does not include a namespace in its parameters, and instead we just use the database name. In this case, we shouldn't need any parsing function, since there is no additional command parsing to do.

Based on this analysis, I think most uses of Command::parseNs() are probably subtly wrong. We are planning to fix a lot of these problems in SERVER-24128, which I have linked as related. Rather than fix Command::parseNs(), it might be better to delete it altogether and to migrate callers to more appropriate parsing functions.

Generated at Thu Feb 08 04:06:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.