Minor logging improvements (#38084)

Fixes some log messages that caused some minor confusion when digging through a
log generated by a failing test.
This commit is contained in:
David Turner 2019-01-31 16:41:04 +00:00 committed by GitHub
parent e066a59c89
commit 7f738e8541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -557,8 +557,13 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery
assert Thread.holdsLock(mutex) : "Coordinator mutex not held";
assert leaderNode.isMasterNode() : leaderNode + " became a leader but is not master-eligible";
logger.debug("{}: coordinator becoming FOLLOWER of [{}] in term {} (was {}, lastKnownLeader was [{}])",
method, leaderNode, getCurrentTerm(), mode, lastKnownLeader);
if (mode == Mode.FOLLOWER && Optional.of(leaderNode).equals(lastKnownLeader)) {
logger.trace("{}: coordinator remaining FOLLOWER of [{}] in term {}",
method, leaderNode, getCurrentTerm());
} else {
logger.debug("{}: coordinator becoming FOLLOWER of [{}] in term {} (was {}, lastKnownLeader was [{}])",
method, leaderNode, getCurrentTerm(), mode, lastKnownLeader);
}
final boolean restartLeaderChecker = (mode == Mode.FOLLOWER && Optional.of(leaderNode).equals(lastKnownLeader)) == false;

View File

@ -374,9 +374,10 @@ public class FollowersChecker {
public void run() {
synchronized (mutex) {
if (running() == false) {
logger.debug("{} condition no longer applies, not marking faulty", discoveryNode);
logger.trace("{} no longer running, not marking faulty", FollowerChecker.this);
return;
}
logger.debug("{} marking node as faulty", FollowerChecker.this);
faultyNodes.add(discoveryNode);
followerCheckers.remove(discoveryNode);
}