Simplify cutover expression 56/101156/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 18 May 2022 09:39:24 +0000 (11:39 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 18 May 2022 12:13:44 +0000 (12:13 +0000)
Rather than having a !(A&&B), use (!A || !B).

Change-Id: I4acd9a3851640f666eccebb81e6e1bab5ea90d84
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit fc18d352c2a4bbd8af3647efbd40b04246e3afae)

opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java

index 6560ad76c3937285300173f16df53f4c60d9ae1d..204a7227392960424695ef966b18da125802d246 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 (!(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;
         }
@@ -904,7 +904,7 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
         }
 
         boolean captureInitiated = context.getSnapshotManager().captureToInstall(context.getReplicatedLog().last(),
-            this.getReplicatedToAllIndex(), followerId);
+            getReplicatedToAllIndex(), followerId);
         if (captureInitiated) {
             followerLogInfo.setLeaderInstallSnapshotState(new LeaderInstallSnapshotState(
                 context.getConfigParams().getSnapshotChunkSize(), logName()));