Merge "Bug 2669: Use slf4j Logger instead of akka LoggingAdapter"
authorMoiz Raja <moraja@cisco.com>
Tue, 10 Feb 2015 22:11:40 +0000 (22:11 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 10 Feb 2015 22:11:41 +0000 (22:11 +0000)
1  2 
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java

index 8f33d94700bc4a87231c44ab66758bd7c28bf049,0927b0a5313dd4fc32393cd1b51f44c5007dcb7b..31464c5aff818c7e44bcc2a42527db1af048c061
@@@ -556,7 -556,7 +556,7 @@@ public abstract class AbstractLeader ex
                          // no need to capture snapshot
                          sendSnapshotChunk(followerActor, e.getKey());
  
 -                    } else {
 +                    } else if (!context.isSnapshotCaptureInitiated()) {
                          initiateCaptureSnapshot();
                          //we just need 1 follower who would need snapshot to be installed.
                          // when we have the snapshot captured, we would again check (in SendInstallSnapshot)
          actor().tell(new CaptureSnapshot(lastIndex(), lastTerm(),
                  lastAppliedIndex, lastAppliedTerm, isInstallSnapshotInitiated),
              actor());
 +        context.setSnapshotCaptureInitiated(true);
      }
  
  
                          context.getReplicatedLog().getSnapshotIndex(),
                          context.getReplicatedLog().getSnapshotTerm(),
                          nextSnapshotChunk,
 -                        followerToSnapshot.incrementChunkIndex(),
 -                        followerToSnapshot.getTotalChunks(),
 +                            followerToSnapshot.incrementChunkIndex(),
 +                            followerToSnapshot.getTotalChunks(),
                          Optional.of(followerToSnapshot.getLastChunkHashCode())
                      ).toSerializable(),
                      actor()
                          followerToSnapshot.getTotalChunks());
              }
          } catch (IOException e) {
-             LOG.error(e, "{}: InstallSnapshot failed for Leader.", context.getId());
+             LOG.error("{}: InstallSnapshot failed for Leader.", context.getId(), e);
          }
      }