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 2020/04/25 22:24:42 UTC
[GitHub] [kafka] C0urante opened a new pull request #8554: KAFKA-9919: Add logging to KafkaBasedLog::readToLogEnd
C0urante opened a new pull request #8554:
URL: https://github.com/apache/kafka/pull/8554
[Jira ticket](https://issues.apache.org/jira/browse/KAFKA-9919)
Just some simple logging additions that should make life easier when the worker can't get caught up to the end of an internal topic.
### 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] C0urante commented on a change in pull request #8554: KAFKA-9919: Add logging to KafkaBasedLog::readToLogEnd
Posted by GitBox <gi...@apache.org>.
C0urante commented on a change in pull request #8554:
URL: https://github.com/apache/kafka/pull/8554#discussion_r417070806
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -281,9 +281,18 @@ private void readToLogEnd() {
Iterator<Map.Entry<TopicPartition, Long>> it = endOffsets.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<TopicPartition, Long> entry = it.next();
- if (consumer.position(entry.getKey()) >= entry.getValue())
+ TopicPartition topicPartition = entry.getKey();
+ Long endOffset = entry.getValue();
Review comment:
Fair enough; added.
----------------------------------------------------------------
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 pull request #8554: KAFKA-9919: Add logging to KafkaBasedLog::readToLogEnd
Posted by GitBox <gi...@apache.org>.
kkonstantine commented on pull request #8554:
URL: https://github.com/apache/kafka/pull/8554#issuecomment-621592493
Only flaky failures in unrelated tests:
`GlobalKTableIntegrationTest` failed in all builds and `PlaintextConsumerTest.testLowMaxFetchSizeForRequestAndPartition` failed once on jdk8.
That's good enough for this PR. Merging to `trunk` and `2.5`
----------------------------------------------------------------
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] C0urante commented on pull request #8554: KAFKA-9919: Add logging to KafkaBasedLog::readToLogEnd
Posted by GitBox <gi...@apache.org>.
C0urante commented on pull request #8554:
URL: https://github.com/apache/kafka/pull/8554#issuecomment-620992508
Thanks @kkonstantine! These all seem like reasonable suggestions and I've applied them all. Ready for the next round when you have time.
----------------------------------------------------------------
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] C0urante commented on pull request #8554: KAFKA-9919: Add logging to KafkaBasedLog::readToLogEnd
Posted by GitBox <gi...@apache.org>.
C0urante commented on pull request #8554:
URL: https://github.com/apache/kafka/pull/8554#issuecomment-619449604
@ncliang, @gharris1727, @aakashnshah would you mind taking a look when you have a chance?
----------------------------------------------------------------
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] gwenshap commented on pull request #8554: KAFKA-9919: Add logging to KafkaBasedLog::readToLogEnd
Posted by GitBox <gi...@apache.org>.
gwenshap commented on pull request #8554:
URL: https://github.com/apache/kafka/pull/8554#issuecomment-619456920
ok to test
----------------------------------------------------------------
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 #8554: KAFKA-9919: Add logging to KafkaBasedLog::readToLogEnd
Posted by GitBox <gi...@apache.org>.
kkonstantine commented on a change in pull request #8554:
URL: https://github.com/apache/kafka/pull/8554#discussion_r417055199
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -281,9 +281,18 @@ private void readToLogEnd() {
Iterator<Map.Entry<TopicPartition, Long>> it = endOffsets.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<TopicPartition, Long> entry = it.next();
- if (consumer.position(entry.getKey()) >= entry.getValue())
+ TopicPartition topicPartition = entry.getKey();
+ Long endOffset = entry.getValue();
+ long lastConsumedOffset = consumer.position(topicPartition);
+ if (lastConsumedOffset >= endOffset) {
+ log.trace("Reached end offset {} for {}", endOffset, topicPartition);
it.remove();
- else {
+ } else {
+ log.trace(
+ "Behind end offset {} for {}; last-consumed offset is {}",
+ endOffset,
+ topicPartition,
+ lastConsumedOffset);
Review comment:
```suggestion
log.trace("Behind end offset {} for {}; last-consumed offset is {}",
endOffset, topicPartition, lastConsumedOffset);
```
nit: multiline calls don't need to be on their own line in AK and tab is equal to 4 spaces (here we need 2 tabs)
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -281,9 +281,18 @@ private void readToLogEnd() {
Iterator<Map.Entry<TopicPartition, Long>> it = endOffsets.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<TopicPartition, Long> entry = it.next();
- if (consumer.position(entry.getKey()) >= entry.getValue())
+ TopicPartition topicPartition = entry.getKey();
+ Long endOffset = entry.getValue();
Review comment:
unboxing will happen in the comparison in the `if` branch anyways, so probably better to do it early declaring the type `long` here.
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -281,9 +281,18 @@ private void readToLogEnd() {
Iterator<Map.Entry<TopicPartition, Long>> it = endOffsets.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<TopicPartition, Long> entry = it.next();
- if (consumer.position(entry.getKey()) >= entry.getValue())
+ TopicPartition topicPartition = entry.getKey();
+ Long endOffset = entry.getValue();
+ long lastConsumedOffset = consumer.position(topicPartition);
+ if (lastConsumedOffset >= endOffset) {
+ log.trace("Reached end offset {} for {}", endOffset, topicPartition);
Review comment:
given that the previous messages say "Reading to ..." maybe it would make sense to say:
```suggestion
log.trace("Read to end offset {} for {}", endOffset, topicPartition);
```
##########
File path: connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -281,9 +281,18 @@ private void readToLogEnd() {
Iterator<Map.Entry<TopicPartition, Long>> it = endOffsets.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<TopicPartition, Long> entry = it.next();
- if (consumer.position(entry.getKey()) >= entry.getValue())
+ TopicPartition topicPartition = entry.getKey();
+ Long endOffset = entry.getValue();
+ long lastConsumedOffset = consumer.position(topicPartition);
+ if (lastConsumedOffset >= endOffset) {
+ log.trace("Reached end offset {} for {}", endOffset, topicPartition);
it.remove();
- else {
+ } else {
+ log.trace(
+ "Behind end offset {} for {}; last-consumed offset is {}",
+ endOffset,
+ topicPartition,
+ lastConsumedOffset);
Review comment:
Similar to the above, seeing a message that says `read` might be easier to read in context than `consumed`.
How about:
`Behind end offset {} for {}; last-read offset is {}`
----------------------------------------------------------------
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