shanthoosh 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_r308851689
##########
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:
> inputStreamMetadata does not contain the SystemStream of interest
No, that scenario will not happen. `inputStreamMetadata` map will contain
metadata of all input streams in a `SamzaContainer`(Union of input streams
assigned to all the `TaskInstance` in a `SamzaContainer`). So it will have the
stream-metadata for any `SystemStreamPartition` assigned to a `TaskInstance`.
----------------------------------------------------------------
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