diff --git a/arangod/Agency/Constituent.cpp b/arangod/Agency/Constituent.cpp index 392d1ec488..188051643b 100644 --- a/arangod/Agency/Constituent.cpp +++ b/arangod/Agency/Constituent.cpp @@ -60,6 +60,7 @@ void Constituent::configure(Agent* agent) { if (size() == 1) { _role = LEADER; + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _role to LEADER in term " << _term; } else { _id = _agent->config().id(); } @@ -156,6 +157,7 @@ void Constituent::follow(term_t t) { _term = t; _role = FOLLOWER; + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _role to FOLLOWER in term " << _term; } /// Become leader @@ -168,7 +170,9 @@ void Constituent::lead(std::map const& votes) { } _role = LEADER; + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _role to LEADER in term " << _term; _leaderID = _id; + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _leaderID to " << _id; } if (!votes.empty()) { @@ -189,10 +193,12 @@ void Constituent::candidate() { MUTEX_LOCKER(guard, _castLock); _leaderID = NO_LEADER; + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _leaderID to " << NO_LEADER; - if (_role != CANDIDATE) - LOG_TOPIC(DEBUG, Logger::AGENCY) - << _id << ": Converted to candidate in term " << _term; + if (_role != CANDIDATE) { + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _role to CANDIDATE in term " + << _term; + } _role = CANDIDATE; } @@ -241,6 +247,8 @@ bool Constituent::vote(term_t term, std::string id, index_t prevLogIndex, lid = _leaderID; _cast = true; if (appendEntries && t <= term) { + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _leaderID to " << id + << " in term " << _term; _leaderID = id; return true; } @@ -250,6 +258,8 @@ bool Constituent::vote(term_t term, std::string id, index_t prevLogIndex, { MUTEX_LOCKER(guard, _castLock); _votedFor = id; // The guy I voted for I assume leader. + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _leaderID to " << id + << " in term " << _term; _leaderID = id; } this->term(term); @@ -276,6 +286,8 @@ void Constituent::callElection() { votes[_id] = true; // vote for myself _cast = true; _votedFor = _id; + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _leaderID to " << NO_LEADER + << " in term " << _term; _leaderID = NO_LEADER; this->term(_term + 1); // raise my term @@ -355,6 +367,8 @@ void Constituent::callElection() { void Constituent::update(std::string const& leaderID, term_t t) { MUTEX_LOCKER(guard, _castLock); + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _leaderID to " << leaderID + << " in term " << _term; _leaderID = leaderID; _term = t; } @@ -422,6 +436,8 @@ void Constituent::run() { if (size() == 1) { _leaderID = _agent->config().id(); + LOG_TOPIC(INFO, Logger::AGENCY) << "Set _leaderID to " << _leaderID + << " in term " << _term; } else { while (!this->isStopping()) { if (_role == FOLLOWER) {