美文网首页
Group coordinator is unavailable

Group coordinator is unavailable

作者: Alen_ab56 | 来源:发表于2022-05-10 17:08 被阅读0次

发生这种错误一般是客户端连接异常导致

public class RetriableCommitFailedException extends RetriableException {

private static final long serialVersionUID =1L;

public static RetriableCommitFailedException withUnderlyingMessage(String additionalMessage) {

return new RetriableCommitFailedException("Offset commit failed with a retriable exception. You should retry committing the latest consumed offsets. The underlying error was: " + additionalMessage);

}

public RetriableCommitFailedException(Throwable t) {

super("Offset commit failed with a retriable exception. You should retry committing the latest consumed offsets.", t);

}

public RetriableCommitFailedException(String message) {

super(message);

}

public RetriableCommitFailedException(String message,Throwable t) {

super(message, t);

}

}

比如commit offset时,会校验groupCoordinator

public void commitOffsetsAsync(final Map offsets,final OffsetCommitCallback callback) {

invokeCompletedOffsetCommitCallbacks();

if (!coordinatorUnknown()) {

doCommitOffsetsAsync(offsets, callback);

}else {

------------------------------------------------------------

public boolean coordinatorUnknown() {

return checkAndGetCoordinator() ==null;

}

------------------------------------------------------------

protected synchronized Node checkAndGetCoordinator() {

if (coordinator !=null &&client.isUnavailable(coordinator)) {

markCoordinatorUnknown(true);

return null;

}

return this.coordinator;

}

----isUnavailable的判断条件是是否连接失败并且连接超时----

return client.connectionFailed(node) &&client.connectionDelay(node,time.milliseconds()) >0;

相关文章

网友评论

      本文标题:Group coordinator is unavailable

      本文链接:https://www.haomeiwen.com/subject/wznlurtx.html