Source:
private SegmentCompletionProtocol.Response commitSegment(SegmentCompletionProtocol.Request.Params reqParams, boolean isSplitCommit, CommittingSegmentDescriptor committingSegmentDescriptor) { String instanceId = reqParams.getInstanceId(); StreamPartitionMsgOffset offset = _streamPartitionMsgOffsetFactory.create(reqParams.getStreamPartitionMsgOffset()); if (!_state.equals(State.COMMITTER_UPLOADING)) { LOGGER.warn("State change during upload: state={} segment={} winner={} winningOffset={}", _state, _segmentName.getSegmentName(), _winner, _winningOffset); return SegmentCompletionProtocol.RESP_FAILED; } LOGGER.info("Committing segment at offset winner {}", _segmentName.getSegmentName(), offset, instanceId); _state = State.COMMITTING; if (isSplitCommit && !isPeerSegmentDownloadScheme(committingSegmentDescriptor)) { try { committingSegmentDescriptor.setSegmentLocation( _segmentManager.commitSegmentFile(_realtimeTableName, committingSegmentDescriptor)); } catch (Exception e) { LOGGER.error("Caught exception while committing segment file for segment: {}", _segmentName.getSegmentName(), e); return SegmentCompletionProtocol.RESP_FAILED; } } try { if (CommonConstants.Segment.LOCAL_SEGMENT_SCHEME .equalsIgnoreCase(URIUtils.getUri(committingSegmentDescriptor.getSegmentLocation()).getScheme())) { committingSegmentDescriptor.setSegmentLocation(URIUtils .constructDownloadUrl(_controllerVipUrl, TableNameBuilder.extractRawTableName(_realtimeTableName), _segmentName.getSegmentName())); } _segmentManager.commitSegmentMetadata(_realtimeTableName, committingSegmentDescriptor); } catch (Exception e) { LOGGER .error("Caught exception while committing segment metadata for segment: {}", _segmentName.getSegmentName(), e); return SegmentCompletionProtocol.RESP_FAILED; } _state = State.COMMITTED; LOGGER.info("Committed segment at offset winner {}", _segmentName.getSegmentName(), offset, instanceId); return SegmentCompletionProtocol.RESP_COMMIT_SUCCESS; }

Target:
private SegmentCompletionProtocol.Response commitSegment(SegmentCompletionProtocol.Request.Params reqParams, boolean isSplitCommit, CommittingSegmentDescriptor committingSegmentDescriptor) { String instanceId = reqParams.getInstanceId(); StreamPartitionMsgOffset offset = _streamPartitionMsgOffsetFactory.create(reqParams.getStreamPartitionMsgOffset()); if (!_state.equals(State.COMMITTER_UPLOADING)) { LOGGER.warn("State change during upload: state={} segment={} winner={} winningOffset={}", _state, _segmentName.getSegmentName(), _winner, _winningOffset); return SegmentCompletionProtocol.RESP_FAILED; } LOGGER.info("Committing segment at offset winner {}", _segmentName.getSegmentName(), offset, instanceId); _state = State.COMMITTING; if (isSplitCommit) { try { _segmentManager.commitSegmentFile(_realtimeTableName, committingSegmentDescriptor); } catch (Exception e) { LOGGER.error("Caught exception while committing segment file for segment: {}", _segmentName.getSegmentName(), e); return SegmentCompletionProtocol.RESP_FAILED; } } try { if (CommonConstants.Segment.LOCAL_SEGMENT_SCHEME .equalsIgnoreCase(URIUtils.getUri(committingSegmentDescriptor.getSegmentLocation()).getScheme())) { committingSegmentDescriptor.setSegmentLocation(URIUtils .constructDownloadUrl(_controllerVipUrl, TableNameBuilder.extractRawTableName(_realtimeTableName), _segmentName.getSegmentName())); } _segmentManager.commitSegmentMetadata(_realtimeTableName, committingSegmentDescriptor); } catch (Exception e) { LOGGER .error("Caught exception while committing segment metadata for segment: {}", _segmentName.getSegmentName(), e); return SegmentCompletionProtocol.RESP_FAILED; } _state = State.COMMITTED; LOGGER.info("Committed segment at offset winner {}", _segmentName.getSegmentName(), offset, instanceId); return SegmentCompletionProtocol.RESP_COMMIT_SUCCESS; }