THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
# Assuming we have an AdminClient instance val adminClient = ... // Pre-fetch and get "computed" topic configs for all specified topics val computedTopicConfigs = if (reportUnderMinISRPartitions) Option(adminClient.describeConfigs( topics.map(topic => new ConfigResource(ConfigResource.Type.TOPIC, topic)).asJavaCollection).all().get()) else None for (topic <- topics) ... if (describePartitions) { // Get "computed" topic "min...insync.replicas" for this topic val computedTopicMinISR = if (reportUnderMinISRPartitions) Option(computedTopicConfigs.get.get(new ConfigResource(ConfigResource.Type.TOPIC, topic)) .get(TopicConfig.MIN_IN_SYNC_REPLICAS_CONFIG).value().toInt) else None for ((partitionId, assignedReplicas) <- sortedPartitions) { ... // Print current topic partition if reportUnderMinISRPartitions and ISR count < "computed" min ISR if (... || (reportUnderMinISRPartitions && inSyncReplicas.size < computedTopicMinISR.get) { ... |
This means we need an additional flag "--bootstrap-server" to use AdminClient. KIP-377: TopicCommand to use AdminClient is already proposing this change to using AdminClient, so we can wait on KIP-377 to be completed first.
...