Enlarge critical section to cover processNextTransaction()
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / RaftActorRecoverySupport.java
index 0a37ef7a466725eb963aa6253b71c04b217deb10..923e1f1c0daa9001aef9e4b26139097c34544f3d 100644 (file)
@@ -95,7 +95,7 @@ class RaftActorRecoverySupport {
 
                 // Delete all the akka snapshots as they will not be needed
                 persistentProvider.deleteSnapshots(new SnapshotSelectionCriteria(scala.Long.MaxValue(),
-                        scala.Long.MaxValue()));
+                        scala.Long.MaxValue(), 0L, 0L));
 
                 // Since we cleaned out the journal, we need to re-write the current election info.
                 context.getTermInformation().updateAndPersist(context.getTermInformation().getCurrentTerm(),
@@ -177,6 +177,10 @@ class RaftActorRecoverySupport {
         // Apply the snapshot to the actors state
         cohort.applyRecoverySnapshot(snapshot.getState());
 
+        if (snapshot.getServerConfiguration() != null) {
+            context.updatePeerIds(snapshot.getServerConfiguration());
+        }
+
         timer.stop();
         log.info("Recovery snapshot applied for {} in {}: snapshotIndex={}, snapshotTerm={}, journal-size={}",
                 context.getId(), timer.toString(), replicatedLog().getSnapshotIndex(),
@@ -263,7 +267,7 @@ class RaftActorRecoverySupport {
                  replicatedLog().getSnapshotTerm(), replicatedLog().size());
     }
 
-    private boolean isServerConfigurationPayload(ReplicatedLogEntry repLogEntry){
+    private static boolean isServerConfigurationPayload(ReplicatedLogEntry repLogEntry){
         return (repLogEntry.getData() instanceof ServerConfigurationPayload);
     }
 }