diff options
author | Dianna <dianna.hohensee@10gen.com> | 2019-05-16 14:14:42 -0400 |
---|---|---|
committer | Dianna <dianna.hohensee@10gen.com> | 2019-05-22 09:22:39 -0400 |
commit | 48ea7f8532c6390cad46c0e81bbf3dee79229eab (patch) | |
tree | 40c789cffd94e9b04f936d7f1733ca38a557e0e4 /src/mongo/db/storage/kv | |
parent | 0dfca0d56a1774b6ed40d72f04b7ed3ec0cc2045 (diff) | |
download | mongo-48ea7f8532c6390cad46c0e81bbf3dee79229eab.tar.gz |
SERVER-40882 Restore the --noIndexBuildRetry server parameter flag and the storage.indexBuildRetry config file option
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; } |