Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,13 @@ public void tick() {
try {
// if we failed to read to end of log before, we need to make sure the issue was resolved before joining group
// Joining and immediately leaving for failure to read configs is exceedingly impolite
if (!canReadConfigs && !readConfigToEnd(workerSyncTimeoutMs))
return; // Safe to return and tick immediately because readConfigToEnd will do the backoff for us
if (!canReadConfigs) {
if (readConfigToEnd(workerSyncTimeoutMs)) {
canReadConfigs = true;
} else {
return; // Safe to return and tick immediately because readConfigToEnd will do the backoff for us
}
}

log.debug("Ensuring group membership is still active");
member.ensureActive();
Expand Down Expand Up @@ -1105,7 +1110,9 @@ private boolean handleRebalanceCompleted() {
// we timed out. This should only happen if we failed to read configuration for long enough,
// in which case giving back control to the main loop will prevent hanging around indefinitely after getting kicked out of the group.
// We also indicate to the main loop that we failed to readConfigs so it will check that the issue was resolved before trying to join the group
if (!readConfigToEnd(workerSyncTimeoutMs)) {
if (readConfigToEnd(workerSyncTimeoutMs)) {
canReadConfigs = true;
} else {
canReadConfigs = false;
needsRejoin = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,11 @@ public Boolean answer() throws Throwable {
member.poll(EasyMock.anyInt());
PowerMock.expectLastCall();

// one more tick, to make sure we don't keep trying to read to the config topic unnecessarily
expectRebalance(1, Collections.emptyList(), Collections.emptyList());
member.poll(EasyMock.anyInt());
PowerMock.expectLastCall();

PowerMock.replayAll();

long before = time.milliseconds();
Expand All @@ -1685,6 +1690,10 @@ public Boolean answer() throws Throwable {
time.sleep(2000L);
assertStatistics("leaderUrl", false, 3, 1, 100, 2000L);

// tick once more to ensure that the successful read to the end of the config topic was
// tracked and no further unnecessary attempts were made
herder.tick();

PowerMock.verifyAll();
}

Expand Down