use of com.linkedin.pinot.controller.helix.core.realtime.SegmentCompletionManager in project pinot by linkedin.
the class LLCSegmentCommit method post.
@Override
@HttpVerb("post")
@Description("Uploads an LLC segment coming in from a server")
@Summary("Uploads an LLC segment coming in from a server")
@Paths({ "/" + SegmentCompletionProtocol.MSG_TYPE_COMMMIT })
public Representation post(Representation entity) {
if (!extractParams()) {
return new StringRepresentation(SegmentCompletionProtocol.RESP_FAILED.toJsonString());
}
LOGGER.info("segment={} offset={} instance={} ", _segmentNameStr, _offset, _instanceId);
final SegmentCompletionManager segmentCompletionManager = getSegmentCompletionManager();
final SegmentCompletionProtocol.Request.Params reqParams = new SegmentCompletionProtocol.Request.Params();
reqParams.withInstanceId(_instanceId).withSegmentName(_segmentNameStr).withOffset(_offset);
SegmentCompletionProtocol.Response response = segmentCompletionManager.segmentCommitStart(reqParams);
if (response.equals(SegmentCompletionProtocol.RESP_COMMIT_CONTINUE)) {
// Get the segment and put it in the right place.
boolean success = uploadSegment(_instanceId, _segmentNameStr);
response = segmentCompletionManager.segmentCommitEnd(reqParams, success);
}
LOGGER.info("Response: instance={} segment={} status={} offset={}", _instanceId, _segmentNameStr, response.getStatus(), response.getOffset());
return new StringRepresentation(response.toJsonString());
}
Aggregations