try{ if(this.context.getRaftParameters().getSnapshotDistance() > 0 && ((indexCommitted - this.logStore.getStartIndex()) > this.context.getRaftParameters().getSnapshotDistance()) && this.snapshotInProgress.compareAndSet(0, 1)){ snapshotInAction = true; Snapshot currentSnapshot = this.stateMachine.getLastSnapshot(); if(currentSnapshot != null && indexCommitted - currentSnapshot.getLastLogIndex() < this.context.getRaftParameters().getSnapshotDistance()){ this.logger.info("a very recent snapshot is available at index %d, will skip this one", currentSnapshot.getLastLogIndex()); this.snapshotInProgress.set(0);
try{ if(this.context.getRaftParameters().getSnapshotDistance() > 0 && ((indexCommitted - this.logStore.getStartIndex()) > this.context.getRaftParameters().getSnapshotDistance()) && this.snapshotInProgress.compareAndSet(0, 1)){ snapshotInAction = true; Snapshot currentSnapshot = this.stateMachine.getLastSnapshot(); if(currentSnapshot != null && indexCommitted - currentSnapshot.getLastLogIndex() < this.context.getRaftParameters().getSnapshotDistance()){ this.logger.info("a very recent snapshot is available at index %d, will skip this one", currentSnapshot.getLastLogIndex()); this.snapshotInProgress.set(0);
try{ if(this.context.getRaftParameters().getSnapshotDistance() > 0 && ((indexCommitted - this.logStore.getStartIndex()) > this.context.getRaftParameters().getSnapshotDistance()) && this.snapshotInProgress.compareAndSet(0, 1)){ snapshotInAction = true; Snapshot currentSnapshot = this.stateMachine.getLastSnapshot(); if(currentSnapshot != null && indexCommitted - currentSnapshot.getLastLogIndex() < this.context.getRaftParameters().getSnapshotDistance()){ this.logger.info("a very recent snapshot is available at index %d, will skip this one", currentSnapshot.getLastLogIndex()); this.snapshotInProgress.set(0);