[SERVER-47682] Background collection validation can read behind the minimum visible snapshot Created: 21/Apr/20  Updated: 27/Oct/23  Resolved: 23/Apr/20

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

Type: Bug Priority: Major - P3
Reporter: Gregory Wlodarek Assignee: Gregory Wlodarek
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Sprint: Execution Team 2020-05-04
Participants:
Linked BF Score: 19

 Description   

I added an invariant to check if the all durable read timestamp we were given was a valid read timestamp for the collection (given its minimum visible snapshot). This doesn't turn out to always be true.

Because we opted to use CollectionLock in validation, as opposed to AutoGetCollection, we miss out on its internal checks for this.

[conn196] Timestamps{"getPointInTimeReadTimestamp":{"$timestamp":{"t":20,"i":22058}},"getMinimumVisibleSnapshot":{"$timestamp":{"t":1587410841,"i":5}}}
[conn196] Replication state{"mode":"PRIMARY"}
[conn196] Invariant failure{"expr":"*opCtx->recoveryUnit()->getPointInTimeReadTimestamp() >= validateState.getCollection()->getMinimumVisibleSnapshot()","file":"src/mongo/db/catalog/collection_validation.cpp","line":507}

We should probably loop trying to get a valid read timestamp for the collection and all of its indexes that will be validated.



 Comments   
Comment by Gregory Wlodarek [ 23/Apr/20 ]

After discussing with Dan G, we're going to close this as won't do.
Index creation updates both the collection and index entry minimum visible snapshot. If an index creation didn't update the collection minimum visible snapshot, then theoretically we shouldn't be running into this invariant.

Because we use the ReadyIndexesIterator from the IndexCatalog, we won't see any ready indexes that were committed after our read timestamp as the iterator will actively skip those indexes for us.

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