Skip to content
Merged
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
5 changes: 3 additions & 2 deletions clients/src/main/java/org/apache/kafka/clients/Metadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Metadata(long refreshBackoffMs,
long metadataExpireMs,
LogContext logContext,
ClusterResourceListeners clusterResourceListeners) {
this(refreshBackoffMs, metadataExpireMs, logContext, clusterResourceListeners, Long.MAX_VALUE);
this(refreshBackoffMs, metadataExpireMs, logContext, clusterResourceListeners, -1);
}

public Metadata(long refreshBackoffMs,
Expand Down Expand Up @@ -141,7 +141,8 @@ public synchronized void incrementNodesTriedSinceLastSuccessfulRefresh() {
* has been set by receiving stale metadata from a different cluster
*/
public synchronized boolean shouldUpdateClusterMetadataFromBootstrap(long nowMs) {
return (this.nodesTriedSinceLastSuccessfulRefresh >= 1 &&
return this.maxClusterMetadataExpireTimeMs > 0 &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm. Seems CC is using Metadata directly instead of MetadataUpdater, is that the reason it cannot override this method to false always?

@lmr3796 lmr3796 Apr 6, 2022

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@kehuum It's actually the problem of DefaultMetadataUpdater in client. The DefaultMetadataUpdater is not extensible as it's tangled with the whole NetworkClient (note that it's not a static inner class but a dynamic one)

(this.nodesTriedSinceLastSuccessfulRefresh >= 1 &&
(this.lastRefreshMs != 0 && this.lastSuccessfulRefreshMs + this.maxClusterMetadataExpireTimeMs <= nowMs)) ||
this.forceClusterMetadataUpdateFromBootstrap;
}
Expand Down