Skip to content
Open
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 @@ -306,7 +306,7 @@ private synchronized boolean ensureCoordinatorReady(final Timer timer, boolean d
if (future.isRetriable()) {
log.debug("Coordinator discovery failed, refreshing metadata", future.exception());
timer.sleep(retryBackoff.backoff(attempts++));
client.awaitMetadataUpdate(timer);
client.awaitMetadataUpdate(timer, disableWakeup);
} else {
fatalException = future.exception();
log.info("FindCoordinator request hit fatal exception", fatalException);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,20 @@ public boolean hasReadyNodes(long now) {
* @return true if update succeeded, false otherwise.
*/
public boolean awaitMetadataUpdate(Timer timer) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too, probably worth clarifying that this one "throws WakeUp"

(consistent with the java doc of the poll in this same file btw)

return awaitMetadataUpdate(timer, false);
}

/**
* Block waiting on the metadata refresh with a timeout.
*
* @param timer Timer bounding how long this method can block
* @param disableWakeup true if we should not check for wakeups, false otherwise
* @return true if update succeeded, false otherwise.
*/
public boolean awaitMetadataUpdate(Timer timer, boolean disableWakeup) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add the "throws WakeUp" java doc?

int version = this.metadata.requestUpdate(false);
do {
poll(timer);
poll(timer, null, disableWakeup);
} while (this.metadata.updateVersion() == version && timer.notExpired());
return this.metadata.updateVersion() > version;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,21 @@ public void testWakeupFromEnsureCoordinatorReady() {
);
}

@Test
public void testNoWakeupFromAsyncCoordinatorReadyOnRetriableError() {
setupCoordinator();
mockClient.prepareResponse(groupCoordinatorResponse(node, Errors.COORDINATOR_NOT_AVAILABLE));
consumerClient.wakeup();
// The async variation should not throw WakeupException
coordinator.ensureCoordinatorReadyAsync();

consumerClient.wakeup();
mockClient.prepareResponse(groupCoordinatorResponse(node, Errors.COORDINATOR_NOT_AVAILABLE));
assertThrows(WakeupException.class, () ->
coordinator.ensureCoordinatorReady(mockTime.timer(0))
);
}

@Test
public void testTimeoutAndRetryJoinGroupIfNeeded() throws Exception {
setupCoordinator();
Expand Down
Loading