protected void maybeWaitForSync(CommitLogSegment.Allocation alloc) { // wait until record has been safely persisted to disk pending.incrementAndGet(); requestExtraSync(); alloc.awaitDiskSync(commitLog.metrics.waitingOnCommit); pending.decrementAndGet(); } }
private CommitLog() { DatabaseDescriptor.createAllDirectories(); allocator = new CommitLogSegmentManager(); executor = DatabaseDescriptor.getCommitLogSync() == Config.CommitLogSync.batch ? new BatchCommitLogService(this) : new PeriodicCommitLogService(this); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { mbs.registerMBean(this, new ObjectName("org.apache.cassandra.db:type=Commitlog")); } catch (Exception e) { throw new RuntimeException(e); } // register metrics metrics = new CommitLogMetrics(executor, allocator); }
@VisibleForTesting CommitLog(CommitLogArchiver archiver) { this.configuration = new Configuration(DatabaseDescriptor.getCommitLogCompression(), DatabaseDescriptor.getEncryptionContext()); DatabaseDescriptor.createAllDirectories(); this.archiver = archiver; metrics = new CommitLogMetrics(); executor = DatabaseDescriptor.getCommitLogSync() == Config.CommitLogSync.batch ? new BatchCommitLogService(this) : new PeriodicCommitLogService(this); segmentManager = DatabaseDescriptor.isCDCEnabled() ? new CommitLogSegmentManagerCDC(this, DatabaseDescriptor.getCommitLogLocation()) : new CommitLogSegmentManagerStandard(this, DatabaseDescriptor.getCommitLogLocation()); // register metrics metrics.attach(executor, segmentManager); }
@VisibleForTesting CommitLog(CommitLogArchiver archiver) { this.configuration = new Configuration(DatabaseDescriptor.getCommitLogCompression(), DatabaseDescriptor.getEncryptionContext()); DatabaseDescriptor.createAllDirectories(); this.archiver = archiver; metrics = new CommitLogMetrics(); executor = DatabaseDescriptor.getCommitLogSync() == Config.CommitLogSync.batch ? new BatchCommitLogService(this) : new PeriodicCommitLogService(this); segmentManager = DatabaseDescriptor.isCDCEnabled() ? new CommitLogSegmentManagerCDC(this, DatabaseDescriptor.getCommitLogLocation()) : new CommitLogSegmentManagerStandard(this, DatabaseDescriptor.getCommitLogLocation()); // register metrics metrics.attach(executor, segmentManager); }
protected void maybeWaitForSync(CommitLogSegment.Allocation alloc) { // wait until record has been safely persisted to disk pending.incrementAndGet(); requestExtraSync(); alloc.awaitDiskSync(commitLog.metrics.waitingOnCommit); pending.decrementAndGet(); } }
@VisibleForTesting CommitLog(CommitLogArchiver archiver) { this.configuration = new Configuration(DatabaseDescriptor.getCommitLogCompression(), DatabaseDescriptor.getEncryptionContext()); DatabaseDescriptor.createAllDirectories(); this.archiver = archiver; metrics = new CommitLogMetrics(); executor = DatabaseDescriptor.getCommitLogSync() == Config.CommitLogSync.batch ? new BatchCommitLogService(this) : new PeriodicCommitLogService(this); segmentManager = DatabaseDescriptor.isCDCEnabled() ? new CommitLogSegmentManagerCDC(this, DatabaseDescriptor.getCommitLogLocation()) : new CommitLogSegmentManagerStandard(this, DatabaseDescriptor.getCommitLogLocation()); // register metrics metrics.attach(executor, segmentManager); }
protected void maybeWaitForSync(CommitLogSegment.Allocation alloc) { // wait until record has been safely persisted to disk pending.incrementAndGet(); requestExtraSync(); alloc.awaitDiskSync(commitLog.metrics.waitingOnCommit); pending.decrementAndGet(); } }