Simplify cutover expression 16/101216/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 18 May 2022 09:39:24 +0000 (11:39 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 18 May 2022 09:40:21 +0000 (11:40 +0200)
Rather than having a !(A&&B), use (!A || !B).

Change-Id: I4acd9a3851640f666eccebb81e6e1bab5ea90d84
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java

index f82bedc4af2083f32aaef42c6e72a729a92dea9c..2778a11a2703927fc760c634e705c09b520e7ce7 100644 (file)
@@ -783,7 +783,7 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
 
         // If the first entry's size exceeds the max data size threshold, it will be returned from the call above. If
         // that is the case, then we need to slice it into smaller chunks.
 
         // If the first entry's size exceeds the max data size threshold, it will be returned from the call above. If
         // that is the case, then we need to slice it into smaller chunks.
-        if (!(entries.size() == 1 && entries.get(0).getData().size() > maxDataSize)) {
+        if (entries.size() != 1 || entries.get(0).getData().size() <= maxDataSize) {
             // Don't need to slice.
             return entries;
         }
             // Don't need to slice.
             return entries;
         }
@@ -904,7 +904,7 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
         }
 
         boolean captureInitiated = context.getSnapshotManager().captureToInstall(context.getReplicatedLog().last(),
         }
 
         boolean captureInitiated = context.getSnapshotManager().captureToInstall(context.getReplicatedLog().last(),
-            this.getReplicatedToAllIndex(), followerId);
+            getReplicatedToAllIndex(), followerId);
         if (captureInitiated) {
             followerLogInfo.setLeaderInstallSnapshotState(new LeaderInstallSnapshotState(
                 context.getConfigParams().getSnapshotChunkSize(), logName()));
         if (captureInitiated) {
             followerLogInfo.setLeaderInstallSnapshotState(new LeaderInstallSnapshotState(
                 context.getConfigParams().getSnapshotChunkSize(), logName()));