Skip to content

Commit

Permalink
Fix SystemTime that change visibility and compilation issue of KafkaG…
Browse files Browse the repository at this point in the history
…roupLeaderElector (#3155)

* Fix SystemTime that change visibility

* Use MetadataRecoveryStrategy.NONE for NetworkClient
  • Loading branch information
trnguyencflt committed Jun 18, 2024
1 parent fd23175 commit 4e09a7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.kafka.clients.ClientUtils;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.Metadata;
import org.apache.kafka.clients.MetadataRecoveryStrategy;
import org.apache.kafka.clients.NetworkClient;
import org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient;
import org.apache.kafka.common.KafkaException;
Expand Down Expand Up @@ -151,7 +152,8 @@ public KafkaGroupLeaderElector(SchemaRegistryConfig config,
time,
true,
new ApiVersions(),
logContext);
logContext,
MetadataRecoveryStrategy.NONE);

this.client = new ConsumerNetworkClient(
logContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.apache.kafka.common.metrics.MetricsReporter;
import org.apache.kafka.common.metrics.stats.CumulativeCount;
import org.apache.kafka.common.metrics.stats.Value;
import org.apache.kafka.common.utils.SystemTime;
import org.apache.kafka.common.utils.Time;

import java.security.KeyStore;
import java.security.KeyStoreException;
Expand Down Expand Up @@ -115,7 +115,7 @@ public MetricsContainer(SchemaRegistryConfig config, String kafkaClusterId) {
new MetricConfig().samples(config.getInt(ProducerConfig.METRICS_NUM_SAMPLES_CONFIG))
.timeWindow(config.getLong(ProducerConfig.METRICS_SAMPLE_WINDOW_MS_CONFIG),
TimeUnit.MILLISECONDS);
this.metrics = new Metrics(metricConfig, reporters, new SystemTime(), metricsContext);
this.metrics = new Metrics(metricConfig, reporters, Time.SYSTEM, metricsContext);

this.isLeaderNode = createMetric(METRIC_NAME_MASTER_SLAVE_ROLE,
"1.0 indicates the node is the active leader in the cluster and is the"
Expand Down

0 comments on commit 4e09a7c

Please sign in to comment.