diff options
author | Benety Goh <benety@mongodb.com> | 2016-09-01 15:37:26 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2016-09-01 15:37:26 -0400 |
commit | 6263265b42aa78db3b7d7fb39d4f96eab3de3ab6 (patch) | |
tree | 67ba643a0ecfef01fd0cc001979d360b68ef7e77 /src/mongo/db/repl | |
parent | 4656dd6deba18c177b90d580186f4a827414fc71 (diff) | |
download | mongo-6263265b42aa78db3b7d7fb39d4f96eab3de3ab6.tar.gz |
Revert "SERVER_25914 OplogFetcher should shutdown and join Fetcher at destruction"
This reverts commit 4656dd6deba18c177b90d580186f4a827414fc71.
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher.cpp | 15 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher.h | 11 |
2 files changed, 10 insertions, 16 deletions
diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp index 75d1022104e..f6f1e422718 100644 --- a/src/mongo/db/repl/oplog_fetcher.cpp +++ b/src/mongo/db/repl/oplog_fetcher.cpp @@ -40,7 +40,6 @@ #include "mongo/rpc/metadata/server_selection_metadata.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" -#include "mongo/util/destructor_guard.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/time_support.h" @@ -249,10 +248,6 @@ OplogFetcher::OplogFetcher(executor::TaskExecutor* exec, EnqueueDocumentsFn enqueueDocumentsFn, OnShutdownCallbackFn onShutdownCallbackFn) : _dataReplicatorExternalState(dataReplicatorExternalState), - _enqueueDocumentsFn(enqueueDocumentsFn), - _awaitDataTimeout(calculateAwaitDataTimeout(config)), - _onShutdownCallbackFn(onShutdownCallbackFn), - _lastFetched(lastFetched), _fetcher(exec, source, oplogNSS.db().toString(), @@ -260,7 +255,11 @@ OplogFetcher::OplogFetcher(executor::TaskExecutor* exec, stdx::bind( &OplogFetcher::_callback, this, stdx::placeholders::_1, stdx::placeholders::_3), uassertStatusOK(makeMetadataObject(config.getProtocolVersion() == 1LL)), - config.getElectionTimeoutPeriod()) { + config.getElectionTimeoutPeriod()), + _enqueueDocumentsFn(enqueueDocumentsFn), + _awaitDataTimeout(calculateAwaitDataTimeout(config)), + _onShutdownCallbackFn(onShutdownCallbackFn), + _lastFetched(lastFetched) { uassert(ErrorCodes::BadValue, "null last optime fetched", !lastFetched.opTime.isNull()); uassert(ErrorCodes::InvalidReplicaSetConfig, "uninitialized replica set configuration", @@ -271,10 +270,6 @@ OplogFetcher::OplogFetcher(executor::TaskExecutor* exec, readersCreatedStats.increment(); } -OplogFetcher::~OplogFetcher() { - DESTRUCTOR_GUARD(shutdown(); join();); -} - std::string OplogFetcher::toString() const { return str::stream() << "OplogReader -" << " last optime fetched: " << _lastFetched.opTime.toString() diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h index 005a9a6746e..a2bddaf266d 100644 --- a/src/mongo/db/repl/oplog_fetcher.h +++ b/src/mongo/db/repl/oplog_fetcher.h @@ -130,7 +130,7 @@ public: EnqueueDocumentsFn enqueueDocumentsFn, OnShutdownCallbackFn onShutdownCallbackFn); - virtual ~OplogFetcher(); + virtual ~OplogFetcher() = default; std::string toString() const; @@ -201,20 +201,19 @@ private: void _onShutdown(Status status); void _onShutdown(Status status, OpTimeWithHash opTimeWithHash); - // Protects member data of this OplogFetcher. - mutable stdx::mutex _mutex; - DataReplicatorExternalState* _dataReplicatorExternalState; + Fetcher _fetcher; const EnqueueDocumentsFn _enqueueDocumentsFn; const Milliseconds _awaitDataTimeout; const OnShutdownCallbackFn _onShutdownCallbackFn; + // Protects member data of this Fetcher. + mutable stdx::mutex _mutex; + // Used to validate start of first batch of results from the remote oplog // tailing query and to keep track of the last known operation consumed via // "_enqueueDocumentsFn". OpTimeWithHash _lastFetched; - - Fetcher _fetcher; }; } // namespace repl |