From 3a16498c856495e8d41156bb492953d830048b54 Mon Sep 17 00:00:00 2001 From: Brian Gallew Date: Thu, 31 Jan 2019 09:36:57 -0800 Subject: [PATCH] Work around missing offsets in initial data load --- .../doctorkafka/replicastats/ReplicaStatsManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drkafka/src/main/java/com/pinterest/doctorkafka/replicastats/ReplicaStatsManager.java b/drkafka/src/main/java/com/pinterest/doctorkafka/replicastats/ReplicaStatsManager.java index c6801250..527a24d3 100644 --- a/drkafka/src/main/java/com/pinterest/doctorkafka/replicastats/ReplicaStatsManager.java +++ b/drkafka/src/main/java/com/pinterest/doctorkafka/replicastats/ReplicaStatsManager.java @@ -190,7 +190,12 @@ public static Map getProcessingStartOffsets(KafkaConsumer< Map offsetsForTimes = kafkaConsumer .offsetsForTimes(partitionMap); for (Entry entry : offsetsForTimes.entrySet()) { - partitionMap.put(entry.getKey(), entry.getValue().offset()); + if (entry.getValue() == null) { + LOG.info("Faking a zero for {}", entry.getKey()); + partitionMap.put(entry.getKey(), 0L); + } else { + partitionMap.put(entry.getKey(), entry.getValue().offset()); + } } return partitionMap; }