public boolean swapCompactedSegments(VersionedSegmentsList versionedList, ImmutableSegment result, boolean merge) { // last true stands for updating the region size return pipeline.swap(versionedList, result, !merge, true); }
private void pushTailToSnapshot() { VersionedSegmentsList segments = pipeline.getVersionedTail(); pushToSnapshot(segments.getStoreSegments()); // In Swap: don't close segments (they are in snapshot now) and don't update the region size pipeline.swap(segments,null,false, false); }
private void pushPipelineToSnapshot() { int iterationsCnt = 0; boolean done = false; while (!done) { iterationsCnt++; VersionedSegmentsList segments = pipeline.getVersionedList(); pushToSnapshot(segments.getStoreSegments()); // swap can return false in case the pipeline was updated by ongoing compaction // and the version increase, the chance of it happenning is very low // In Swap: don't close segments (they are in snapshot now) and don't update the region size done = pipeline.swap(segments, null, false, false); if (iterationsCnt>2) { // practically it is impossible that this loop iterates more than two times // (because the compaction is stopped and none restarts it while in snapshot request), // however stopping here for the case of the infinite loop causing by any error LOG.warn("Multiple unsuccessful attempts to push the compaction pipeline to snapshot," + " while flushing to disk."); this.snapshot = SegmentFactory.instance().createImmutableSegment(getComparator()); break; } } }