-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Catalog and Routing
-
CAR Team 2026-07-06
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Set operations must support a mixed-state where the set of shard identifiers may consist of a mix of uuids and shard ids. It is generally risky to do set intersection/addition/removal/union among ShardRefs, because they can refer to the same shards by a different variant, therefore breaking comparison rules.
This hand-rolled logic exists at least in the files below, where a shard id or shard ref is subtracted from the result set from getAllShardRefs:
- src/mongo/db/global_catalog/ddl/drop_collection_coordinator.cpp
- src/mongo/db/global_catalog/ddl/drop_database_coordinator.cpp
- src/mongo/db/global_catalog/ddl/rename_collection_coordinator.cpp
- src/mongo/db/global_catalog/ddl/untrack_unsplittable_collection_coordinator.cpp
Guidance:
- Prefer ShardHandles whenever possible for set operations.
- If the above is not possible, do set operations between ShardHandles and ShardRefs. Think carefully about the variant a ShardRef may hold, especially for ShardRef snapshots carried around by DDL coordinator document, which can reflect a pre-upgrade/pre-downgrade state.