diff options
author | Vincent Do <do.vincent@live.com> | 2016-04-29 13:49:41 -0400 |
---|---|---|
committer | Vincent Do <do.vincent@live.com> | 2016-05-05 11:05:36 -0400 |
commit | a97efaa18399fa43bb2a66be204c9f433e71f50b (patch) | |
tree | 33711f958b637b856cf8bbe02fba586cfb77a25f /src | |
parent | eb2636bcc2d6aed84d07dae2af34743a7863571d (diff) | |
download | mongo-a97efaa18399fa43bb2a66be204c9f433e71f50b.tar.gz |
SERVER-23510 Fix index_retry and index_no_retry to not be timing based
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/catalog/index_create.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp index 0814277262f..b18e90ac880 100644 --- a/src/mongo/db/catalog/index_create.cpp +++ b/src/mongo/db/catalog/index_create.cpp @@ -34,7 +34,6 @@ #include "mongo/db/catalog/index_create.h" - #include "mongo/base/error_codes.h" #include "mongo/client/dbclientinterface.h" #include "mongo/db/audit.h" @@ -49,9 +48,12 @@ #include "mongo/db/repl/replication_coordinator_global.h" #include "mongo/db/operation_context.h" #include "mongo/stdx/mutex.h" +#include "mongo/util/fail_point.h" +#include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/processinfo.h" #include "mongo/util/progress_meter.h" +#include "mongo/util/quick_exit.h" namespace mongo { @@ -59,6 +61,8 @@ using std::unique_ptr; using std::string; using std::endl; +MONGO_FP_DECLARE(crashAfterStartingIndexBuild); + /** * On rollback sets MultiIndexBlock::_needToCleanup to true. */ @@ -213,6 +217,17 @@ Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) { _backgroundOperation.reset(new BackgroundOperation(ns)); wunit.commit(); + + if (MONGO_FAIL_POINT(crashAfterStartingIndexBuild)) { + log() << "Index build interrupted due to 'crashAfterStartingIndexBuild' failpoint. Exiting " + "after waiting for changes to become durable."; + Locker::LockSnapshot lockInfo; + _txn->lockState()->saveLockStateAndUnlock(&lockInfo); + if (_txn->recoveryUnit()->waitUntilDurable()) { + quickExit(EXIT_TEST); + } + } + return Status::OK(); } |