From 8182b2647acc326e66da9f66fbe69e16435567d6 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 23 May 2019 18:57:00 +0200 Subject: [PATCH] Remove ask-based close transaction chain persistence ask-based protocol has tracking disabled when encountered, hence it does not make sense to persist anything. JIRA: CONTROLLER-1628 Change-Id: I1ec87a9905aa76f3e2a57ae2440c8c693ff60848 Signed-off-by: Robert Varga --- .../controller/cluster/datastore/Shard.java | 5 +---- .../cluster/datastore/ShardDataTree.java | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index 8e00aa6091..ba18ac23e7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -821,10 +821,7 @@ public class Shard extends RaftActor { if (isLeader()) { final LocalHistoryIdentifier id = closeTransactionChain.getIdentifier(); askProtocolEncountered(id.getClientId()); - - // FIXME: CONTROLLER-1628: stage purge once no transactions are present - store.closeTransactionChain(id, null); - store.purgeTransactionChain(id, null); + store.closeTransactionChain(id); } else if (getLeader() != null) { getLeader().forward(closeTransactionChain, getContext()); } else { diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java index 8a3140b43f..c829c035da 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java @@ -592,18 +592,33 @@ public class ShardDataTree extends ShardDataTreeTransactionParent { * @param callback Callback to invoke upon completion, may be null */ void closeTransactionChain(final LocalHistoryIdentifier id, final @Nullable Runnable callback) { + if (commonCloseTransactionChain(id, callback)) { + replicatePayload(id, CloseLocalHistoryPayload.create(id, + shard.getDatastoreContext().getInitialPayloadSerializedBufferCapacity()), callback); + } + } + + /** + * Close a single transaction chain which is received through ask-based protocol. It does not keep a commit record. + * + * @param id History identifier + */ + void closeTransactionChain(final LocalHistoryIdentifier id) { + commonCloseTransactionChain(id, null); + } + + private boolean commonCloseTransactionChain(final LocalHistoryIdentifier id, final @Nullable Runnable callback) { final ShardDataTreeTransactionChain chain = transactionChains.get(id); if (chain == null) { LOG.debug("{}: Closing non-existent transaction chain {}", logContext, id); if (callback != null) { callback.run(); } - return; + return false; } chain.close(); - replicatePayload(id, CloseLocalHistoryPayload.create( - id, shard.getDatastoreContext().getInitialPayloadSerializedBufferCapacity()), callback); + return true; } /** -- 2.36.6