-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
ALL
-
200
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Problem
MultiIndexBlock's drain and constraint paths dereference the collection and index catalog entries without null checks. If an entry is dropped while a build is still running, the builder segfaults in drainBackgroundWrites (Invalid access at address: 0). The collection lookup carries a TODO(SERVER-103400) acknowledging the missing check.
Scope
- Guard the collection lookup and getEntry results in drainBackgroundWrites, captureInitialDrainTails, retrySkippedRecords, and checkConstraints (src/mongo/db/index_builds/multi_index_block.cpp) to return Status(ErrorCodes::IndexBuildAborted) when the collection or index entry is gone. The dropped-collection case is currently unreachable (dropCollection refuses with BackgroundOperationInProgressForNamespace while an unfinished build exists), so that guard is defense in depth.
- Make catalog::removeIndex (src/mongo/db/shard_role/shard_catalog/collection_catalog_helper.cpp) tolerate an index already absent from the durable catalog entry, so cleanup after such an abort does not fail the abort WUOW: MDBCatalog::getIndexIdent throws a TypeMismatch on the missing ident, and the builder's cleanup fasserts.
- Unit tests in multi_index_block_test.cpp for each guard path, including a drain that propagates a tail-capture failure instead of continuing.
- is related to
-
SERVER-140132 Skip live PDIBs when aborting unresumable builds on stepUp
-
- In Code Review
-
-
SERVER-103400 Investigate usage validity of CollectionPtr::CollectionPtr_UNSAFE
-
- Backlog
-