dnishimura commented on a change in pull request #1119: SAMZA-2284: Remove 
redundant getStreamMetadata calls in SamzaContainer startup sequence.
URL: https://github.com/apache/samza/pull/1119#discussion_r308807682
 
 

 ##########
 File path: 
samza-core/src/main/scala/org/apache/samza/container/TaskInstance.scala
 ##########
 @@ -326,22 +324,22 @@ class TaskInstance(
     * Check each partition assigned to the task is caught to the last offset
     */
   def initCaughtUpMapping() {
-    if (taskContext.getStreamMetadataCache != null) {
+    if (inputStreamMetadata != null && inputStreamMetadata.nonEmpty) {
       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))
-
-        // Mark ssp to be caught up if the starting offset is already the
-        // upcoming offset, meaning the task has consumed all the messages
-        // in this partition before and waiting for the future incoming 
messages.
-        if(Objects.equals(upcomingOffset, startingOffset)) {
-          ssp2CaughtupMapping(ssp) = true
+        if (inputStreamMetadata.contains(ssp.getSystemStream)) {
 
 Review comment:
   Can there be a scenario where the `inputStreamMetadata` does not contain the 
`SystemStream` of interest? Would you need to fallback to querying the stream 
metadata cache from the task context?
   If not, it'd be good to at least log a warning in the else block in case we 
need to troubleshoot in the future.

----------------------------------------------------------------
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

Reply via email to