From 4944f54d4e1fc24404d55e4ab74b6de212844dcd Mon Sep 17 00:00:00 2001 From: Tomas Cere Date: Thu, 16 May 2019 14:12:01 +0200 Subject: [PATCH] Do not enque purges for ask based protocol 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 --- .../cluster/datastore/admin/ClusterAdminRpcServiceTest.java | 4 ++-- .../cluster/datastore/ShardCommitCoordinator.java | 5 ----- .../DistributedDataStoreRemotingIntegrationTest.java | 4 ++-- .../controller/cluster/datastore/ShardTest.java | 6 +++--- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java b/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java index a29df3f4b6..cc70f7e673 100644 --- a/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java +++ b/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java @@ -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); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java index 85e1345e0b..a7ba04f25d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java @@ -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() { @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); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java index 4028510224..3943e7ee56 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreRemotingIntegrationTest.java @@ -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. diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java index 9d4381e145..46fdfacbe9 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java @@ -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 -- 2.36.6