private IncompleteCb addIncompleteCompressionBuffer( long cbStartOffset, DiskRangeList target, int extraChunkCount) { IncompleteCb icb = new IncompleteCb(cbStartOffset, target.getEnd()); if (isTracingEnabled) { LOG.trace("Replacing " + target + " (and " + extraChunkCount + " previous chunks) with " + icb + " in the buffers"); } target.replaceSelfWith(icb); return icb; }
private static IncompleteCb addIncompleteCompressionBuffer(long cbStartOffset, DiskRangeList target, int extraChunkCountToLog, boolean isTracingEnabled, IoTrace trace) { IncompleteCb icb = new IncompleteCb(cbStartOffset, target.getEnd()); if (isTracingEnabled) { LOG.trace("Replacing " + target + " (and " + extraChunkCountToLog + " previous chunks) with " + icb + " in the buffers"); } trace.logInvalidOrcCb(cbStartOffset, target.getEnd()); target.replaceSelfWith(icb); return icb; }
/** Splits current element in the list, using DiskRange::slice. * @param cOffset the position to split the list * @return the split list */ public final DiskRangeList split(long cOffset) { DiskRangeList right = insertAfterInternal((DiskRangeList)this.sliceAndShift(cOffset, end, 0)); DiskRangeList left = replaceSelfWith((DiskRangeList)this.sliceAndShift(offset, cOffset, 0)); checkOrder(left, right, left); // Prev/next are already checked in the calls. return left; }
public DiskRangeList getIncompleteCbs( DiskRangeList ranges, long baseOffset, BooleanRef gotAllData) { DiskRangeList prev = ranges.prev; if (prev == null) { prev = new MutateHelper(ranges); } DiskRangeList current = ranges; gotAllData.value = true; // Assume by default that we would find everything. while (current != null) { // We assume ranges in "ranges" are non-overlapping; thus, we will save next in advance. DiskRangeList check = current; current = current.next; if (check.hasData()) continue; Integer badLength = cache.get(Long.valueOf(check.getOffset() + baseOffset)); if (badLength == null || badLength < check.getLength()) { gotAllData.value = false; continue; } // We could just remove here and handle the missing tail during read, but that can be // dangerous; let's explicitly add an incomplete CB. check.replaceSelfWith(new IncompleteCb(check.getOffset(), check.getEnd())); } return prev.next; }
currentNotCached.replaceSelfWith(currentCached); return null; } else {
/** Splits current element in the list, using DiskRange::slice. * @param cOffset the position to split the list * @return the split list */ public final DiskRangeList split(long cOffset) { DiskRangeList right = insertAfterInternal((DiskRangeList)this.sliceAndShift(cOffset, end, 0)); DiskRangeList left = replaceSelfWith((DiskRangeList)this.sliceAndShift(offset, cOffset, 0)); checkOrder(left, right, left); // Prev/next are already checked in the calls. return left; }
BufferChunk bc = new BufferChunk(partial, off); if (!hasReplaced) { range.replaceSelfWith(bc); hasReplaced = true; } else { bb = ByteBuffer.wrap(buffer); range = range.replaceSelfWith(new BufferChunk(bb, range.getOffset()));
BufferChunk bc = new BufferChunk(partial, off); if (!hasReplaced) { range.replaceSelfWith(bc); hasReplaced = true; } else { bb = ByteBuffer.wrap(buffer); range = range.replaceSelfWith(new BufferChunk(bb, range.getOffset()));
BufferChunk bc = new BufferChunk(partial, off); if (!hasReplaced) { range.replaceSelfWith(bc); hasReplaced = true; } else { bb = ByteBuffer.wrap(buffer); range = range.replaceSelfWith(new BufferChunk(bb, range.getOffset()));
public DiskRangeList getIncompleteCbs( DiskRangeList ranges, long baseOffset, BooleanRef gotAllData) { DiskRangeList prev = ranges.prev; if (prev == null) { prev = new MutateHelper(ranges); } DiskRangeList current = ranges; gotAllData.value = true; // Assume by default that we would find everything. while (current != null) { // We assume ranges in "ranges" are non-overlapping; thus, we will save next in advance. DiskRangeList check = current; current = current.next; if (check.hasData()) continue; Integer badLength = cache.get(Long.valueOf(check.getOffset() + baseOffset)); if (badLength == null || badLength < check.getLength()) { gotAllData.value = false; continue; } // We could just remove here and handle the missing tail during read, but that can be // dangerous; let's explicitly add an incomplete CB. check.replaceSelfWith(new IncompleteCb(check.getOffset(), check.getEnd())); } return prev.next; }
range.replaceSelfWith(bc); } else { range.insertAfter(bc);
currentNotCached.replaceSelfWith(currentCached); return null; } else {