MeghaUpadhyay commented on a change in pull request #2721: Add offset look-back
option in Kafka consumer
URL: https://github.com/apache/incubator-gobblin/pull/2721#discussion_r317457143
##########
File path:
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaSource.java
##########
@@ -451,7 +459,43 @@ private WorkUnit
getWorkUnitForTopicPartition(KafkaPartition partition, SourceSt
LOG.warn(
offsetNotFoundMsg + "This partition will start from the earliest
offset: " + offsets.getEarliestOffset());
offsets.startAtEarliestOffset();
- } else {
+ } else if (offsetOption.equals(OFFSET_LOOKBACK)) {
+ long lookbackOffsetRange = state.getPropAsLong(KAFKA_OFFSET_LOOKBACK ,
0L);
+ long offset = offsets.getLatestOffset() - lookbackOffsetRange;
+ LOG.warn(offsetNotFoundMsg + "This partition will start from
latest-lookback [ " + offsets.getLatestOffset() + " - " + lookbackOffsetRange +
" ] start offset: " + offset);
Review comment:
Sure Thanks .. I have updated this line to store offsets.getLatestOffset()
in a variable and use that in subsequent code. But I am finding same issue in
multiple places like here
https://github.com/apache/incubator-gobblin/pull/2721/files#diff-1f786615c11702cd74b076ab157da963R479
... Which might lead to incorrect logging and using different offset in
"offsets.startAtLatestOffset();". Please suggest something 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:
[email protected]
With regards,
Apache Git Services