public CheckpointManager(ITransactionSubsystem txnSubsystem, CheckpointProperties checkpointProperties) { super(txnSubsystem, checkpointProperties); datasetCheckpointInterval = checkpointProperties.getDatasetCheckpointInterval(); securedLSNs = new HashMap<>(); }
public AbstractCheckpointManager(ITransactionSubsystem txnSubsystem, CheckpointProperties checkpointProperties) { this.txnSubsystem = txnSubsystem; String checkpointDirPath = checkpointProperties.getCheckpointDirPath(); if (LOGGER.isInfoEnabled()) { LOGGER.log(Level.INFO, "Checkpoint directory = " + checkpointDirPath); } if (!checkpointDirPath.endsWith(File.separator)) { checkpointDirPath += File.separator; } checkpointDir = new File(checkpointDirPath); // Create the checkpoint directory if missing if (!checkpointDir.exists()) { if (LOGGER.isInfoEnabled()) { LOGGER.log(Level.INFO, "Checkpoint directory " + checkpointDirPath + " didn't exist. Creating one"); } checkpointDir.mkdirs(); } lsnThreshold = checkpointProperties.getLsnThreshold(); pollFrequency = checkpointProperties.getPollFrequency(); // We must keep at least the latest checkpoint historyToKeep = checkpointProperties.getHistoryToKeep() + 1; persistedResourceRegistry = txnSubsystem.getApplicationContext().getPersistedResourceRegistry(); }
public TransactionSubsystem(INcApplicationContext appCtx, IRecoveryManagerFactory recoveryManagerFactory) { this.appCtx = appCtx; this.id = appCtx.getServiceContext().getNodeId(); this.txnProperties = appCtx.getTransactionProperties(); this.transactionManager = new TransactionManager(this); this.lockManager = new ConcurrentLockManager(txnProperties.getLockManagerShrinkTimer()); final ReplicationProperties repProperties = appCtx.getReplicationProperties(); final boolean replicationEnabled = repProperties.isReplicationEnabled(); final CheckpointProperties checkpointProperties = new CheckpointProperties(txnProperties, id); if (LOGGER.isInfoEnabled()) { LOGGER.log(Level.INFO, "Checkpoint Properties: " + checkpointProperties); } checkpointManager = CheckpointManagerFactory.create(this, checkpointProperties); final Checkpoint latestCheckpoint = checkpointManager.getLatest(); if (latestCheckpoint != null) { transactionManager.ensureMaxTxnId(latestCheckpoint.getMaxTxnId()); } this.logManager = replicationEnabled ? new LogManagerWithReplication(this) : new LogManager(this); this.recoveryManager = recoveryManagerFactory.createRecoveryManager(appCtx.getServiceContext(), this); if (txnProperties.isCommitProfilerEnabled()) { ecp = new EntityCommitProfiler(this, this.txnProperties.getCommitProfilerReportInterval()); ((ExecutorService) appCtx.getThreadExecutor()).submit(ecp); } }