Do not enque purges for ask based protocol 22/82222/1
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 10:59:18 +0000 (12:59 +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>
(cherry picked from commit 4944f54d4e1fc24404d55e4ab74b6de212844dcd)
(cherry picked from commit 9ba29cd861d75d328aa67d53726250226dc8e438)

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 8411cd4b71081efaeb65d0d9aeb4abcb49a87bcb..420ce9563865f07cafc1a7cc70f4bc5d3caba3a5 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 76381548eccad988d5a4c852af7708fc7189e01f..8c1704f688347c60fd4e74eddb378cf8bb242b4e 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 cddd4375f48620a3a4e9f57b6bc484ebd9592439..6fd48c534127f2f7770e5aa5426d02b78494c0fb 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 afc27bb7ae9c21d9cbd0ef0f097475556caf3608..71871d579f69ee8a5fdadc6eac71f3e32ab61e04 100644 (file)
@@ -558,7 +558,7 @@ public class ShardTest extends AbstractShardTest {
 
                 verifyOuterListEntry(shard, 1);
 
-                verifyLastApplied(shard, 6);
+                verifyLastApplied(shard, 3);
             }
         };
     }
@@ -1067,8 +1067,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());
             }
         };
     }