OliverMD commented on a change in pull request #3164: STORM-3529: Catch and Log
Kafka RetriableException
URL: https://github.com/apache/storm/pull/3164#discussion_r344495310
##########
File path:
external/storm-kafka-client/src/test/java/org/apache/storm/kafka/spout/KafkaSpoutSingleTopicTest.java
##########
@@ -428,4 +427,33 @@ public void testOffsetMetrics() throws Exception {
assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalLatestCompletedOffset").longValue(),
10);
assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalSpoutLag").longValue(),
0);
}
+
+ @Test
+ public void testOffsetMetricsReturnsNullWhenRetriableExceptionThrown()
throws Exception {
+ final int messageCount = 10;
+ prepareSpout(messageCount);
+
+ Map<String, Long> offsetMetric = (Map<String, Long>)
spout.getKafkaOffsetMetric().getValueAndReset();
+
assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalEarliestTimeOffset").longValue(),
0);
+ // the offset of the last available message + 1.
+
assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalLatestTimeOffset").longValue(),
10);
+
assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalRecordsInPartitions").longValue(),
10);
+
assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalLatestEmittedOffset").longValue(),
0);
+
assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalLatestCompletedOffset").longValue(),
0);
+ //totalSpoutLag = totalLatestTimeOffset-totalLatestCompletedOffset
+
assertEquals(offsetMetric.get(SingleTopicKafkaSpoutConfiguration.TOPIC+"/totalSpoutLag").longValue(),
10);
+
+ //Emit all messages and check that they are emitted. Ack the messages
too
+ for (int i = 0; i < messageCount; i++) {
+ nextTuple_verifyEmitted_ack_resetCollector(i);
+ }
+
+ commitAndVerifyAllMessagesCommitted(messageCount);
Review comment:
@srdo Do you think it would make sense to not include this as the test above
already tests this?
----------------------------------------------------------------
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