-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Summary
This command base class has been deprecated for several years.
AI-assisted refactors can get rid of the few remaining cases.
cluster fsync was already converted as a test (PR attached).
After that,...
Six commands still derive from ErrmsgCommandDeprecated, in five files. Once they are converted to TypedCommand, the ErrmsgCommandDeprecated base class can be deleted from src/mongo/db/commands.h and src/mongo/db/commands.cpp.
The router-role fsync command was converted separately; it was the only one whose errmsg had to survive alongside a partial result body, so the remaining six are simpler.
Router-role commands
| Command | Notes |
|---|---|
| replSetGetStatus | src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp Body is only errmsg = "not supported through mongos"; result.append("info", "mongos"); return false;. Returns ok:0 with an info field, so it needs the same Response |
| getDiagnosticData | src/mongo/s/commands/cluster_ftdc_commands.cpp Never assigns errmsg and always returns true — on the base class purely by inheritance. Mechanical conversion; needs a new IDL command. |
| split | src/mongo/s/commands/cluster_split_cmd.cpp Hardest remaining. errmsg is threaded through ~10 sites and passed as an out-param to FieldParser::extract. Converting requires replacing the hand-rolled FieldParser parsing with an IDL command. Recommend a separate ticket. |
Shard-role commands
| Command | Notes |
|---|---|
| splitVector | src/mongo/db/s/split_vector_command.cpp Two errmsg = sites, each immediately followed by return false on invalid input; both become uassert(ErrorCodes::InvalidOptions, ...). Needs an IDL command for keyPattern/min/max. |
| checkShardingIndex | src/mongo/db/global_catalog/metadata_consistency_validation/check_sharding_index_command.cpp Same shape as splitVector: two error sites ("no key pattern found", "ns not found"). |
| _recvChunkStart | src/mongo/db/s/migration_destination_manager_commands.cpp Declares errmsg in the signature but never assigns it. The other four _recvChunk* commands in this file are already converted, so this one should follow their existing pattern. |
Suggested order
- getDiagnosticData and _recvChunkStart — neither uses errmsg, pure mechanical swaps.
- splitVector and checkShardingIndex — identical shape, errmsg becomes uassert.
- replSetGetStatus — needs the fsync reply-shape handling.
- split — separate ticket; it is really a FieldParser-to-IDL migration.
- Delete ErrmsgCommandDeprecated from commands.h and commands.cpp.
Note on behavior changes
Converting a command to TypedCommand with a strict: true IDL makes it start rejecting unknown fields it previously ignored. For router commands that re-serialize the parsed request, all declared fields are then sent to shards with their defaults rather than only the fields the client supplied — worth a mixed-version check per command.