Bug:3260-Recovery misses flows installed on single node
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / SnapshotManager.java
index 9a916625c9331413685d6263bfe053930b6795bf..9bbe285c29e863c885c88933c7f82fd7d739a704 100644 (file)
@@ -82,6 +82,10 @@ public class SnapshotManager implements SnapshotState {
         this.createSnapshotProcedure = createSnapshotProcedure;
     }
 
+    public long getLastSequenceNumber() {
+        return lastSequenceNumber;
+    }
+
     @VisibleForTesting
     public CaptureSnapshot getCaptureSnapshot() {
         return captureSnapshot;
@@ -319,6 +323,7 @@ public class SnapshotManager implements SnapshotState {
 
         @Override
         public void commit(long sequenceNumber) {
+            LOG.debug("Snapshot success sequence number:", sequenceNumber);
             context.getReplicatedLog().snapshotCommit();
             context.getPersistenceProvider().deleteSnapshots(new SnapshotSelectionCriteria(
                     sequenceNumber - context.getConfigParams().getSnapshotBatchCount(), 43200000));
@@ -365,6 +370,8 @@ public class SnapshotManager implements SnapshotState {
             this.term = -1L;
             if (!hasFollowers) {
                 if(lastLogEntry != null) {
+                    // since we have persisted the last-log-entry to persistent journal before the capture,
+                    // we would want to snapshot from this entry.
                     index = lastLogEntry.getIndex();
                     term = lastLogEntry.getTerm();
                 }