BUG-5626: remove ApplyLogEntries 88/38988/5
authorRobert Varga <rovarga@cisco.com>
Tue, 17 May 2016 16:09:24 +0000 (18:09 +0200)
committerRobert Varga <rovarga@cisco.com>
Fri, 20 May 2016 08:41:47 +0000 (10:41 +0200)
This class has been held back by the now-removed payloads,
hence it is safe to remove.

Change-Id: Ib341dfbf5d4b80b53eb91da57db4a2d80e90d757
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyLogEntries.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupportTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RaftActorTest.java

index ae7fdea..1c86dcb 100644 (file)
@@ -16,7 +16,6 @@ import java.io.ObjectInputStream;
 import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.PersistentDataProvider;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyJournalEntries;
-import org.opendaylight.controller.cluster.raft.base.messages.ApplyLogEntries;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
 import org.opendaylight.controller.cluster.raft.base.messages.DeleteEntries;
 import org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm;
@@ -64,9 +63,6 @@ class RaftActorRecoverySupport {
                 onRecoveredSnapshot((SnapshotOffer) message);
             } else if (message instanceof ReplicatedLogEntry) {
                 onRecoveredJournalLogEntry((ReplicatedLogEntry) message);
-            } else if (message instanceof ApplyLogEntries) {
-                // Handle this message for backwards compatibility with pre-Lithium versions.
-                onRecoveredApplyLogEntries(((ApplyLogEntries) message).getToIndex());
             } else if (message instanceof ApplyJournalEntries) {
                 onRecoveredApplyLogEntries(((ApplyJournalEntries) message).getToIndex());
             } else if (message instanceof DeleteEntries) {
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyLogEntries.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyLogEntries.java
deleted file mode 100644 (file)
index 744d009..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.cluster.raft.base.messages;
-
-import java.io.Serializable;
-
-/**
- * ApplyLogEntries serves as a message which is stored in the akka's persistent
- * journal.
- * During recovery if this message is found, then all in-mem journal entries from
- * context.lastApplied to ApplyLogEntries.toIndex are applied to the state
- *
- * This class is also used as a internal message sent from Behaviour to
- * RaftActor to persist the ApplyLogEntries
- *
- * @deprecated Deprecated in favor of ApplyJournalEntries whose type for toIndex is long instead of int.
- *             This class was kept for backwards compatibility with Helium.
- */
-@Deprecated
-public class ApplyLogEntries implements Serializable {
-    private final int toIndex;
-
-    public ApplyLogEntries(int toIndex) {
-        this.toIndex = toIndex;
-    }
-
-    public int getToIndex() {
-        return toIndex;
-    }
-}
index b4497fd..89c0a1e 100644 (file)
@@ -37,7 +37,6 @@ import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.PersistentDataProvider;
 import org.opendaylight.controller.cluster.raft.ServerConfigurationPayload.ServerInfo;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyJournalEntries;
-import org.opendaylight.controller.cluster.raft.base.messages.ApplyLogEntries;
 import org.opendaylight.controller.cluster.raft.base.messages.DeleteEntries;
 import org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
@@ -159,18 +158,6 @@ public class RaftActorRecoverySupportTest {
         inOrder.verifyNoMoreInteractions();
     }
 
-    @Test
-    public void testOnApplyLogEntries() {
-        ReplicatedLog replicatedLog = context.getReplicatedLog();
-        replicatedLog.append(new MockRaftActorContext.MockReplicatedLogEntry(1,
-                0, new MockRaftActorContext.MockPayload("0")));
-
-        sendMessageToSupport(new ApplyLogEntries(0));
-
-        assertEquals("Last applied", 0, context.getLastApplied());
-        assertEquals("Commit index", 0, context.getCommitIndex());
-    }
-
     @Test
     public void testOnSnapshotOffer() {
 
index 319970e..7457e71 100644 (file)
@@ -65,7 +65,6 @@ import org.opendaylight.controller.cluster.notifications.RoleChanged;
 import org.opendaylight.controller.cluster.raft.MockRaftActorContext.MockPayload;
 import org.opendaylight.controller.cluster.raft.ServerConfigurationPayload.ServerInfo;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyJournalEntries;
-import org.opendaylight.controller.cluster.raft.base.messages.ApplyLogEntries;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshot;
@@ -310,9 +309,6 @@ public class RaftActorTest extends AbstractActorTest {
         ApplyJournalEntries applyJournalEntries = new ApplyJournalEntries(2);
         mockRaftActor.handleRecover(applyJournalEntries);
 
-        ApplyLogEntries applyLogEntries = new ApplyLogEntries(0);
-        mockRaftActor.handleRecover(applyLogEntries);
-
         DeleteEntries deleteEntries = new DeleteEntries(1);
         mockRaftActor.handleRecover(deleteEntries);
 
@@ -330,7 +326,6 @@ public class RaftActorTest extends AbstractActorTest {
         verify(mockSupport).handleRecoveryMessage(same(snapshotOffer), any(PersistentDataProvider.class));
         verify(mockSupport).handleRecoveryMessage(same(logEntry), any(PersistentDataProvider.class));
         verify(mockSupport).handleRecoveryMessage(same(applyJournalEntries), any(PersistentDataProvider.class));
-        verify(mockSupport).handleRecoveryMessage(same(applyLogEntries), any(PersistentDataProvider.class));
         verify(mockSupport).handleRecoveryMessage(same(deleteEntries), any(PersistentDataProvider.class));
         verify(mockSupport).handleRecoveryMessage(same(deprecatedDeleteEntries), any(PersistentDataProvider.class));
         verify(mockSupport).handleRecoveryMessage(same(updateElectionTerm), any(PersistentDataProvider.class));