[SERVER-54116] An AutoGetCollectionForReadLockFree instantiated under a AutoGetCollectionForRead with an already open storage snapshot invariants Created: 28/Jan/21  Updated: 29/Oct/23  Resolved: 16/Feb/21

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Bug Priority: Major - P3
Reporter: Dianna Hohensee (Inactive) Assignee: Dianna Hohensee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2021-02-22
Participants:
Linked BF Score: 52

 Description   

Lock-free reads must be able to handle AutoGetCollectionForReadLockFree being instantiated under an AutoGetCollectionForRead that has already opened a storage snapshot/transaction. OR, abandonSnapshot() must be called before or in AutoGetCollectionForReadLockFree somehow.

Scenario where the bug surfaced:
dumpChunks uses a DBDirectClient for a query. There is an AutoGetCollectionForRead instantiated already instantiated. A query was in-progress when the error occurred that resulted in the DBDirectClient use for better error reporting.



 Comments   
Comment by Githook User [ 16/Feb/21 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: SERVER-54116 AutoGetCollection*MaybeLockFree should pivot to locked if a storage snapshot is already open without the lock-free read operation flag set.

This avoids using a -LockFree helper, via the DBDirectClient, that must reset the storage snapshot.
Branch: master
https://github.com/mongodb/mongo/commit/5d0eaf8291050689b970581083abc5d0e6c931d1

Comment by Dianna Hohensee (Inactive) [ 28/Jan/21 ]

A simple solution might be to pivot in supportsLockFreeRead() based on whether there are any collection locks held.

Update: checking for a collection lock would be clean, but also costly, because the isCollectionLockedForMode function is not cheap. Therefore, shouldn't use that on all LFR reads.

Generated at Thu Feb 08 05:32:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.