xinyuiscool commented on a change in pull request #939: SAMZA-2122: Fix the 
task caught-up logic which doesn't handle no incoming messages
URL: https://github.com/apache/samza/pull/939#discussion_r263086086
 
 

 ##########
 File path: 
samza-core/src/main/scala/org/apache/samza/container/TaskInstance.scala
 ##########
 @@ -321,6 +323,25 @@ class TaskInstance(
     }
   }
 
+  def initCaughtUpMapping() {
+    if (taskContext.getStreamMetadataCache != null) {
+      systemStreamPartitions.foreach(ssp => {
+        val partitionMetadata = taskContext
+          .getStreamMetadataCache
+          .getSystemStreamMetadata(ssp.getSystemStream, false)
+          .getSystemStreamPartitionMetadata.get(ssp.getPartition)
+
+        val upcomingOffset = partitionMetadata.getUpcomingOffset
+        val startingOffset = offsetManager.getStartingOffset(taskName, ssp)
+          .getOrElse(throw new SamzaException("No offset defined for 
SystemStreamPartition: %s" format ssp))
+
+        if(Objects.equals(upcomingOffset, startingOffset)) {
+          ssp2CaughtupMapping(ssp) = true
 
 Review comment:
   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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to