如何为以下错误“组的自动偏移提交失败”和仅针对消息“由于组已重新平衡并已将分区分配给另一个成员而无法完成提交”更改日志级别。
18.07.2018 12:08:00.394 [expiredCachesMessageListenerContainer-C-1] WARN o.a.k.c.c.i.ConsumerCoordinator:652 - Auto-commit of offsets {expired_caches_rusnew-1=OffsetAndMetadata{offset=9223372036854775807, metadata=''}} failed for group rusnew-cm-ws: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records.
当前大声笑级别-警告,需要-错误;
我需要进行以下更改的代码示例。
ConsumerCoordinator.java(kafka-clients-0.10.2.1)
private void doAutoCommitOffsetsAsync() {
Map<TopicPartition, OffsetAndMetadata> allConsumedOffsets = this.subscriptions.allConsumed();
log.debug("Sending asynchronous auto-commit of offsets {} for group {}", allConsumedOffsets, this.groupId);
this.commitOffsetsAsync(allConsumedOffsets, new OffsetCommitCallback() {
public void onComplete(Map<TopicPartition, OffsetAndMetadata> offsets, Exception exception) {
if (exception != null) {
ConsumerCoordinator.log.warn("Auto-commit of offsets {} failed for group {}: {}", new Object[]{offsets, ConsumerCoordinator.this.groupId, exception.getMessage()});
if (exception instanceof RetriableException) {
ConsumerCoordinator.this.nextAutoCommitDeadline = Math.min(ConsumerCoordinator.this.time.milliseconds() + ConsumerCoordinator.this.retryBackoffMs, ConsumerCoordinator.this.nextAutoCommitDeadline);
}
} else {
ConsumerCoordinator.log.debug("Completed auto-commit of offsets {} for group {}", offsets, ConsumerCoordinator.this.groupId);
}
}
});
}
和
private void maybeAutoCommitOffsetsSync(long timeoutMs) {
if (this.autoCommitEnabled) {
Map allConsumedOffsets = this.subscriptions.allConsumed();
try {
log.debug("Sending synchronous auto-commit of offsets {} for group {}", allConsumedOffsets, this.groupId);
if (!this.commitOffsetsSync(allConsumedOffsets, timeoutMs)) {
log.debug("Auto-commit of offsets {} for group {} timed out before completion", allConsumedOffsets, this.groupId);
}
} catch (InterruptException | WakeupException var5) {
log.debug("Auto-commit of offsets {} for group {} was interrupted before completion", allConsumedOffsets, this.groupId);
throw var5;
} catch (Exception var6) {
log.warn("Auto-commit of offsets {} failed for group {}: {}", new Object[]{allConsumedOffsets, this.groupId, var6.getMessage()});
}
}
}