diff options
Diffstat (limited to 'src/mongo/db/repl/replication_metrics.h')
-rw-r--r-- | src/mongo/db/repl/replication_metrics.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/mongo/db/repl/replication_metrics.h b/src/mongo/db/repl/replication_metrics.h index 0d8c025e18b..59d27ace445 100644 --- a/src/mongo/db/repl/replication_metrics.h +++ b/src/mongo/db/repl/replication_metrics.h @@ -83,7 +83,7 @@ public: // consistent state. void setElectionCandidateMetrics(const StartElectionReasonEnum reason, const Date_t lastElectionDate, - const long long termAtElection, + const long long electionTerm, const OpTime lastCommittedOpTime, const OpTime lastSeenOpTime, const int numVotesNeeded, @@ -91,8 +91,8 @@ public: const Milliseconds electionTimeoutMillis, const boost::optional<int> priorPrimary); void setTargetCatchupOpTime(OpTime opTime); - void setNumCatchUpOps(int numCatchUpOps); - void setNewTermStartDate(Date_t newTermStartDate); + void setNumCatchUpOps(long numCatchUpOps); + void setCandidateNewTermStartDate(Date_t newTermStartDate); void setWMajorityWriteAvailabilityDate(Date_t wMajorityWriteAvailabilityDate); boost::optional<OpTime> getTargetCatchupOpTime_forTesting(); @@ -101,6 +101,25 @@ public: BSONObj getElectionCandidateMetricsBSON(); void clearElectionCandidateMetrics(); + // Election participant metrics + + // All the election participant metrics that should be set when a node votes in an election are + // set in this one function, so that the 'electionParticipantMetrics' section of replSetStatus + // shows a consistent state. + void setElectionParticipantMetrics(const bool votedForCandidate, + const long long electionTerm, + const Date_t lastVoteDate, + const int electionCandidateMemberId, + const std::string voteReason, + const OpTime lastAppliedOpTime, + const OpTime maxAppliedOpTimeInSet, + const double priorityAtElection); + + BSONObj getElectionParticipantMetricsBSON(); + void setParticipantNewTermDates(Date_t newTermStartDate, Date_t newTermAppliedDate); + void clearParticipantNewTermDates(); + + private: class ElectionMetricsSSS; @@ -112,6 +131,7 @@ private: ElectionParticipantMetrics _electionParticipantMetrics; bool _nodeIsCandidateOrPrimary = false; + bool _nodeHasVotedInElection = false; // This field is a double so that the division result in _updateAverageCatchUpOps will be a // double without any casting. |