public static void cleanupAndLeaveDirs() throws IOException { mkdirs(); cleanup(); mkdirs(); CommitLog.instance.resetUnsafe(); // cleanup screws w/ CommitLog, this brings it back to safe state }
static CommitLogSegment createSegment(CommitLog commitLog, AbstractCommitLogSegmentManager manager) { Configuration config = commitLog.configuration; CommitLogSegment segment = config.useEncryption() ? new EncryptedSegment(commitLog, manager) : config.useCompression() ? new CompressedSegment(commitLog, manager) : new MemoryMappedSegment(commitLog, manager); segment.writeLogHeader(); return segment; }
/** * Shuts down the threads used by the commit log, blocking until completion. */ public void shutdownBlocking() throws InterruptedException { executor.shutdown(); executor.awaitTermination(); segmentManager.shutdown(); segmentManager.awaitTermination(); }
@Override protected void internalClose() { try { manager.getBufferPool().releaseBuffer(buffer); super.internalClose(); } finally { manager.notifyBufferFreed(); } }
@Override public long getActiveContentSize() { long size = 0; for (CommitLogSegment seg : segmentManager.getActiveSegments()) size += seg.contentSize(); return size; }
/** * On segment creation, flag whether the segment should accept CDC mutations or not based on the total currently * allocated unflushed CDC segments and the contents of cdc_raw */ public CommitLogSegment createSegment() { CommitLogSegment segment = CommitLogSegment.createSegment(commitLog, this); cdcSizeTracker.processNewSegment(segment); return segment; }
ByteBuffer createBuffer(CommitLog commitLog) { // Note: we want to keep the compression buffers on-heap as we need those bytes for encryption, // and we want to avoid copying from off-heap (compression buffer) to on-heap encryption APIs return manager.getBufferPool().createBuffer(BufferType.ON_HEAP); }
static CommitLogSegment createSegment(CommitLog commitLog, AbstractCommitLogSegmentManager manager) { Configuration config = commitLog.configuration; CommitLogSegment segment = config.useEncryption() ? new EncryptedSegment(commitLog, manager) : config.useCompression() ? new CompressedSegment(commitLog, manager) : new MemoryMappedSegment(commitLog, manager); segment.writeLogHeader(); return segment; }
/** * Shuts down the threads used by the commit log, blocking until completion. */ public void shutdownBlocking() throws InterruptedException { executor.shutdown(); executor.awaitTermination(); segmentManager.shutdown(); segmentManager.awaitTermination(); }
@Override public long getActiveContentSize() { long size = 0; for (CommitLogSegment seg : segmentManager.getActiveSegments()) size += seg.contentSize(); return size; }
/** * On segment creation, flag whether the segment should accept CDC mutations or not based on the total currently * allocated unflushed CDC segments and the contents of cdc_raw */ public CommitLogSegment createSegment() { CommitLogSegment segment = CommitLogSegment.createSegment(commitLog, this); cdcSizeTracker.processNewSegment(segment); return segment; }
ByteBuffer createBuffer(CommitLog commitLog) { // Note: we want to keep the compression buffers on-heap as we need those bytes for encryption, // and we want to avoid copying from off-heap (compression buffer) to on-heap encryption APIs return manager.getBufferPool().createBuffer(BufferType.ON_HEAP); }
static CommitLogSegment createSegment(CommitLog commitLog, AbstractCommitLogSegmentManager manager) { Configuration config = commitLog.configuration; CommitLogSegment segment = config.useEncryption() ? new EncryptedSegment(commitLog, manager) : config.useCompression() ? new CompressedSegment(commitLog, manager) : new MemoryMappedSegment(commitLog, manager); segment.writeLogHeader(); return segment; }