[SERVER-85914] Inspect all usages of CollectionMetadata::getChunkManager() and hide it from the public API Created: 30/Jan/24  Updated: 05/Feb/24

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

Type: Bug Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: car-investigation
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-84761 MigrationSourceManager may fail to em... Open
Assigned Teams:
Catalog and Routing
Operating System: ALL
Participants:

 Description   

The CollectionMetadata::getChunkManager() method exposes internal implementation detail of the ownership state of the shard role. This detail is dangerous to use, because it happens to also contain the ownership state of other shards without any guarantee of its stability.

For example, this piece of code makes a correctness-critical assumption for change streams, based on cached (and possibly stale) information that the recipient of a chunk doesn't contain any data. This is not correct to do, because between the time the donor recovers its ownership information and the time this check is performed, there is no guarantee that the recipient hasn't received something or lost all its chunks.

The goal of this ticket is to:

  1. Inspect all calls to CollectionMetadata::getChunkManager() and if they legitimately only look at ranges owned by the shard (shard role usage), place them as semantic operations on the ScopedCollectionOwnershipFilter similar to this one.
  2. If they look at ranges that are not owned by the shard, file SERVER tickets explaining the bugs that this may lead to, the versions impacted and relate them to this ticket (e.g. SERVER-85914).
  3. Hide CollectionMetadata::getChunkManager() from the public section of CollectionMetadata.

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