/** * param @ table - name of table for which we are maintaining this commit log. param @ * recoverymode - is commit log being instantiated in in recovery mode. */ private CommitLog() { try { DatabaseDescriptor.createAllDirectories(); segmentSize = DatabaseDescriptor.getCommitLogSegmentSize(); } catch (IOException e) { throw new IOError(e); } // all old segments are recovered and deleted before CommitLog is instantiated. // All we need to do is create a new one. segments.add(new CommitLogSegment()); executor = DatabaseDescriptor.getCommitLogSync() == Config.CommitLogSync.batch ? new BatchCommitLogExecutorService() : new PeriodicCommitLogExecutorService(this); }
@VisibleForTesting CommitLog(String location, CommitLogArchiver archiver) { compressorClass = DatabaseDescriptor.getCommitLogCompression(); this.location = location; ICompressor compressor = compressorClass != null ? CompressionParameters.createCompressor(compressorClass) : null; DatabaseDescriptor.createAllDirectories(); this.compressor = compressor; this.archiver = archiver; metrics = new CommitLogMetrics(); executor = DatabaseDescriptor.getCommitLogSync() == Config.CommitLogSync.batch ? new BatchCommitLogService(this) : new PeriodicCommitLogService(this); allocator = new CommitLogSegmentManager(this); // register metrics metrics.attach(executor, allocator); }
private static void mkdirs() { DatabaseDescriptor.createAllDirectories(); }