diff options
author | Haley Connelly <haley.connelly@10gen.com> | 2019-10-22 20:36:43 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-22 20:36:43 +0000 |
commit | 604cc100d1e12422aa3243385bc994651e0e19d2 (patch) | |
tree | 13cfb3ebe091de7f06477d89a3a8b990cd153202 | |
parent | 75ae384743271ffeccbf5719475008029295785f (diff) | |
download | mongo-604cc100d1e12422aa3243385bc994651e0e19d2.tar.gz |
SERVER-43184 Remove unused ReplicationCoordinator methods and members
-rw-r--r-- | src/mongo/db/repl/replication_coordinator.h | 18 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 24 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.h | 26 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_mock.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_mock.h | 7 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_noop.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_noop.h | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/topology_coordinator.cpp | 18 | ||||
-rw-r--r-- | src/mongo/db/repl/topology_coordinator.h | 8 | ||||
-rw-r--r-- | src/mongo/embedded/replication_coordinator_embedded.cpp | 10 | ||||
-rw-r--r-- | src/mongo/embedded/replication_coordinator_embedded.h | 6 |
11 files changed, 1 insertions, 142 deletions
diff --git a/src/mongo/db/repl/replication_coordinator.h b/src/mongo/db/repl/replication_coordinator.h index 07b54534dfa..8c680cbc7b7 100644 --- a/src/mongo/db/repl/replication_coordinator.h +++ b/src/mongo/db/repl/replication_coordinator.h @@ -279,17 +279,6 @@ public: const CommitQuorumOptions& commitQuorum) const = 0; /** - * Checks if the 'commitQuorum' has been satisfied by the 'commitReadyMembers', if it has been - * satisfied, return true. - * - * Prior to checking if the 'commitQuorum' is satisfied by 'commitReadyMembers', it calls - * 'checkIfCommitQuorumCanBeSatisfied()' with all the replica set members. - */ - virtual StatusWith<bool> checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const = 0; - - /** * Returns Status::OK() if it is valid for this node to serve reads on the given collection * and an errorcode indicating why the node cannot if it cannot. */ @@ -846,13 +835,6 @@ public: virtual void appendConnectionStats(executor::ConnectionPoolStats* stats) const = 0; /** - * Gets the number of uncommitted snapshots currently held. - * Warning: This value can change at any time and may not even be accurate at the time of - * return. It should not be used when an exact amount is needed. - */ - virtual size_t getNumUncommittedSnapshots() = 0; - - /** * Creates a waiter that waits for w:majority write concern to be satisfied up to opTime before * setting the 'wMajorityWriteAvailabilityDate' election candidate metric. */ diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 9e3df9807c3..3f9dc990ec8 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -401,10 +401,6 @@ OpTimeAndWallTime ReplicationCoordinatorImpl::_getCurrentCommittedSnapshotOpTime return OpTimeAndWallTime(); } -LogicalTime ReplicationCoordinatorImpl::_getCurrentCommittedLogicalTime_inlock() const { - return LogicalTime(_getCurrentCommittedSnapshotOpTime_inlock().getTimestamp()); -} - void ReplicationCoordinatorImpl::appendDiagnosticBSON(mongo::BSONObjBuilder* bob) { BSONObjBuilder eBuilder(bob->subobjStart("executor")); _replExecutor->appendDiagnosticBSON(&eBuilder); @@ -3405,22 +3401,6 @@ Status ReplicationCoordinatorImpl::_checkIfCommitQuorumCanBeSatisfied( return Status::OK(); } -StatusWith<bool> ReplicationCoordinatorImpl::checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const { - // If the 'commitQuorum' cannot be satisfied with all the members of this replica set, we - // need to inform the caller to avoid hanging while waiting for satisfiability of the - // 'commitQuorum' with 'commitReadyMembers' due to replica set reconfigurations. - stdx::lock_guard<Latch> lock(_mutex); - Status status = _checkIfCommitQuorumCanBeSatisfied(lock, commitQuorum); - if (!status.isOK()) { - return status; - } - - // Return whether or not the 'commitQuorum' is satisfied by the 'commitReadyMembers'. - return _topCoord->checkIfCommitQuorumIsSatisfied(commitQuorum, commitReadyMembers); -} - WriteConcernOptions ReplicationCoordinatorImpl::getGetLastErrorDefault() { stdx::lock_guard<Latch> lock(_mutex); if (_rsConfig.isInitialized()) { @@ -4017,10 +3997,6 @@ void ReplicationCoordinatorImpl::waitUntilSnapshotCommitted(OperationContext* op }); } -size_t ReplicationCoordinatorImpl::getNumUncommittedSnapshots() { - return _uncommittedSnapshotsSize.load(); -} - void ReplicationCoordinatorImpl::createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) { stdx::lock_guard<Latch> lk(_mutex); diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index 529ce2335fd..b8ca6a8a262 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -149,10 +149,6 @@ public: virtual Status checkIfCommitQuorumCanBeSatisfied( const CommitQuorumOptions& commitQuorum) const override; - virtual StatusWith<bool> checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const override; - virtual Status checkCanServeReadsFor(OperationContext* opCtx, const NamespaceString& ns, bool slaveOk); @@ -316,8 +312,6 @@ public: virtual void appendConnectionStats(executor::ConnectionPoolStats* stats) const override; - virtual size_t getNumUncommittedSnapshots() override; - virtual void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) override; virtual WriteConcernOptions populateUnsetWriteConcernOptionsSyncMode( @@ -746,11 +740,6 @@ private: OpTimeAndWallTime _getCurrentCommittedSnapshotOpTimeAndWallTime_inlock() const; /** - * Returns the OpTime of the current committed snapshot converted to LogicalTime. - */ - LogicalTime _getCurrentCommittedLogicalTime_inlock() const; - - /** * Verifies that ReadConcernArgs match node's readConcern. */ Status _validateReadConcern(OperationContext* opCtx, const ReadConcernArgs& readConcern); @@ -813,8 +802,6 @@ private: Status _checkIfCommitQuorumCanBeSatisfied(WithLock, const CommitQuorumOptions& commitQuorum) const; - bool _canAcceptWritesFor_inlock(const NamespaceString& ns); - int _getMyId_inlock() const; OpTime _getMyLastAppliedOpTime_inlock() const; @@ -1437,20 +1424,9 @@ private: std::shared_ptr<InitialSyncer> _initialSyncer; // (I) pointer set under mutex, copied by callers. - // Hands out the next snapshot name. - AtomicWord<unsigned long long> _snapshotNameGenerator; // (S) - - // The OpTimes and SnapshotNames for all snapshots newer than the current commit point, kept in - // sorted order. Any time this is changed, you must also update _uncommitedSnapshotsSize. - std::deque<OpTime> _uncommittedSnapshots; // (M) - - // A cache of the size of _uncommittedSnaphots that can be read without any locking. - // May only be written to while holding _mutex. - AtomicWord<unsigned long long> _uncommittedSnapshotsSize; // (I) - // The non-null OpTimeAndWallTime and SnapshotName of the current snapshot used for committed // reads, if there is one. - // When engaged, this must be <= _lastCommittedOpTime and < _uncommittedSnapshots.front(). + // When engaged, this must be <= _lastCommittedOpTime. boost::optional<OpTimeAndWallTime> _currentCommittedSnapshot; // (M) // A set of optimes that are used for computing the replication system's current 'stable' diff --git a/src/mongo/db/repl/replication_coordinator_mock.cpp b/src/mongo/db/repl/replication_coordinator_mock.cpp index c3a6135807c..1e0f01ec424 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.cpp +++ b/src/mongo/db/repl/replication_coordinator_mock.cpp @@ -419,12 +419,6 @@ Status ReplicationCoordinatorMock::checkIfCommitQuorumCanBeSatisfied( return Status::OK(); } -StatusWith<bool> ReplicationCoordinatorMock::checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const { - return true; -} - WriteConcernOptions ReplicationCoordinatorMock::getGetLastErrorDefault() { return WriteConcernOptions(); } @@ -505,10 +499,6 @@ OpTimeAndWallTime ReplicationCoordinatorMock::getCurrentCommittedSnapshotOpTimeA void ReplicationCoordinatorMock::waitUntilSnapshotCommitted(OperationContext* opCtx, const Timestamp& untilSnapshot) {} -size_t ReplicationCoordinatorMock::getNumUncommittedSnapshots() { - return 0; -} - void ReplicationCoordinatorMock::createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) { return; } diff --git a/src/mongo/db/repl/replication_coordinator_mock.h b/src/mongo/db/repl/replication_coordinator_mock.h index b857547662e..b4212717020 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.h +++ b/src/mongo/db/repl/replication_coordinator_mock.h @@ -116,10 +116,6 @@ public: virtual Status checkIfCommitQuorumCanBeSatisfied(const CommitQuorumOptions& commitQuorum) const; - virtual StatusWith<bool> checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const; - virtual Status checkCanServeReadsFor(OperationContext* opCtx, const NamespaceString& ns, bool slaveOk); @@ -273,8 +269,6 @@ public: virtual void waitUntilSnapshotCommitted(OperationContext* opCtx, const Timestamp& untilSnapshot) override; - virtual size_t getNumUncommittedSnapshots() override; - virtual void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) override; virtual WriteConcernOptions populateUnsetWriteConcernOptionsSyncMode( @@ -327,7 +321,6 @@ public: virtual void setCanAcceptNonLocalWrites(bool canAcceptNonLocalWrites); private: - AtomicWord<unsigned long long> _snapshotNameGenerator; ServiceContext* const _service; ReplSettings _settings; StorageInterface* _storage = nullptr; diff --git a/src/mongo/db/repl/replication_coordinator_noop.cpp b/src/mongo/db/repl/replication_coordinator_noop.cpp index cde97b7c3d9..f55967a2ed5 100644 --- a/src/mongo/db/repl/replication_coordinator_noop.cpp +++ b/src/mongo/db/repl/replication_coordinator_noop.cpp @@ -361,12 +361,6 @@ Status ReplicationCoordinatorNoOp::checkIfCommitQuorumCanBeSatisfied( MONGO_UNREACHABLE; } -StatusWith<bool> ReplicationCoordinatorNoOp::checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const { - MONGO_UNREACHABLE; -} - Status ReplicationCoordinatorNoOp::checkReplEnabledForCommand(BSONObjBuilder*) { return Status(ErrorCodes::NoReplicationEnabled, "no replication on embedded"); } @@ -434,10 +428,6 @@ void ReplicationCoordinatorNoOp::waitUntilSnapshotCommitted(OperationContext*, c MONGO_UNREACHABLE; } -size_t ReplicationCoordinatorNoOp::getNumUncommittedSnapshots() { - MONGO_UNREACHABLE; -} - void ReplicationCoordinatorNoOp::createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/repl/replication_coordinator_noop.h b/src/mongo/db/repl/replication_coordinator_noop.h index 961f72bff02..e84935639e6 100644 --- a/src/mongo/db/repl/replication_coordinator_noop.h +++ b/src/mongo/db/repl/replication_coordinator_noop.h @@ -110,10 +110,6 @@ public: Status checkIfCommitQuorumCanBeSatisfied(const CommitQuorumOptions& commitQuorum) const final; - StatusWith<bool> checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const final; - void setMyLastAppliedOpTimeAndWallTime(const OpTimeAndWallTime& opTimeAndWallTime) final; void setMyLastDurableOpTimeAndWallTime(const OpTimeAndWallTime& opTimeAndWallTime) final; void setMyLastAppliedOpTimeAndWallTimeForward(const OpTimeAndWallTime& opTimeAndWallTime, @@ -237,8 +233,6 @@ public: void appendConnectionStats(executor::ConnectionPoolStats* stats) const final; - size_t getNumUncommittedSnapshots() final; - virtual void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) final; Status stepUpIfEligible(bool skipDryRun) final; diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp index 41593036ad2..43a448789f6 100644 --- a/src/mongo/db/repl/topology_coordinator.cpp +++ b/src/mongo/db/repl/topology_coordinator.cpp @@ -2957,23 +2957,5 @@ bool TopologyCoordinator::checkIfCommitQuorumCanBeSatisfied( } } -bool TopologyCoordinator::checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const { - std::vector<MemberConfig> commitReadyMemberConfigs; - for (auto& commitReadyMember : commitReadyMembers) { - const MemberConfig* memberConfig = _rsConfig.findMemberByHostAndPort(commitReadyMember); - - invariant(memberConfig); - commitReadyMemberConfigs.push_back(*memberConfig); - } - - // Calling this with commit ready members only is the same as checking if the commit quorum is - // satisfied. Because the 'commitQuorum' is based on the participation of all the replica set - // members, and if the 'commitQuorum' can be satisfied with all the commit ready members, then - // the commit quorum is satisfied in this replica set configuration. - return checkIfCommitQuorumCanBeSatisfied(commitQuorum, commitReadyMemberConfigs); -} - } // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/topology_coordinator.h b/src/mongo/db/repl/topology_coordinator.h index ec30a024d4b..856f1a4e85c 100644 --- a/src/mongo/db/repl/topology_coordinator.h +++ b/src/mongo/db/repl/topology_coordinator.h @@ -697,14 +697,6 @@ public: bool checkIfCommitQuorumCanBeSatisfied(const CommitQuorumOptions& commitQuorum, const std::vector<MemberConfig>& members) const; - /** - * Returns 'true' if the 'commitQuorum' is satisifed by the 'commitReadyMembers'. - * - * 'commitReadyMembers' must be part of the replica set configuration. - */ - bool checkIfCommitQuorumIsSatisfied(const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const; - //////////////////////////////////////////////////////////// // // Test support methods diff --git a/src/mongo/embedded/replication_coordinator_embedded.cpp b/src/mongo/embedded/replication_coordinator_embedded.cpp index c24d840e964..0ccbf74055a 100644 --- a/src/mongo/embedded/replication_coordinator_embedded.cpp +++ b/src/mongo/embedded/replication_coordinator_embedded.cpp @@ -386,12 +386,6 @@ Status ReplicationCoordinatorEmbedded::checkIfCommitQuorumCanBeSatisfied( UASSERT_NOT_IMPLEMENTED; } -StatusWith<bool> ReplicationCoordinatorEmbedded::checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const { - UASSERT_NOT_IMPLEMENTED; -} - Status ReplicationCoordinatorEmbedded::checkReplEnabledForCommand(BSONObjBuilder*) { return Status(ErrorCodes::NoReplicationEnabled, "no replication on embedded"); } @@ -460,10 +454,6 @@ void ReplicationCoordinatorEmbedded::waitUntilSnapshotCommitted(OperationContext UASSERT_NOT_IMPLEMENTED; } -size_t ReplicationCoordinatorEmbedded::getNumUncommittedSnapshots() { - UASSERT_NOT_IMPLEMENTED; -} - void ReplicationCoordinatorEmbedded::createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) { UASSERT_NOT_IMPLEMENTED; } diff --git a/src/mongo/embedded/replication_coordinator_embedded.h b/src/mongo/embedded/replication_coordinator_embedded.h index 883d2578962..aa7910b718e 100644 --- a/src/mongo/embedded/replication_coordinator_embedded.h +++ b/src/mongo/embedded/replication_coordinator_embedded.h @@ -112,10 +112,6 @@ public: Status checkIfCommitQuorumCanBeSatisfied( const CommitQuorumOptions& commitQuorum) const override; - StatusWith<bool> checkIfCommitQuorumIsSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector<HostAndPort>& commitReadyMembers) const override; - void setMyLastAppliedOpTimeAndWallTime( const repl::OpTimeAndWallTime& opTimeAndWallTime) override; void setMyLastDurableOpTimeAndWallTime( @@ -245,8 +241,6 @@ public: void appendConnectionStats(executor::ConnectionPoolStats* stats) const override; - size_t getNumUncommittedSnapshots() override; - virtual void createWMajorityWriteAvailabilityDateWaiter(repl::OpTime opTime) override; Status stepUpIfEligible(bool skipDryRun) override; |