[SERVER-51133] $indexStats should consider index visibility in relation to its snapshot Created: 24/Sep/20  Updated: 29/Oct/23  Resolved: 09/Oct/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: Louis Williams Assignee: Louis Williams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-51794 collStats should consider index visib... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2020-10-19
Participants:
Linked BF Score: 23

 Description   

$indexStats may read at a point in time where it observes an index completed in the CollectionIndexUsageTracker (in-memory), but whose durable catalog information is not visible in the current snapshot.

As of SERVER-47866, $indexStats needs to consider each index's visibility, because it is no longer protected from AutoGetCollectionForRead.

I see a few options:

  • Don't report indexes that have a minimumVisibleSnapshot higher than the current read timestamp. Since we setMinimumVisibleSnapshot at the begin and end of an index build, this would fail to report just-completed indexes that otherwise should be seen as in-progress.
  • Create a helpers IndexCatalogEntry::isPresentInMySnapshot() and IndexCatalogEntry::isReadyInMySnapshot() that are renamed from the existing _catalogIsPresent and _catalogIsReady functions. This should allow us to preserve the same behavior and without relying on minimumVisibleSnapshot

Note: the reason why the current isReady() check is not sufficient is because of this debug check which does not fail, but will trigger a different invariant in the DurableCatalog::isIndexReady.



 Comments   
Comment by Githook User [ 08/Oct/20 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-51133 should consider index visibility in relation to its snapshot
Branch: master
https://github.com/mongodb/mongo/commit/0d13febec4de6bf6db0aa875ad74b93070cc4ed4

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