protected void maybeWaitForSync(CommitLogSegment.Allocation alloc) { long expectedSyncTime = System.nanoTime() - blockWhenSyncLagsNanos; if (lastSyncedAt < expectedSyncTime) { pending.incrementAndGet(); awaitSyncAt(expectedSyncTime, commitLog.metrics.waitingOnCommit.time()); pending.decrementAndGet(); } } }
protected void maybeWaitForSync(CommitLogSegment.Allocation alloc) { if (waitForSyncToCatchUp(Long.MAX_VALUE)) { // wait until periodic sync() catches up with its schedule long started = System.currentTimeMillis(); pending.incrementAndGet(); while (waitForSyncToCatchUp(started)) { WaitQueue.Signal signal = syncComplete.register(CommitLog.instance.metrics.waitingOnCommit.time()); if (waitForSyncToCatchUp(started)) signal.awaitUninterruptibly(); else signal.cancel(); } 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) { long expectedSyncTime = System.nanoTime() - blockWhenSyncLagsNanos; if (lastSyncedAt < expectedSyncTime) { pending.incrementAndGet(); awaitSyncAt(expectedSyncTime, commitLog.metrics.waitingOnCommit.time()); 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) { long expectedSyncTime = System.nanoTime() - blockWhenSyncLagsNanos; if (lastSyncedAt < expectedSyncTime) { pending.incrementAndGet(); awaitSyncAt(expectedSyncTime, commitLog.metrics.waitingOnCommit.time()); pending.decrementAndGet(); } } }