Do not enque purges for ask based protocol 37/82137/16
authorTomas Cere <tomas.cere@pantheon.tech>
Thu, 16 May 2019 12:12:01 +0000 (14:12 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 23 May 2019 09:57:17 +0000 (11:57 +0200)
With metadata disabled for ask based protocol, there is no need
to purge transaction on the backend and pollute the journal.

Tell based protocol has purges handled by the fronted so it
should be safe for us to remove them on the backend for ask
protocol.

JIRA: CONTROLLER-1879
Change-Id: Ia5c9470782bb4d59b78bbaa605ee5d36c7fb1644
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java

index a29df3f4b6353374f170a57a0bd5ab19c4f0188a..cc70f7e673046619ee1d91b247d930b3f6c71d67 100644 (file)
@@ -389,8 +389,8 @@ public class ClusterAdminRpcServiceTest {
         // 2 ServerConfigurationPayload entries,  the transaction payload entry plus a purge payload.
 
         RaftStateVerifier verifier = raftState -> {
-            assertEquals("Commit index", 5, raftState.getCommitIndex());
-            assertEquals("Last applied index", 5, raftState.getLastApplied());
+            assertEquals("Commit index", 4, raftState.getCommitIndex());
+            assertEquals("Last applied index", 4, raftState.getLastApplied());
         };
 
         verifyRaftState(leaderNode1.configDataStore(), "cars", verifier);
index 85e1345e0b03e5e765c0640010e59452485d563c..a7ba04f25d5f36a64c4fbb3169a942dfff0cb0f9 100644 (file)
@@ -320,7 +320,6 @@ final class ShardCommitCoordinator {
                 final TransactionIdentifier txId = cohortEntry.getTransactionId();
                 log.debug("{}: Transaction {} committed as {}, sending response to {}", persistenceId(), txId, result,
                     sender);
-                cohortEntry.getShard().getDataStore().purgeTransaction(txId, null);
 
                 cohortCache.remove(cohortEntry.getTransactionId());
                 sender.tell(CommitTransactionReply.instance(cohortEntry.getClientVersion()).toSerializable(),
@@ -331,7 +330,6 @@ final class ShardCommitCoordinator {
             public void onFailure(final Throwable failure) {
                 final TransactionIdentifier txId = cohortEntry.getTransactionId();
                 log.error("{}, An exception occurred while committing transaction {}", persistenceId(), txId, failure);
-                cohortEntry.getShard().getDataStore().purgeTransaction(txId, null);
 
                 cohortCache.remove(cohortEntry.getTransactionId());
                 sender.tell(new Failure(failure), cohortEntry.getShard().self());
@@ -375,8 +373,6 @@ final class ShardCommitCoordinator {
         cohortEntry.abort(new FutureCallback<Void>() {
             @Override
             public void onSuccess(final Void result) {
-                shard.getDataStore().purgeTransaction(cohortEntry.getTransactionId(), null);
-
                 if (sender != null) {
                     sender.tell(AbortTransactionReply.instance(cohortEntry.getClientVersion()).toSerializable(), self);
                 }
@@ -385,7 +381,6 @@ final class ShardCommitCoordinator {
             @Override
             public void onFailure(final Throwable failure) {
                 log.error("{}: An exception happened during abort", name, failure);
-                shard.getDataStore().purgeTransaction(cohortEntry.getTransactionId(), null);
 
                 if (sender != null) {
                     sender.tell(new Failure(failure), self);
index 40285102243c64d01486d1f30f97e3319168df0c..3943e7ee563325f2fb371182ef6d18413b1dd7f9 100644 (file)
@@ -787,10 +787,10 @@ public class DistributedDataStoreRemotingIntegrationTest extends AbstractTest {
         // Wait for the commit to be replicated to the follower.
 
         MemberNode.verifyRaftState(followerDistributedDataStore, "cars",
-            raftState -> assertEquals("getLastApplied", 2, raftState.getLastApplied()));
+            raftState -> assertEquals("getLastApplied", 1, raftState.getLastApplied()));
 
         MemberNode.verifyRaftState(followerDistributedDataStore, "people",
-            raftState -> assertEquals("getLastApplied", 2, raftState.getLastApplied()));
+            raftState -> assertEquals("getLastApplied", 1, raftState.getLastApplied()));
 
         // Prepare, ready and canCommit a WO tx that writes to 2 shards. This will become the current tx in
         // the leader shard.
index 9d4381e145282c547ca4ed326402e104163118bc..46fdfacbe956497db88acba4e9d2de831aa6991e 100644 (file)
@@ -551,7 +551,7 @@ public class ShardTest extends AbstractShardTest {
 
         verifyOuterListEntry(shard, 1);
 
-        verifyLastApplied(shard, 6);
+        verifyLastApplied(shard, 3);
     }
 
     @Test
@@ -1026,8 +1026,8 @@ public class ShardTest extends AbstractShardTest {
         // Committed transaction count should increase as usual
         assertEquals(1, shardStats.getCommittedTransactionsCount());
 
-        // Commit index should advance 2 to account for disabling metadata
-        assertEquals(2, shardStats.getCommitIndex());
+        // Commit index should advance 1 to account for disabling metadata
+        assertEquals(1, shardStats.getCommitIndex());
     }
 
     @Test