[SERVER-53299] AutoGetCollectionForReadLockFree is checking repl state multiple times without holding RSTL Created: 09/Dec/20  Updated: 29/Oct/23  Resolved: 14/Dec/20

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

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:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2020-12-14, Execution Team 2020-12-28
Participants:
Linked BF Score: 15

 Description   

SnapshotHelper::shouldReadAtLastApplied is called explicitly from AutoGetCollectionForReadBase and via SnapshotHelper::getNewReadSource. It is checking ReplicationCoordinator::canAcceptWritesForDatabase which can change as we're not holding the RSTL. A different answer would trigger the following fassert: https://github.com/mongodb/mongo/blob/51e3e36ac48cac80c920e5e418013fdb0a6747f2/src/mongo/db/db_raii.cpp#L262-L265



 Comments   
Comment by Githook User [ 14/Dec/20 ]

Author:

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

Message: SERVER-53299 Fix so AutoGetCollectionForReadLockFree only read replication state once when setting up read source.
Branch: master
https://github.com/mongodb/mongo/commit/0c4247a3401c21b59f7f6553b169aecbf824091f

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