shanthoosh commented on a change in pull request #1026: SAMZA-2189: Integrate
startpoint resolution workflow with SamzaContainer startup sequence.
URL: https://github.com/apache/samza/pull/1026#discussion_r283012902
##########
File path:
samza-core/src/main/scala/org/apache/samza/container/TaskInstance.scala
##########
@@ -141,15 +142,36 @@ class TaskInstance(
collector.register
}
- def registerConsumers {
+ /**
+ * Computes the starting offset for the partitions assigned to the task and
registers them with the underlying {@see SystemConsumers}.
+ *
+ * Starting offset for a partition of the task is computed in the following
manner:
+ *
+ * 1. If a startpoint exists for a task, system stream partition and it
resolves to a offset, then the resolved offset is used as the starting offset.
+ * 2. Else, the checkpointed offset for the system stream partition is used
as the starting offset.
+ */
+ def registerConsumers() {
debug("Registering consumers for taskName: %s" format taskName)
systemStreamPartitions.foreach(systemStreamPartition => {
- val startingOffset = getStartingOffset(systemStreamPartition)
- val startpoint = offsetManager.getStartpoint(taskName,
systemStreamPartition).getOrElse(null)
- consumerMultiplexer.register(systemStreamPartition, startingOffset,
startpoint)
- metrics.addOffsetGauge(systemStreamPartition, () =>
- offsetManager.getLastProcessedOffset(taskName,
systemStreamPartition).orNull
- )
+ var startingOffset: String = getStartingOffset(systemStreamPartition)
+ val startpoint: Option[Startpoint] =
offsetManager.getStartpoint(taskName, systemStreamPartition)
+ if (startpoint != null && startpoint.isDefined) {
Review comment:
Done.
----------------------------------------------------------------
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