-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Catalog and Routing
-
🟥 DDL
-
None
-
None
-
None
-
None
-
None
-
None
loadIndexesFromAuthoritativeShard and the router-level CmdListIndexes::typedRun share nearly identical routing logic (CollectionRoutingInfoTargeter setup, timeseries namespace rewriting, shard selection via minKey chunk, and command execution).
We should deduplicate by exposing a cluster::listIndexes() function, following the established pattern of cluster::createCollection() and the approach taken in SERVER-123175 for cluster::createIndexes().
Proposal
- Add a cluster::listIndexes() function (e.g. in cluster_ddl.h) that encapsulates the shared logic: building the ListIndexes command, handling timeseries namespace rewriting via CollectionRoutingInfoTargeter, selecting the shard owning the minKey chunk (or primary shard for unsharded collections), and executing the command.
- The new function should accept a parameter controlling whether to drain the full cursor internally (for internal callers like loadIndexesFromAuthoritativeShard) or return a passthrough cursor (for the client-facing command).
- Refactor CmdListIndexes::typedRun and loadIndexesFromAuthoritativeShard to both delegate to cluster::listIndexes().
- Current callers of loadIndexesFromAuthoritativeShard (shardsvr_process_interface, mongos_process_interface, rename_collection_coordinator) would switch to the new shared function.
- is related to
-
SERVER-123177 Fix timeseries routing for loadIndexesFromAuthoritativeShard
-
- Closed
-
-
SERVER-123175 Deduplicate cluster createIndexes code by exposing a cluster::createIndexes function
-
- Needs Scheduling
-