You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/02/19 02:48:11 UTC
[GitHub] [kafka] rhauch opened a new pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
rhauch opened a new pull request #10158:
URL: https://github.com/apache/kafka/pull/10158
Refactored the KafkaBasedLog logic to read end offsets into a separate method to make it easier to test. Also changed the TopicAdmin.endOffsets method to throw the original UnsupportedVersionException, LeaderNotAvailableException, and TimeoutException rather than wrapping, to better conform with the consumer method and how the KafkaBasedLog retries those exceptions.
Added new tests to verify various scenarios and errors.
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r578917177
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -366,6 +348,44 @@ private void readToLogEnd() {
}
}
+ // Visible for testing
+ Map<TopicPartition, Long> readEndOffsets(Set<TopicPartition> assignment) {
+ log.trace("Reading to end of offset log");
+
+ Map<TopicPartition, Long> endOffsets;
+ // Note that we'd prefer to not use the consumer to find the end offsets for the assigned topic partitions.
+ // That is because it's possible that the consumer is already blocked waiting for new records to appear, when
+ // the consumer is already at the end. In such cases, using 'consumer.endOffsets(...)' will block until at least
+ // one more record becomes available, meaning we can't even check whether we're at the end offset.
+ // Since all we're trying to do here is get the end offset, we should use the supplied admin client
+ // (if available)
+ // (which prevents 'consumer.endOffsets(...)'
+ // from
+
+ // Deprecated constructors do not provide an admin supplier, so the admin is potentially null.
+ if (useAdminForListOffsets) {
+ // Use the admin client to immediately find the end offsets for the assigned topic partitions.
+ // Unlike using the consumer
+ try {
+ endOffsets = admin.endOffsets(assignment);
Review comment:
I wanted to avoid 3 separate return statements.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] kkonstantine commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
kkonstantine commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r579403166
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -366,6 +346,42 @@ private void readToLogEnd() {
}
}
+ // Visible for testing
+ Map<TopicPartition, Long> readEndOffsets(Set<TopicPartition> assignment) {
+ log.trace("Reading to end of offset log");
+
+ Map<TopicPartition, Long> endOffsets;
+ // Note that we'd prefer to not use the consumer to find the end offsets for the assigned topic partitions.
+ // That is because it's possible that the consumer is already blocked waiting for new records to appear, when
+ // the consumer is already at the end. In such cases, using 'consumer.endOffsets(...)' will block until at least
+ // one more record becomes available, meaning we can't even check whether we're at the end offset.
+ // Since all we're trying to do here is get the end offset, we should use the supplied admin client
+ // (if available)
+ // (which prevents 'consumer.endOffsets(...)'
+ // from
+
+ // Deprecated constructors do not provide an admin supplier, so the admin is potentially null.
+ if (useAdminForListOffsets) {
+ // Use the admin client to immediately find the end offsets for the assigned topic partitions.
+ // Unlike using the consumer
+ try {
+ return admin.endOffsets(assignment);
+ } catch (UnsupportedVersionException e) {
+ // This may happen with really old brokers that don't support the auto topic creation
+ // field in metadata requests
+ log.debug("Reading to end of log offsets with consumer since admin client is unsupported: {}", e.getMessage());
+ useAdminForListOffsets = false;
Review comment:
Good point. As long as `SharedTopicAdmin` admin won't be recycled. That's negligible anyways, I was referring to the pattern mainly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r578916881
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -390,7 +410,11 @@ public void run() {
log.trace("Finished read to end log for topic {}", topic);
} catch (TimeoutException e) {
log.warn("Timeout while reading log to end for topic '{}'. Retrying automatically. " +
- "This may occur when brokers are unavailable or unreachable. Reason: {}", topic, e.getMessage());
+ "This may occur when brokers are unavailable or unreachable. Reason: {}", topic, e.getMessage());
+ continue;
+ } catch (RetriableException | org.apache.kafka.connect.errors.RetriableException e) {
Review comment:
The previous `readToLogEnd()` that used the consumer did not have any special exception handling in the `start()` method. Any problem to start seems like it should propagate up to result in the worker failing. Especially when coupled with your fix in #10152.
I added this here because retriable exceptions should not stop the KafkaBasedLog's thread.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] kkonstantine commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
kkonstantine commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r578998452
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -366,6 +346,42 @@ private void readToLogEnd() {
}
}
+ // Visible for testing
+ Map<TopicPartition, Long> readEndOffsets(Set<TopicPartition> assignment) {
+ log.trace("Reading to end of offset log");
+
+ Map<TopicPartition, Long> endOffsets;
+ // Note that we'd prefer to not use the consumer to find the end offsets for the assigned topic partitions.
+ // That is because it's possible that the consumer is already blocked waiting for new records to appear, when
+ // the consumer is already at the end. In such cases, using 'consumer.endOffsets(...)' will block until at least
+ // one more record becomes available, meaning we can't even check whether we're at the end offset.
+ // Since all we're trying to do here is get the end offset, we should use the supplied admin client
+ // (if available)
+ // (which prevents 'consumer.endOffsets(...)'
+ // from
+
+ // Deprecated constructors do not provide an admin supplier, so the admin is potentially null.
+ if (useAdminForListOffsets) {
+ // Use the admin client to immediately find the end offsets for the assigned topic partitions.
+ // Unlike using the consumer
+ try {
+ return admin.endOffsets(assignment);
+ } catch (UnsupportedVersionException e) {
+ // This may happen with really old brokers that don't support the auto topic creation
+ // field in metadata requests
+ log.debug("Reading to end of log offsets with consumer since admin client is unsupported: {}", e.getMessage());
+ useAdminForListOffsets = false;
Review comment:
Using `admin = null` here allows to GC the unused admin instance earlier, right?
Not a big gain, but also I don't see much benefit by using a variable such as `useAdminForListOffsets`
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -161,6 +164,7 @@ public void start() {
// Create the topic admin client and initialize the topic ...
admin = topicAdminSupplier.get(); // may be null
+ useAdminForListOffsets = admin != null;
Review comment:
It's not obvious to me why we have to wait to call `topicAdminSupplier.get();` in `start`.
I think we can call it in the constructor and not save the field `topicAdminSupplier` but keep only `admin` as a member field. Unfortunately it can't be declared `final` because it may be reset (set to `null`) in the exception handling below but still, using fewer member fields seems reasonable and does not reduce the usability in this class IMO.
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -366,6 +346,42 @@ private void readToLogEnd() {
}
}
+ // Visible for testing
+ Map<TopicPartition, Long> readEndOffsets(Set<TopicPartition> assignment) {
+ log.trace("Reading to end of offset log");
+
+ Map<TopicPartition, Long> endOffsets;
+ // Note that we'd prefer to not use the consumer to find the end offsets for the assigned topic partitions.
+ // That is because it's possible that the consumer is already blocked waiting for new records to appear, when
+ // the consumer is already at the end. In such cases, using 'consumer.endOffsets(...)' will block until at least
+ // one more record becomes available, meaning we can't even check whether we're at the end offset.
+ // Since all we're trying to do here is get the end offset, we should use the supplied admin client
+ // (if available)
+ // (which prevents 'consumer.endOffsets(...)'
+ // from
Review comment:
Since we are moving this comment, probably it's a good idea to fix this incomplete sentence here too
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] kkonstantine commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
kkonstantine commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r579395276
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -161,6 +164,7 @@ public void start() {
// Create the topic admin client and initialize the topic ...
admin = topicAdminSupplier.get(); // may be null
+ useAdminForListOffsets = admin != null;
Review comment:
My main observation here is that keeping initialization in the constructor allows us to declare read only fields as `final`.
It also offers better exception safety, in the sense that when an object is constructed (the call to its constructor succeeds) then we know that more or less we have a functional instance of that class.
I'm not ignoring the cases where the initialization of variables has to happen at a later time during the call of `start`. But hopefully these cases are minimal, or else `start` ends up being the actual constructor of objects like this one here. Which can be redundant and in some cases more risky.
As I mentioned, since `admin` is not immutable here (can be set to `null` later to support connection with older brokers) I'm fine keeping this call in `start`. But I'd still recommend not pushing initializations outside the constructor if they can happen at the time of the object construction (as is the case with `admin`'s initial initialization here).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#issuecomment-782169002
@chia7712 and @kkonstantine: thanks for the reviews. I've incorporated your recent feedback, with the exception of @kkonstantine's suggestion to move the `topicAdminSupplier.get()` from `start()` into the constructor, as mentioned above in one of the comment threads.
Please take another look. Thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r578919850
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -366,6 +348,44 @@ private void readToLogEnd() {
}
}
+ // Visible for testing
+ Map<TopicPartition, Long> readEndOffsets(Set<TopicPartition> assignment) {
+ log.trace("Reading to end of offset log");
+
+ Map<TopicPartition, Long> endOffsets;
+ // Note that we'd prefer to not use the consumer to find the end offsets for the assigned topic partitions.
+ // That is because it's possible that the consumer is already blocked waiting for new records to appear, when
+ // the consumer is already at the end. In such cases, using 'consumer.endOffsets(...)' will block until at least
+ // one more record becomes available, meaning we can't even check whether we're at the end offset.
+ // Since all we're trying to do here is get the end offset, we should use the supplied admin client
+ // (if available)
+ // (which prevents 'consumer.endOffsets(...)'
+ // from
+
+ // Deprecated constructors do not provide an admin supplier, so the admin is potentially null.
+ if (useAdminForListOffsets) {
+ // Use the admin client to immediately find the end offsets for the assigned topic partitions.
+ // Unlike using the consumer
+ try {
+ endOffsets = admin.endOffsets(assignment);
Review comment:
I did see a way of reducing the # of returns to 2, and removing one of the duplicated lines. Thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r579280518
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -161,6 +164,7 @@ public void start() {
// Create the topic admin client and initialize the topic ...
admin = topicAdminSupplier.get(); // may be null
+ useAdminForListOffsets = admin != null;
Review comment:
I don't think the wait time matters whether we call `topicAdminSupplier.get()` in the constructor or here, because the constructor and the `start()` method are called synchronously from the Connect & MM2 startup process.
However, I do think there is a lot of value in following the existing pattern of not actually gathering, creating or using resources until the `start()` method. And we still need all of the fields, including the `useAdminForListOffset` boolean field that is set in the start method but also may be changed later on in the `readEndOffsets(...)` method if the admin is talking to a broker that doesn't support the end offsets method (e.g., 0.10.x). In fact, the latter is the primary error condition this PR is trying to fix.
So, I think it's better to keep the code as is. But please let me know if you still disagree.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#issuecomment-781813200
@chia7712, for what it's worth, I still think your #10152 PR is still an important fix.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r579288641
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -366,6 +346,42 @@ private void readToLogEnd() {
}
}
+ // Visible for testing
+ Map<TopicPartition, Long> readEndOffsets(Set<TopicPartition> assignment) {
+ log.trace("Reading to end of offset log");
+
+ Map<TopicPartition, Long> endOffsets;
+ // Note that we'd prefer to not use the consumer to find the end offsets for the assigned topic partitions.
+ // That is because it's possible that the consumer is already blocked waiting for new records to appear, when
+ // the consumer is already at the end. In such cases, using 'consumer.endOffsets(...)' will block until at least
+ // one more record becomes available, meaning we can't even check whether we're at the end offset.
+ // Since all we're trying to do here is get the end offset, we should use the supplied admin client
+ // (if available)
+ // (which prevents 'consumer.endOffsets(...)'
+ // from
+
+ // Deprecated constructors do not provide an admin supplier, so the admin is potentially null.
+ if (useAdminForListOffsets) {
+ // Use the admin client to immediately find the end offsets for the assigned topic partitions.
+ // Unlike using the consumer
+ try {
+ return admin.endOffsets(assignment);
+ } catch (UnsupportedVersionException e) {
+ // This may happen with really old brokers that don't support the auto topic creation
+ // field in metadata requests
+ log.debug("Reading to end of log offsets with consumer since admin client is unsupported: {}", e.getMessage());
+ useAdminForListOffsets = false;
Review comment:
I'm not sure the GC will really be any better if we were to use `admin = null` here, since the supplier is in charge of the lifecycle of the `TopicAdmin` instance, and our current implementation is that the `SharedTopicAdmin` is closed only when the herder is closed.
I did originally do what you're suggesting though, but changed it since technically we could use the topic admin for something else. Granted, the current code doesn't need it for anything else. I thought that using the variable made it a bit clearer that the variable controlled the behavior of the `readEndOffsets(...)` method using or not using the admin client.
But I think you're main point is that this can be simpler by using `admin = null`, and I can't really argue with that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] chia7712 commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r578965629
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -366,6 +346,42 @@ private void readToLogEnd() {
}
}
+ // Visible for testing
+ Map<TopicPartition, Long> readEndOffsets(Set<TopicPartition> assignment) {
+ log.trace("Reading to end of offset log");
+
+ Map<TopicPartition, Long> endOffsets;
Review comment:
unused variable
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] chia7712 commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r578907382
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -366,6 +348,44 @@ private void readToLogEnd() {
}
}
+ // Visible for testing
+ Map<TopicPartition, Long> readEndOffsets(Set<TopicPartition> assignment) {
+ log.trace("Reading to end of offset log");
+
+ Map<TopicPartition, Long> endOffsets;
+ // Note that we'd prefer to not use the consumer to find the end offsets for the assigned topic partitions.
+ // That is because it's possible that the consumer is already blocked waiting for new records to appear, when
+ // the consumer is already at the end. In such cases, using 'consumer.endOffsets(...)' will block until at least
+ // one more record becomes available, meaning we can't even check whether we're at the end offset.
+ // Since all we're trying to do here is get the end offset, we should use the supplied admin client
+ // (if available)
+ // (which prevents 'consumer.endOffsets(...)'
+ // from
+
+ // Deprecated constructors do not provide an admin supplier, so the admin is potentially null.
+ if (useAdminForListOffsets) {
+ // Use the admin client to immediately find the end offsets for the assigned topic partitions.
+ // Unlike using the consumer
+ try {
+ endOffsets = admin.endOffsets(assignment);
Review comment:
How about `return admin.endOffsets(assignment);`
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -390,7 +410,11 @@ public void run() {
log.trace("Finished read to end log for topic {}", topic);
} catch (TimeoutException e) {
log.warn("Timeout while reading log to end for topic '{}'. Retrying automatically. " +
- "This may occur when brokers are unavailable or unreachable. Reason: {}", topic, e.getMessage());
+ "This may occur when brokers are unavailable or unreachable. Reason: {}", topic, e.getMessage());
+ continue;
+ } catch (RetriableException | org.apache.kafka.connect.errors.RetriableException e) {
Review comment:
`readToLogEnd` is called by `start`. Should we add similar exception handle for that?
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -321,29 +325,7 @@ private void readToLogEnd() {
log.trace("Reading to end of offset log");
Review comment:
redundant log message. `readEndOffsets(Set<TopicPartition>)` has similar log.
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/TopicAdmin.java
##########
@@ -651,6 +651,10 @@ public Config describeTopicConfig(String topic) {
* @param partitions the topic partitions
* @return the map of offset for each topic partition, or an empty map if the supplied partitions
* are null or empty
+ * @throws UnsupportedVersionException if the admin client cannot read end offsets
+ * @throws TimeoutException if the offset metadata could not be fetched before the amount of time allocated
+ * by {@code request.timeout.ms} expires, and this call can be retried
+ * @throws LeaderNotAvailableException if the leader was not available and this call can be retried
* @throws RetriableException if a retriable error occurs, the operation takes too long, or the
Review comment:
`the operation takes too long`
^^^^^^^^^^^^^^^^^^^^^^^ this message gets invalid since `TimeoutException` is not wrapped to `RetriableException` anymore.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r578916881
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -390,7 +410,11 @@ public void run() {
log.trace("Finished read to end log for topic {}", topic);
} catch (TimeoutException e) {
log.warn("Timeout while reading log to end for topic '{}'. Retrying automatically. " +
- "This may occur when brokers are unavailable or unreachable. Reason: {}", topic, e.getMessage());
+ "This may occur when brokers are unavailable or unreachable. Reason: {}", topic, e.getMessage());
+ continue;
+ } catch (RetriableException | org.apache.kafka.connect.errors.RetriableException e) {
Review comment:
The previous `readToLogEnd()` that used the consumer did not have any special exception handling in the `start()` method. I added this here because retriable exceptions should not stop the KafkaBasedLog's thread.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on a change in pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r579289580
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -161,6 +164,7 @@ public void start() {
// Create the topic admin client and initialize the topic ...
admin = topicAdminSupplier.get(); // may be null
+ useAdminForListOffsets = admin != null;
Review comment:
Per the next comment, I've removed the `useAdminForListOffset` field to simplify things. However, I still think that it's more appropriate and follows existing convention for this class to call `topicAdminSupplier.get()` in the `start()` method.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch commented on pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch commented on pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#issuecomment-781810306
Thanks for the quick review, @chia7712. I've incorporated several of your suggestions, and added comments/responses on the others.
BTW, a run of the relevant Connect distributed system tests passed with this branch: https://jenkins.confluent.io/job/system-test-kafka-branch-builder/4390/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] rhauch merged pull request #10158: KAFKA-12343: Handle exceptions better in TopicAdmin, including UnsupportedVersionException
Posted by GitBox <gi...@apache.org>.
rhauch merged pull request #10158:
URL: https://github.com/apache/kafka/pull/10158
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org