listCollections and listIndexes do not include commit-pending metadata. This can race with initial sync: the clone phase may fail to detect a collection or index that is pending commit (specifically, the storage transaction has committed, but the catalog changes are yet to be published to the in-mem catalog), while the beginApplyingTimestamp may point to that catalog change because the storage transaction has committed.
We have observed a failure where an initial syncing node did not clone a collection that was implicitly created via index creation (two oplog entries, one for collection creation, one for index creation). The beginApplyingTimestamp was set to the optime of the index creation, and listCollections failed to find the collection because it had yet to be published in the in-mem catalog.
This issue is unlikely to be observed in the field - it requires a careful combination of implicit collection creation + slow commit handlers + initial sync pointing the beginApplyingTimestamp to the creation optime. It has also probably existed since the dawn of time (I've reproduced on 6.0 onwards).
listCollections and listIndexes always read at latest; one solution would be to include commit-pending entries to their output.
- is depended on by
-
SERVER-90893 listDatabases inconsistent with concurrent DDL operations
- Closed
-
COMPASS-8338 Investigate changes in SERVER-82221: listCollections and listIndexes should include commit-pending namespaces
- Closed
-
TOOLS-3679 Investigate changes in SERVER-82221: listCollections and listIndexes should include commit-pending namespaces
- Needs Scheduling
- is related to
-
SERVER-82235 Make logical initial sync use $listCatalog instead of listDatabases/Collections/Indexes
- Blocked
- related to
-
SERVER-92273 ListCollections has inconsistent behavior for commit pending namespaces (7.0 only)
- In Code Review
-
SERVER-84176 Fix CollectionCatalog::establishConsistentCollections to avoid duplicated results during renames
- Closed
-
SERVER-92275 Improve test to check that list collections is consistent with the durable catalog
- Closed
-
SERVER-91861 Audit internal usage of list databases or collections for needing snapshot consistency
- Backlog
-
SERVER-93691 [v8.0] Revert "SERVER-82221 listCollections and listIndexes should include commit-pending namespaces"
- Closed
-
SERVER-90768 Compare output between listCollections and $listCatalog for the same database and verify equivalence in testing
- In Code Review