summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2017-04-20 22:42:11 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2017-04-20 22:42:11 -0400
commite4f20f24ddbb9cea2255df6fe0cfd34ddeb0263e (patch)
tree8b73faa835f32bf5b4652f42d1223f8f002f2308
parent4680351e3fe6f8f47c04440f1c5d1232a4ab7b2d (diff)
downloadmongo-e4f20f24ddbb9cea2255df6fe0cfd34ddeb0263e.tar.gz
SERVER-26848 Remove dead code of primary catch-up.
This reverts commit fac33fe5a6814169c9c6131d80f1b325c74647da.
-rw-r--r--src/mongo/db/repl/SConscript15
-rw-r--r--src/mongo/db/repl/freshness_scanner.cpp131
-rw-r--r--src/mongo/db/repl/freshness_scanner.h117
-rw-r--r--src/mongo/db/repl/freshness_scanner_test.cpp207
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp90
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.h20
-rw-r--r--src/mongo/db/repl/replication_coordinator_test_fixture.cpp4
7 files changed, 0 insertions, 584 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 93882eb9575..cff8a229030 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -525,7 +525,6 @@ env.Library('repl_coordinator_impl',
'check_quorum_for_config_change.cpp',
'elect_cmd_runner.cpp',
'freshness_checker.cpp',
- 'freshness_scanner.cpp',
'repl_client_info.cpp',
'repl_set_config_checks.cpp',
'replication_coordinator_impl.cpp',
@@ -1328,20 +1327,6 @@ env.CppUnitTest(
],
)
-
-env.CppUnitTest(
- target='freshness_scanner_test',
- source=[
- 'freshness_scanner_test.cpp',
- ],
- LIBDEPS=[
- 'repl_coordinator_impl',
- 'replica_set_messages',
- 'replmocks',
- '$BUILD_DIR/mongo/executor/thread_pool_task_executor_test_fixture',
- ],
-)
-
env.Library(
target="serveronly",
source=[
diff --git a/src/mongo/db/repl/freshness_scanner.cpp b/src/mongo/db/repl/freshness_scanner.cpp
deleted file mode 100644
index ec5e4b866b4..00000000000
--- a/src/mongo/db/repl/freshness_scanner.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Copyright 2016 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kReplication
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/repl/freshness_scanner.h"
-
-#include "mongo/base/status.h"
-#include "mongo/db/repl/bson_extract_optime.h"
-#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/scatter_gather_runner.h"
-#include "mongo/executor/task_executor.h"
-#include "mongo/rpc/get_status_from_command_result.h"
-#include "mongo/util/log.h"
-
-namespace mongo {
-namespace repl {
-
-using executor::RemoteCommandRequest;
-using executor::RemoteCommandResponse;
-
-FreshnessScanner::Algorithm::Algorithm(const ReplSetConfig& rsConfig,
- int myIndex,
- Milliseconds timeout)
- : _rsConfig(rsConfig), _myIndex(myIndex), _timeout(timeout) {
- for (int index = 0; index < _rsConfig.getNumMembers(); index++) {
- if (index != _myIndex) {
- _targets.push_back(_rsConfig.getMemberAt(index).getHostAndPort());
- }
- }
- _totalRequests = _targets.size();
-}
-
-std::vector<RemoteCommandRequest> FreshnessScanner::Algorithm::getRequests() const {
- BSONObjBuilder cmdBuilder;
- cmdBuilder << "replSetGetStatus" << 1;
- const BSONObj getStatusCmd = cmdBuilder.obj();
-
- std::vector<RemoteCommandRequest> requests;
- for (auto& target : _targets) {
- requests.push_back(RemoteCommandRequest(target, "admin", getStatusCmd, nullptr, _timeout));
- }
- return requests;
-}
-
-void FreshnessScanner::Algorithm::processResponse(const RemoteCommandRequest& request,
- const RemoteCommandResponse& response) {
- _responsesProcessed++;
- if (!response.isOK()) { // failed response
- LOG(2) << "FreshnessScanner: Got failed response from " << request.target << ": "
- << response.status;
- } else {
- BSONObj opTimesObj = response.data.getObjectField("optimes");
- OpTime lastOpTime;
- Status status = bsonExtractOpTimeField(opTimesObj, "appliedOpTime", &lastOpTime);
- if (!status.isOK()) {
- LOG(2) << "FreshnessScanner: failed to parse opTime in " << opTimesObj << " from "
- << request.target << causedBy(status);
- return;
- }
-
- int index = _rsConfig.findMemberIndexByHostAndPort(request.target);
- FreshnessInfo freshnessInfo{index, lastOpTime};
-
- auto cmp = [](const FreshnessInfo& a, const FreshnessInfo& b) {
- return a.opTime > b.opTime;
- };
- auto iter =
- std::upper_bound(_freshnessInfos.begin(), _freshnessInfos.end(), freshnessInfo, cmp);
- _freshnessInfos.insert(iter, freshnessInfo);
- LOG(2) << "FreshnessScanner: processed response " << opTimesObj << " from "
- << request.target;
- }
-}
-
-bool FreshnessScanner::Algorithm::hasReceivedSufficientResponses() const {
- return _responsesProcessed == _totalRequests;
-}
-
-FreshnessScanner::Result FreshnessScanner::Algorithm::getResult() const {
- invariant(hasReceivedSufficientResponses());
- return _freshnessInfos;
-}
-
-StatusWith<executor::TaskExecutor::EventHandle> FreshnessScanner::start(
- executor::TaskExecutor* executor,
- const ReplSetConfig& rsConfig,
- int myIndex,
- Milliseconds timeout) {
- _algorithm.reset(new Algorithm(rsConfig, myIndex, timeout));
- _runner.reset(new ScatterGatherRunner(_algorithm.get(), executor));
- return _runner->start();
-}
-
-void FreshnessScanner::cancel() {
- _runner->cancel();
-}
-
-FreshnessScanner::Result FreshnessScanner::getResult() const {
- return _algorithm->getResult();
-}
-
-} // namespace repl
-} // namespace mongo
diff --git a/src/mongo/db/repl/freshness_scanner.h b/src/mongo/db/repl/freshness_scanner.h
deleted file mode 100644
index 69e6cccf27b..00000000000
--- a/src/mongo/db/repl/freshness_scanner.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Copyright (C) 2016 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#pragma once
-
-#include <memory>
-#include <vector>
-
-#include "mongo/base/disallow_copying.h"
-#include "mongo/bson/timestamp.h"
-#include "mongo/db/repl/optime.h"
-#include "mongo/db/repl/repl_set_config.h"
-#include "mongo/db/repl/scatter_gather_algorithm.h"
-#include "mongo/db/repl/scatter_gather_runner.h"
-#include "mongo/executor/task_executor.h"
-#include "mongo/stdx/functional.h"
-
-namespace mongo {
-
-class Status;
-
-namespace repl {
-
-class ScatterGatherRunner;
-
-class FreshnessScanner {
- MONGO_DISALLOW_COPYING(FreshnessScanner);
-
-public:
- struct FreshnessInfo {
- // The index of node in ReplSetConfig.
- int index;
- // The latest applied opTime on that node.
- OpTime opTime;
- };
-
- using Result = std::vector<FreshnessInfo>;
-
- class Algorithm : public ScatterGatherAlgorithm {
- public:
- Algorithm(const ReplSetConfig& rsConfig, int myIndex, Milliseconds timeout);
- virtual std::vector<executor::RemoteCommandRequest> getRequests() const;
- virtual void processResponse(const executor::RemoteCommandRequest& request,
- const executor::RemoteCommandResponse& response);
- virtual bool hasReceivedSufficientResponses() const;
-
- /**
- * Returns a sorted list of nodes in descending lastAppliedOptime order.
- *
- * It is invalid to call this before hasReceivedSufficientResponses returns true.
- */
- Result getResult() const;
-
- private:
- const ReplSetConfig _rsConfig;
- std::vector<HostAndPort> _targets;
- const int _myIndex;
- const Milliseconds _timeout;
- Result _freshnessInfos;
- int _responsesProcessed = 0;
- int _totalRequests = 0;
- };
-
- FreshnessScanner() = default;
- virtual ~FreshnessScanner() = default;
-
- /**
- * Begins the process of sending replSetGetFreshness commands to all nodes
- * in currentConfig, in attempt to find the most up-to-date oplog.
- *
- * evh can be used to schedule a callback when the process is complete.
- * If this function returns Status::OK(), evh is then guaranteed to be signaled.
- **/
- StatusWith<executor::TaskExecutor::EventHandle> start(executor::TaskExecutor* executor,
- const ReplSetConfig& rsConfig,
- int myIndex,
- Milliseconds timeout);
-
- /**
- * Informs the FreshnessScanner to cancel further processing.
- */
- void cancel();
-
- Result getResult() const;
-
-private:
- std::unique_ptr<Algorithm> _algorithm;
- std::unique_ptr<ScatterGatherRunner> _runner;
-};
-
-} // namespace repl
-} // namespace mongo
diff --git a/src/mongo/db/repl/freshness_scanner_test.cpp b/src/mongo/db/repl/freshness_scanner_test.cpp
deleted file mode 100644
index cf9c7dbc709..00000000000
--- a/src/mongo/db/repl/freshness_scanner_test.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/**
- * Copyright (C) 2016 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/base/status.h"
-#include "mongo/db/jsobj.h"
-#include "mongo/db/repl/freshness_scanner.h"
-#include "mongo/db/repl/replication_coordinator_impl.h"
-#include "mongo/executor/network_interface_mock.h"
-#include "mongo/executor/thread_pool_task_executor_test_fixture.h"
-#include "mongo/stdx/functional.h"
-#include "mongo/stdx/memory.h"
-#include "mongo/stdx/thread.h"
-#include "mongo/unittest/unittest.h"
-
-namespace mongo {
-namespace repl {
-namespace {
-
-using executor::NetworkInterfaceMock;
-using executor::RemoteCommandRequest;
-using executor::RemoteCommandResponse;
-using unittest::assertGet;
-
-class FreshnessScannerTest : public executor::ThreadPoolExecutorTest {
-public:
- virtual void setUp() {
- executor::ThreadPoolExecutorTest::setUp();
- launchExecutorThread();
- ASSERT_OK(_config.initialize(BSON("_id"
- << "rs0"
- << "version"
- << 1
- << "members"
- << BSON_ARRAY(BSON("_id" << 0 << "host"
- << "host0")
- << BSON("_id" << 1 << "host"
- << "host1")
- << BSON("_id" << 2 << "host"
- << "host2")
- << BSON("_id" << 3 << "host"
- << "host3"
- << "votes"
- << 0
- << "priority"
- << 0)
- << BSON("_id" << 4 << "host"
- << "host4"
- << "votes"
- << 0
- << "priority"
- << 0)))));
- ASSERT_OK(_config.validate());
- }
-
-protected:
- RemoteCommandRequest requestFrom(std::string hostname) {
- return RemoteCommandRequest(HostAndPort(hostname),
- "", // fields do not matter in FreshnessScanner
- BSONObj(),
- nullptr,
- Milliseconds(0));
- }
-
- RemoteCommandResponse makeRemoteCommandResponse(BSONObj response) {
- return RemoteCommandResponse(
- NetworkInterfaceMock::Response(response, BSONObj(), Milliseconds(10)));
- }
-
- RemoteCommandResponse badRemoteCommandResponse() {
- return RemoteCommandResponse(ErrorCodes::NodeNotFound, "not on my watch");
- }
-
- RemoteCommandResponse goodRemoteCommandResponse(Timestamp timestamp, long long term) {
- // OpTime part of replSetGetStatus.
- BSONObj response =
- BSON("optimes" << BSON("appliedOpTime" << OpTime(timestamp, term).toBSON()));
- return makeRemoteCommandResponse(response);
- }
-
- ReplSetConfig _config;
-};
-
-TEST_F(FreshnessScannerTest, ImmediateGoodResponse) {
- FreshnessScanner::Algorithm algo(_config, 0, Milliseconds(2000));
-
- ASSERT_FALSE(algo.hasReceivedSufficientResponses());
- algo.processResponse(requestFrom("host1"), goodRemoteCommandResponse(Timestamp(1, 100), 1));
- ASSERT_FALSE(algo.hasReceivedSufficientResponses());
- algo.processResponse(requestFrom("host2"), goodRemoteCommandResponse(Timestamp(1, 200), 1));
- ASSERT_FALSE(algo.hasReceivedSufficientResponses());
- algo.processResponse(requestFrom("host3"), goodRemoteCommandResponse(Timestamp(1, 400), 1));
- ASSERT_FALSE(algo.hasReceivedSufficientResponses());
- algo.processResponse(requestFrom("host4"), goodRemoteCommandResponse(Timestamp(1, 300), 1));
- ASSERT_TRUE(algo.hasReceivedSufficientResponses());
- ASSERT_EQUALS((size_t)4, algo.getResult().size());
- ASSERT_EQUALS(3, algo.getResult().front().index);
- ASSERT_EQUALS(OpTime(Timestamp(1, 400), 1), algo.getResult().front().opTime);
- ASSERT_EQUALS(1, algo.getResult().back().index);
- ASSERT_EQUALS(OpTime(Timestamp(1, 100), 1), algo.getResult().back().opTime);
-}
-
-TEST_F(FreshnessScannerTest, ImmediateBadResponse) {
- FreshnessScanner::Algorithm algo(_config, 0, Milliseconds(2000));
-
- // Cannot access host 1 and host 2.
- ASSERT_FALSE(algo.hasReceivedSufficientResponses());
- algo.processResponse(requestFrom("host1"), badRemoteCommandResponse());
- ASSERT_FALSE(algo.hasReceivedSufficientResponses());
- algo.processResponse(requestFrom("host2"), badRemoteCommandResponse());
- ASSERT_FALSE(algo.hasReceivedSufficientResponses());
-
- // host 3 is in an old version, which doesn't include OpTimes in the response.
- algo.processResponse(requestFrom("host3"), makeRemoteCommandResponse(BSONObj()));
- ASSERT_FALSE(algo.hasReceivedSufficientResponses());
-
- // Responses from host 4 in PV0 are considered as bad responses.
- auto response4 = BSON("optimes" << BSON("appliedOpTime" << Timestamp(1, 300)));
- algo.processResponse(requestFrom("host4"), makeRemoteCommandResponse(response4));
- ASSERT_TRUE(algo.hasReceivedSufficientResponses());
- ASSERT_EQUALS((size_t)0, algo.getResult().size());
-}
-
-TEST_F(FreshnessScannerTest, AllResponsesTimeout) {
- Milliseconds timeout(2000);
- FreshnessScanner scanner;
- scanner.start(&getExecutor(), _config, 0, timeout);
-
- auto net = getNet();
- net->enterNetwork();
- ASSERT(net->hasReadyRequests());
- // Black hole all requests.
- while (net->hasReadyRequests()) {
- net->blackHole(net->getNextReadyRequest());
- }
- auto later = net->now() + Milliseconds(2010);
- ASSERT_EQ(later, net->runUntil(later));
- net->exitNetwork();
- ASSERT_EQUALS((size_t)0, scanner.getResult().size());
-}
-
-
-TEST_F(FreshnessScannerTest, BadResponsesAndTimeout) {
- Milliseconds timeout(2000);
- FreshnessScanner scanner;
- scanner.start(&getExecutor(), _config, 0, timeout);
-
- auto net = getNet();
- net->enterNetwork();
-
- Date_t later = net->now() + Milliseconds(10);
- // host 1 returns good response.
- ASSERT(net->hasReadyRequests());
- auto noi = net->getNextReadyRequest();
- HostAndPort successfulHost = noi->getRequest().target;
- net->scheduleResponse(noi, later, goodRemoteCommandResponse(Timestamp(1, 100), 1));
-
- // host 2 has a bad connection.
- ASSERT(net->hasReadyRequests());
- net->scheduleResponse(net->getNextReadyRequest(), later, badRemoteCommandResponse());
-
- // host 3 and 4 time out.
- ASSERT(net->hasReadyRequests());
- net->blackHole(net->getNextReadyRequest());
- ASSERT(net->hasReadyRequests());
- net->blackHole(net->getNextReadyRequest());
-
- // Advance the clock.
- ASSERT(!net->hasReadyRequests());
- getNet()->runUntil(getNet()->now() + Milliseconds(2010));
- getNet()->exitNetwork();
-
- ASSERT_EQUALS((size_t)1, scanner.getResult().size());
- auto freshnessInfo = scanner.getResult().front();
- ASSERT_EQUALS(_config.findMemberIndexByHostAndPort(successfulHost), freshnessInfo.index);
- ASSERT_EQUALS(OpTime(Timestamp(1, 100), 1), freshnessInfo.opTime);
-}
-
-} // namespace
-} // namespace repl
-} // namespace mongo
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 301f2c92c7c..e5a0d5bf393 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -48,7 +48,6 @@
#include "mongo/db/repl/data_replicator_external_state_initial_sync.h"
#include "mongo/db/repl/elect_cmd_runner.h"
#include "mongo/db/repl/freshness_checker.h"
-#include "mongo/db/repl/freshness_scanner.h"
#include "mongo/db/repl/handshake_args.h"
#include "mongo/db/repl/is_master_response.h"
#include "mongo/db/repl/last_vote.h"
@@ -2893,87 +2892,6 @@ Status ReplicationCoordinatorImpl::abortCatchupIfNeeded() {
return Status(ErrorCodes::IllegalOperation, "The node is not in catch-up mode.");
}
-void ReplicationCoordinatorImpl::_scanOpTimeForCatchUp_inlock() {
- auto scanner = std::make_shared<FreshnessScanner>();
- auto scanStartTime = _replExecutor->now();
- auto evhStatus = scanner->start(
- _replExecutor.get(), _rsConfig, _selfIndex, _rsConfig.getCatchUpTimeoutPeriod());
- if (evhStatus == ErrorCodes::ShutdownInProgress) {
- _enterDrainMode_inlock();
- return;
- }
- fassertStatusOK(40254, evhStatus.getStatus());
- long long term = _topCoord->getTerm();
- _replExecutor->onEvent(
- evhStatus.getValue(), [this, scanner, scanStartTime, term](const CallbackArgs& cbData) {
- stdx::lock_guard<stdx::mutex> lk(_mutex);
- if (cbData.status == ErrorCodes::CallbackCanceled) {
- _enterDrainMode_inlock();
- return;
- }
- auto totalTimeout = _rsConfig.getCatchUpTimeoutPeriod();
- auto catchUpTimeout = totalTimeout - (_replExecutor->now() - scanStartTime);
- _catchUpOplogToLatest_inlock(*scanner, catchUpTimeout, term);
- });
-}
-
-void ReplicationCoordinatorImpl::_catchUpOplogToLatest_inlock(const FreshnessScanner& scanner,
- Milliseconds timeout,
- long long originalTerm) {
- // On stepping down, the node doesn't update its term immediately due to SERVER-21425.
- // Term is also checked in case the catchup timeout is so long that the node becomes primary
- // again.
- if (!_memberState.primary() || originalTerm != _topCoord->getTerm()) {
- // If the node steps down during the catch-up, we don't go into drain mode.
- log() << "Stopped transition to primary of term " << originalTerm
- << " because I've already stepped down.";
- return;
- }
-
- auto result = scanner.getResult();
-
- // Cannot access any nodes within timeout.
- if (result.size() == 0) {
- log() << "Could not access any nodes within timeout when checking for "
- << "additional ops to apply before finishing transition to primary. "
- << "Will move forward with becoming primary anyway.";
- _enterDrainMode_inlock();
- return;
- }
-
- // I'm most up-to-date as far as I know.
- auto freshnessInfo = result.front();
- if (freshnessInfo.opTime <= _getMyLastAppliedOpTime_inlock()) {
- log() << "My optime is most up-to-date, skipping catch-up "
- << "and completing transition to primary.";
- _enterDrainMode_inlock();
- return;
- }
-
- // Wait for the replication level to reach the latest opTime within timeout.
- auto latestOpTime = freshnessInfo.opTime;
- auto finishCB = [this, latestOpTime]() {
- if (latestOpTime > _getMyLastAppliedOpTime_inlock()) {
- log() << "Cannot catch up oplog after becoming primary.";
- } else {
- log() << "Finished catch-up oplog after becoming primary.";
- }
-
- _enterDrainMode_inlock();
- };
- auto waiterInfo = std::make_shared<CallbackWaiter>(freshnessInfo.opTime, finishCB);
-
- _opTimeWaiterList.add_inlock(waiterInfo.get());
- auto timeoutCB = [this, waiterInfo, finishCB](const CallbackArgs& cbData) {
- stdx::lock_guard<stdx::mutex> lk(_mutex);
- if (_opTimeWaiterList.remove_inlock(waiterInfo.get())) {
- finishCB();
- }
- };
- // Schedule the timeout callback. It may signal after we have already caught up.
- _replExecutor->scheduleWorkAt(_replExecutor->now() + timeout, timeoutCB);
-}
-
void ReplicationCoordinatorImpl::_enterDrainMode_inlock() {
_applierState = ApplierState::Draining;
_externalState->stopProducer();
@@ -3824,14 +3742,6 @@ EventHandle ReplicationCoordinatorImpl::_makeEvent() {
return eventResult.getValue();
}
-void ReplicationCoordinatorImpl::_scheduleElectionWinNotification_inlock() {
- if (!_getMemberState_inlock().primary()) {
- return;
- }
-
- _restartHeartbeats_inlock();
-}
-
WriteConcernOptions ReplicationCoordinatorImpl::populateUnsetWriteConcernOptionsSyncMode(
WriteConcernOptions wc) {
diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h
index 404bf0e16b9..dd63317fd62 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.h
+++ b/src/mongo/db/repl/replication_coordinator_impl.h
@@ -74,7 +74,6 @@ namespace repl {
class ElectCmdRunner;
class FreshnessChecker;
-class FreshnessScanner;
class HandshakeArgs;
class HeartbeatResponseAction;
class LastVote;
@@ -1220,31 +1219,12 @@ private:
EventHandle _makeEvent();
/**
- * Schedule notification of election win.
- */
- void _scheduleElectionWinNotification_inlock();
-
- /**
* Wrap a function into executor callback.
* If the callback is cancelled, the given function won't run.
*/
executor::TaskExecutor::CallbackFn _wrapAsCallbackFn(const stdx::function<void()>& work);
/**
- * Scan all nodes to find out the the latest optime in the replset, thus we know when there's no
- * more to catch up before the timeout. It also schedules the actual catch-up once we get the
- * response from the freshness scan.
- */
- void _scanOpTimeForCatchUp_inlock();
- /**
- * Wait for data replication until we reach the latest optime, or the timeout expires.
- * "originalTerm" is the term when catch-up work is scheduled and used to detect
- * the step-down (and potential following step-up) after catch-up gets scheduled.
- */
- void _catchUpOplogToLatest_inlock(const FreshnessScanner& scanner,
- Milliseconds timeout,
- long long originalTerm);
- /**
* Finish catch-up mode and start drain mode.
*/
void _enterDrainMode_inlock();
diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
index aaa00fcdae4..1e4f9267ae5 100644
--- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
+++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp
@@ -338,10 +338,6 @@ void ReplCoordTest::simulateSuccessfulV1ElectionAt(Date_t electionTime) {
<< request.cmdObj["term"].Long()
<< "voteGranted"
<< true)));
- } else if (request.cmdObj.firstElement().fieldNameStringData() == "replSetGetStatus") {
- // OpTime part of replSetGetStatus for use by FreshnessScanner during catch-up period.
- BSONObj response = BSON("optimes" << BSON("appliedOpTime" << OpTime().toBSON()));
- net->scheduleResponse(noi, net->now(), makeResponseStatus(response));
} else {
error() << "Black holing unexpected request to " << request.target << ": "
<< request.cmdObj;