return;
}
long offset = args.get(0).buf().getLong();
long size = args.get(1).buf().getLong();
SegmentInfo info = zlog.segmentInfo(offset);
if (info == null || info.flushedOffset() < offset) {
LOG.info("No such segment for offset {}, or found {}",
offset, info == null ? -1 : info.flushedOffset());
code(ZPConstants.TYPE_RESPONSE, ZPConstants.STATUS_INVALID_OFFSET);
return;
}
assert (info.start() <= offset);
code(ZPConstants.TYPE_FILE, ZPConstants.STATUS_OK);
worker.sendMore(info.path());
sendLong(offset - info.start(), true);
if (info.flushedOffset() - offset < size)
size = info.flushedOffset() - offset;
sendLong(size, false);
if (LOG.isDebugEnabled())
LOG.debug("FETCH {} {} {}", new Object[] {offset, size, offset + size});