diff options
Diffstat (limited to 'src/mongo/db/storage/kv')
-rw-r--r-- | src/mongo/db/storage/kv/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/storage/kv/kv_storage_engine.cpp | 16 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/mongo/db/storage/kv/SConscript b/src/mongo/db/storage/kv/SConscript index 09c485f28c3..45d1e34d760 100644 --- a/src/mongo/db/storage/kv/SConscript +++ b/src/mongo/db/storage/kv/SConscript @@ -53,6 +53,7 @@ env.Library( LIBDEPS=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/db/catalog/catalog_control', + '$BUILD_DIR/mongo/db/server_options_core', '$BUILD_DIR/mongo/db/storage/kv/kv_engine_core', '$BUILD_DIR/mongo/db/storage/storage_options', 'kv_drop_pending_ident_reaper', diff --git a/src/mongo/db/storage/kv/kv_storage_engine.cpp b/src/mongo/db/storage/kv/kv_storage_engine.cpp index 4b55155450c..d9471cc6d2c 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine.cpp +++ b/src/mongo/db/storage/kv/kv_storage_engine.cpp @@ -42,6 +42,7 @@ #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/logical_clock.h" #include "mongo/db/operation_context_noop.h" +#include "mongo/db/server_options.h" #include "mongo/db/storage/kv/kv_catalog_feature_tracker.h" #include "mongo/db/storage/kv/kv_engine.h" #include "mongo/db/storage/kv/temporary_kv_record_store.h" @@ -431,9 +432,18 @@ KVStorageEngine::reconcileCatalogAndIdents(OperationContext* opCtx) { // table is not found, or the index build did not successfully complete, this code // will return the index to be rebuilt. if (indexMetaData.isBackgroundSecondaryBuild && (!foundIdent || !indexMetaData.ready)) { - log() - << "Expected background index build did not complete, rebuilding. Collection: " - << coll << " Index: " << indexName; + if (!serverGlobalParams.indexBuildRetry) { + log() << "Dropping an unfinished index because --noIndexBuildRetry is set. " + "Collection: " + << coll << " Index: " << indexName; + fassert(51197, _engine->dropIdent(opCtx, indexIdent)); + indexesToDrop.push_back(indexName); + continue; + } + + log() << "Expected background index build did not complete, rebuilding. " + "Collection: " + << coll << " Index: " << indexName; ret.emplace_back(coll.ns(), indexName); continue; } |