Before cloning unsharded collections, the movePrimary operation creates the indexes that are not present on the destination shard (i.e. the candidate to be primary). This creation of indexes was designed for unsharded collections: since the collection doesn't exist on the destination shard, we create the indexes assuming that the collection doesn't have data. However, we also try to create indexes for sharded collection which is risky because we might hit an invariant if we end up trying to create an index over a collection with data.
- is related to
-
SERVER-73665 Cloner::copyDb should handle the scenario where a collection already exists before calling IndexBuildsCoordinator::createIndexesOnEmptyCollection and hitting an invariant
- Closed
- related to
-
SERVER-74252 Tests can assume that movePrimary doesn't copy indexes of sharded collections anymore
- Closed