Source:
private LLCRealtimeSegmentZKMetadata updateCommittingSegmentZKMetadata(String realtimeTableName, CommittingSegmentDescriptor committingSegmentDescriptor) { String segmentName = committingSegmentDescriptor.getSegmentName(); LOGGER.info("Updating segment ZK metadata for committing segment: {}", segmentName); Stat stat = new Stat(); LLCRealtimeSegmentZKMetadata committingSegmentZKMetadata = getSegmentZKMetadata(realtimeTableName, segmentName, stat); Preconditions.checkState(committingSegmentZKMetadata.getStatus() == Status.IN_PROGRESS, "Segment status for segment: %s should be IN_PROGRESS, found: %s", segmentName, committingSegmentZKMetadata.getStatus()); SegmentMetadataImpl segmentMetadata = committingSegmentDescriptor.getSegmentMetadata(); Preconditions.checkState(segmentMetadata != null, "Failed to find segment metadata from descriptor for segment: %s", segmentName); committingSegmentZKMetadata.setEndOffset(committingSegmentDescriptor.getNextOffset()); committingSegmentZKMetadata.setStatus(Status.DONE); committingSegmentZKMetadata.setDownloadUrl(isPeerURL(committingSegmentDescriptor.getSegmentLocation()) ? "" : committingSegmentDescriptor.getSegmentLocation()); committingSegmentZKMetadata.setCrc(Long.valueOf(segmentMetadata.getCrc())); committingSegmentZKMetadata.setStartTime(segmentMetadata.getTimeInterval().getStartMillis()); committingSegmentZKMetadata.setEndTime(segmentMetadata.getTimeInterval().getEndMillis()); committingSegmentZKMetadata.setTimeUnit(TimeUnit.MILLISECONDS); committingSegmentZKMetadata.setIndexVersion(segmentMetadata.getVersion()); committingSegmentZKMetadata.setTotalDocs(segmentMetadata.getTotalDocs()); persistSegmentZKMetadata(realtimeTableName, committingSegmentZKMetadata, stat.getVersion()); return committingSegmentZKMetadata; }

Target:
private LLCRealtimeSegmentZKMetadata updateCommittingSegmentZKMetadata(String realtimeTableName, CommittingSegmentDescriptor committingSegmentDescriptor) { String segmentName = committingSegmentDescriptor.getSegmentName(); LOGGER.info("Updating segment ZK metadata for committing segment: {}", segmentName); Stat stat = new Stat(); LLCRealtimeSegmentZKMetadata committingSegmentZKMetadata = getSegmentZKMetadata(realtimeTableName, segmentName, stat); Preconditions.checkState(committingSegmentZKMetadata.getStatus() == Status.IN_PROGRESS, "Segment status for segment: %s should be IN_PROGRESS, found: %s", segmentName, committingSegmentZKMetadata.getStatus()); SegmentMetadataImpl segmentMetadata = committingSegmentDescriptor.getSegmentMetadata(); Preconditions.checkState(segmentMetadata != null, "Failed to find segment metadata from descriptor for segment: %s", segmentName); committingSegmentZKMetadata.setEndOffset(committingSegmentDescriptor.getNextOffset()); committingSegmentZKMetadata.setStatus(Status.DONE); committingSegmentZKMetadata.setDownloadUrl(isPeerURL(committingSegmentDescriptor.getSegmentLocation()) ? CommonConstants.Segment.METADATA_URI_FOR_PEER_DOWNLOAD : committingSegmentDescriptor.getSegmentLocation()); committingSegmentZKMetadata.setCrc(Long.valueOf(segmentMetadata.getCrc())); committingSegmentZKMetadata.setStartTime(segmentMetadata.getTimeInterval().getStartMillis()); committingSegmentZKMetadata.setEndTime(segmentMetadata.getTimeInterval().getEndMillis()); committingSegmentZKMetadata.setTimeUnit(TimeUnit.MILLISECONDS); committingSegmentZKMetadata.setIndexVersion(segmentMetadata.getVersion()); committingSegmentZKMetadata.setTotalDocs(segmentMetadata.getTotalDocs()); persistSegmentZKMetadata(realtimeTableName, committingSegmentZKMetadata, stat.getVersion()); return committingSegmentZKMetadata; }