The index build process updates both the currentOp message and the listIndexes results to reflect the current phase of the index build. For the collection scan phase, the gap between updating the currentOp message and setting the phase for listIndexes (and resumable index builds) may be noticeable enough on slow machines for the two command results to be inconsistent with each other.
We have observed occasional failures in our CI system as a result of this issue in the test list_indexes_index_build_info.js, where the test helper IndexBuildTest.waitForIndexBuildToScanCollection() infers the collection scan state from the initialization of the progress meter in the currentOp output.
Besides listIndexes, the index build phase is used to support[ resuming index builds|https://www.mongodb.com/docs/manual/core/index-creation/#monitor-in-progress-index-builds] that have been interrupted by server shutdown. We save the information in MultiIndexBlock::_constructStateObject() and parse it on startup in StorageEngineImpl::_handleInternalIdent(). The handling of the resumable index build info should be a consideration in any potential solution.
We should also revisit IndexBuildTest.waitForIndexBuildToScanCollection() to see if it can be made more robust by checking the listIndexes output before getting the operation ID.
- is related to
-
SERVER-37265 Change currentOp and ProgessMeter for hybrid
- Closed
-
SERVER-48416 write index build progress to internal table on clean shutdown
- Closed
-
SERVER-60791 Add information about index build state in listIndexes output
- Closed