Skip to content

Commit 7532d4c

Browse files
authored
Add more detail to log messages (elastic#47)
Add details of the publication that is timing out, and more timings to the start/end of stabilisation. Also the logging of the start of the stabilisation phase wasn't actually at the start.
1 parent 7c64ba7 commit 7532d4c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

server/src/main/java/org/elasticsearch/discovery/zen2/Legislator.java

+2
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ public void onTimeout() {
457457
failActiveTargets();
458458

459459
if (mode == Mode.LEADER && applyCommitReference.get() == null) {
460+
logger.debug("Publication.onTimeout(): failed to commit version [{}] in term [{}]",
461+
publishRequest.getAcceptedState().version(), publishRequest.getAcceptedState().term());
460462
becomeCandidate("Publication.onTimeout()");
461463
}
462464
}

server/src/test/java/org/elasticsearch/discovery/zen2/LegislatorTests.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -448,20 +448,21 @@ public void stabilise() {
448448

449449
public void stabilise(long stabilisationTimeMillis, long delayVariability) {
450450
// Stabilisation phase: just wake up nodes in order for long enough to allow a leader to be elected
451+
452+
final long stabilisationPhaseEndMillis = currentTimeMillis + stabilisationTimeMillis;
453+
logger.info("--> starting stabilisation phase at [{}ms]: run for [{}ms] until [{}ms] with delayVariability [{}ms]",
454+
currentTimeMillis, stabilisationTimeMillis, stabilisationPhaseEndMillis, delayVariability);
455+
451456
setDelayVariability(delayVariability);
452457

453458
deliverNextMessageUntilQuiescent();
454459

455-
final long stabilisationPhaseEndMillis = currentTimeMillis + stabilisationTimeMillis;
456-
logger.info("--> start of stabilisation phase ({}ms): run until time {}ms", stabilisationTimeMillis,
457-
stabilisationPhaseEndMillis);
458-
459460
while (tasks.isEmpty() == false && getNextTaskExecutionTime() <= stabilisationPhaseEndMillis) {
460461
doNextWakeUp();
461462
deliverNextMessageUntilQuiescent();
462463
}
463464

464-
logger.info("--> end of stabilisation phase");
465+
logger.info("--> end of stabilisation phase at [{}ms]", currentTimeMillis);
465466

466467
assertUniqueLeaderAndExpectedModes();
467468
}

0 commit comments

Comments
 (0)