Source:
<code>private long seek(TopicPartition tp, KafkaTridentSpoutBatchMetadata lastBatchMeta) { if (isFirstPollSinceExecutorStarted(tp)) { boolean isFirstPollSinceTopologyWasDeployed = lastBatchMeta == null || !topologyContext.getStormId().equals(lastBatchMeta.getTopologyId()); if (firstPollOffsetStrategy == EARLIEST && isFirstPollSinceTopologyWasDeployed) { LOG.debug("First poll for topic partition [{}], seeking to partition beginning", tp); consumer.seekToBeginning(Collections.singleton(tp)); } else if (firstPollOffsetStrategy == LATEST && isFirstPollSinceTopologyWasDeployed) { LOG.debug("First poll for topic partition [{}], seeking to partition end", tp); consumer.seekToEnd(Collections.singleton(tp)); } else if (lastBatchMeta != null) { LOG.debug("First poll for topic partition [{}], using last batch metadata", tp); consumer.seek(tp, lastBatchMeta.getLastOffset() + 1); <START> } else if (firstPollOffsetStrategy == UNCOMMITTED_EARLIEST || firstPollOffsetStrategy == EARLIEST) { <END> LOG.debug("First poll for topic partition with no last batch metadata, seeking to partition beginning", tp); consumer.seekToBeginning(Collections.singleton(tp)); } else if (firstPollOffsetStrategy == UNCOMMITTED_LATEST || firstPollOffsetStrategy == LATEST) { LOG.debug("First poll for topic partition with no last batch metadata, seeking to partition end", tp); consumer.seekToEnd(Collections.singleton(tp)); } tpToFirstSeekOffset.put(tp, consumer.position(tp)); } else if (lastBatchMeta != null) { consumer.seek(tp, lastBatchMeta.getLastOffset() + 1); LOG.debug("First poll for topic partition [{}], using last batch metadata", tp); } else { long initialFetchOffset = tpToFirstSeekOffset.get(tp); consumer.seek(tp, initialFetchOffset); LOG.debug("First poll for topic partition [{}], no last batch metadata present." + " Using stored initial fetch offset [{}]", tp, initialFetchOffset); } final long fetchOffset = consumer.position(tp); LOG.debug("Set [fetchOffset = {}] for partition [{}]", fetchOffset, tp); return fetchOffset; }</code><technical_language>hit firstPollOffsetStrategy == EARLIEST case</technical_language>

Target:
private long seek(TopicPartition tp, KafkaTridentSpoutBatchMetadata lastBatchMeta) { if (isFirstPollSinceExecutorStarted(tp)) { boolean isFirstPollSinceTopologyWasDeployed = lastBatchMeta == null || !topologyContext.getStormId().equals(lastBatchMeta.getTopologyId()); if (firstPollOffsetStrategy == EARLIEST && isFirstPollSinceTopologyWasDeployed) { LOG.debug("First poll for topic partition [{}], seeking to partition beginning", tp); consumer.seekToBeginning(Collections.singleton(tp)); } else if (firstPollOffsetStrategy == LATEST && isFirstPollSinceTopologyWasDeployed) { LOG.debug("First poll for topic partition [{}], seeking to partition end", tp); consumer.seekToEnd(Collections.singleton(tp)); } else if (lastBatchMeta != null) { LOG.debug("First poll for topic partition [{}], using last batch metadata", tp); consumer.seek(tp, lastBatchMeta.getLastOffset() + 1); } else if (firstPollOffsetStrategy == UNCOMMITTED_EARLIEST) { LOG.debug("First poll for topic partition with no last batch metadata, seeking to partition beginning", tp); consumer.seekToBeginning(Collections.singleton(tp)); } else if (firstPollOffsetStrategy == UNCOMMITTED_LATEST) { LOG.debug("First poll for topic partition with no last batch metadata, seeking to partition end", tp); consumer.seekToEnd(Collections.singleton(tp)); } tpToFirstSeekOffset.put(tp, consumer.position(tp)); } else if (lastBatchMeta != null) { consumer.seek(tp, lastBatchMeta.getLastOffset() + 1); LOG.debug("First poll for topic partition [{}], using last batch metadata", tp); } else { long initialFetchOffset = tpToFirstSeekOffset.get(tp); consumer.seek(tp, initialFetchOffset); LOG.debug("First poll for topic partition [{}], no last batch metadata present." + " Using stored initial fetch offset [{}]", tp, initialFetchOffset); } final long fetchOffset = consumer.position(tp); LOG.debug("Set [fetchOffset = {}] for partition [{}]", fetchOffset, tp); return fetchOffset; }