[SERVER-77606] Reads concurrent with create index that also modifies multikey errors fail to find collection Created: 30/May/23  Updated: 29/Oct/23  Resolved: 31/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc3

Type: Bug Priority: Major - P3
Reporter: Henrik Edin Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: Execution Team 2023-06-12
Participants:
Linked BF Score: 147

 Description   

Reading concurrently with a create index DDL operation that also modifies multikey fails. There is a condition inside establishConsistentCollection when, in addition to the DDL operation, a multikey setting has also changed.

When instantiating the collection for the read, we look for the shared index ident in both the provided IndexCatalog and inside the drop pending reaper. If it isn't found in either we will simply fail to create the collection, and lookups by UUID/Namespace will return nullptr for the remainder of this operation.

When an index is added it will only be in the index catalog for the collection instance in the pending commit state, but latestCollection is passed to the caller here. Causing the instantiation to fail and the read believes that the collection doesn't exist.



 Comments   
Comment by Githook User [ 31/May/23 ]

Author:

{'name': 'henrikedin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-77606 Fix issue where reads fail to find collection.

Reading concurrently with a DDL operation adding an index to the index catalog and also doing some multikey changes can fail to find the collection.

We reach a fallback in establishConsistentCollection where the metadata of either instance doesn't match the snapshot. When instantiating the collection for the read we need to use the collection in pending commit as the base as it might contain an index visible in the storage engine snapshot.

(cherry picked from commit 6b4665df960009b21bec4c47ffcb50e155e610f0)
Branch: v7.0
https://github.com/mongodb/mongo/commit/58c26d5a0c76a96de54c3e8b97fd0ee89b1c720b

Comment by Githook User [ 31/May/23 ]

Author:

{'name': 'henrikedin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-77606 Fix issue where reads fail to find collection.

Reading concurrently with a DDL operation adding an index to the index catalog and also doing some multikey changes can fail to find the collection.

We reach a fallback in establishConsistentCollection where the metadata of either instance doesn't match the snapshot. When instantiating the collection for the read we need to use the collection in pending commit as the base as it might contain an index visible in the storage engine snapshot.
Branch: master
https://github.com/mongodb/mongo/commit/6b4665df960009b21bec4c47ffcb50e155e610f0

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