lastLogEntryIndex = lastLogEntry.getIndex();
lastLogEntryTerm = lastLogEntry.getTerm();
} else {
- LOG.warn("Capturing Snapshot : lastLogEntry is null. Using lastAppliedIndex {} and lastAppliedTerm {} instead.",
- lastAppliedIndex, lastAppliedTerm);
+ LOG.debug("{}: Capturing Snapshot : lastLogEntry is null. Using lastAppliedIndex {} and lastAppliedTerm {} instead.",
+ persistenceId(), lastAppliedIndex, lastAppliedTerm);
}
return new CaptureSnapshot(lastLogEntryIndex, lastLogEntryTerm, lastAppliedIndex, lastAppliedTerm,
lastSequenceNumber = context.getPersistenceProvider().getLastSequenceNumber();
- LOG.debug("lastSequenceNumber prior to capture: {}", lastSequenceNumber);
+ LOG.debug("{}: lastSequenceNumber prior to capture: {}", persistenceId(), lastSequenceNumber);
SnapshotManager.this.currentState = CREATING;
captureSnapshot.getLastIndex(), captureSnapshot.getLastTerm(),
captureSnapshot.getLastAppliedIndex(), captureSnapshot.getLastAppliedTerm(),
context.getTermInformation().getCurrentTerm(),
- context.getTermInformation().getVotedFor(), context.getPeerServerInfo());
+ context.getTermInformation().getVotedFor(), context.getPeerServerInfo(true));
context.getPersistenceProvider().saveSnapshot(snapshot);
@Override
public void commit(long sequenceNumber, RaftActorBehavior currentBehavior) {
- LOG.debug("Snapshot success sequence number: {}", sequenceNumber);
+ LOG.debug("{}: Snapshot success - sequence number: {}", persistenceId(), sequenceNumber);
if(applySnapshot != null) {
try {
applySnapshot.getCallback().onSuccess();
} catch (Exception e) {
- LOG.error("Error applying snapshot", e);
+ LOG.error("{}: Error applying snapshot", context.getId(), e);
}
} else {
context.getReplicatedLog().snapshotCommit();
}
context.getPersistenceProvider().deleteSnapshots(new SnapshotSelectionCriteria(
- sequenceNumber - context.getConfigParams().getSnapshotBatchCount(), 43200000));
+ sequenceNumber - context.getConfigParams().getSnapshotBatchCount(), Long.MAX_VALUE, 0L, 0L));
context.getPersistenceProvider().deleteMessages(lastSequenceNumber);