diff options
author | Spencer T Brody <spencer@mongodb.com> | 2017-01-17 17:06:52 -0500 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2017-01-18 18:05:33 -0500 |
commit | 21948042b6da5fb5bf15897f9808a70551f5af09 (patch) | |
tree | fbbf09efa69efefc8b14cdb4d4ff9a7260f29e74 /src | |
parent | fd6971a17400c37ea6bf6c54ef2c04c25201416d (diff) | |
download | mongo-21948042b6da5fb5bf15897f9808a70551f5af09.tar.gz |
SERVER-27680 Merge stopOplogFetcher and pauseRsBgSyncProducer failpoint into single stopReplProducer failpoint
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 23 | ||||
-rw-r--r-- | src/mongo/db/repl/data_replicator.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher.h | 2 |
4 files changed, 18 insertions, 19 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 7a5a088aae5..a4943f3f8a4 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -108,8 +108,6 @@ size_t getSize(const BSONObj& o) { } } // namespace -MONGO_FP_DECLARE(pauseRsBgSyncProducer); - // Failpoint which causes rollback to hang before starting. MONGO_FP_DECLARE(rollbackHangBeforeStart); @@ -259,12 +257,19 @@ void BackgroundSync::_runProducer() { } void BackgroundSync::_produce(OperationContext* txn) { + if (MONGO_FAIL_POINT(stopReplProducer)) { + // This log output is used in js tests so please leave it. + log() << "bgsync - stopReplProducer fail point " + "enabled. Blocking until fail point is disabled."; - while (MONGO_FAIL_POINT(pauseRsBgSyncProducer)) { - if (inShutdown()) { - return; - } - sleepmillis(10); + // TODO(SERVER-27120): Remove the return statement and uncomment the while loop. + // Currently we cannot block here or we prevent primaries from being fully elected since + // we'll never call _signalNoNewDataForApplier. + // while (MONGO_FAIL_POINT(stopReplProducer) && !inShutdown()) { + // mongo::sleepsecs(1); + // } + mongo::sleepsecs(1); + return; } // this oplog reader does not do a handshake because we don't want the server it's syncing @@ -383,10 +388,6 @@ void BackgroundSync::_produce(OperationContext* txn) { StorageInterface::get(txn)->setAppliedThrough(txn, _replCoord->getMyLastAppliedOpTime()); } - if (MONGO_FAIL_POINT(stopOplogFetcher)) { - return; - } - // "lastFetched" not used. Already set in _enqueueDocuments. Status fetcherReturnStatus = Status::OK(); DataReplicatorExternalStateBackgroundSync dataReplicatorExternalState( diff --git a/src/mongo/db/repl/data_replicator.cpp b/src/mongo/db/repl/data_replicator.cpp index dcc4dac0a49..5282b4c5687 100644 --- a/src/mongo/db/repl/data_replicator.cpp +++ b/src/mongo/db/repl/data_replicator.cpp @@ -753,7 +753,7 @@ void DataReplicator::_oplogFetcherCallback(const Status& oplogFetcherFinishStatu // It is up to the DatabasesCloner and MultiApplier to determine if they can proceed without any // additional data going into the oplog buffer. // It is not common for the OplogFetcher to return with an OK status. The only time it returns - // an OK status is when the 'stopOplogFetcher' fail point is enabled, which causes the + // an OK status is when the 'stopReplProducer' fail point is enabled, which causes the // OplogFetcher to ignore the current sync source response and return early. if (status.isOK()) { log() << "Finished fetching oplog fetching early. Last fetched optime and hash: " diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp index 0bba80369cd..f976b9ac18d 100644 --- a/src/mongo/db/repl/oplog_fetcher.cpp +++ b/src/mongo/db/repl/oplog_fetcher.cpp @@ -51,7 +51,7 @@ namespace repl { Seconds OplogFetcher::kDefaultProtocolZeroAwaitDataTimeout(2); -MONGO_FP_DECLARE(stopOplogFetcher); +MONGO_FP_DECLARE(stopReplProducer); namespace { @@ -423,12 +423,10 @@ void OplogFetcher::_callback(const Fetcher::QueryResponseStatus& result, } // Stop fetching and return on fail point. - // This fail point is intended to make the oplog fetcher ignore the downloaded batch of - // operations and not error out. - if (MONGO_FAIL_POINT(stopOplogFetcher)) { + // This fail point makes the oplog fetcher ignore the downloaded batch of operations and not + // error out. + if (MONGO_FAIL_POINT(stopReplProducer)) { _finishCallback(Status::OK()); - // Wait for a while, otherwise, it will keep busy waiting. - sleepmillis(100); return; } diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h index 987e33a1df9..0078471bf85 100644 --- a/src/mongo/db/repl/oplog_fetcher.h +++ b/src/mongo/db/repl/oplog_fetcher.h @@ -48,7 +48,7 @@ namespace mongo { namespace repl { -MONGO_FP_FORWARD_DECLARE(stopOplogFetcher); +MONGO_FP_FORWARD_DECLARE(stopReplProducer); /** * Used to keep track of the optime and hash of the last fetched operation. |