Make sure to clear candidate from memory 20/93520/1
authorTomas Cere <tomas.cere@pantheon.tech>
Tue, 3 Nov 2020 11:38:04 +0000 (12:38 +0100)
committerRobert Varga <nite@hq.sk>
Tue, 3 Nov 2020 16:26:38 +0000 (16:26 +0000)
The candidate needs to be cleared even when processing
replicated candidate(ie on a follower) as there is no need
to keep it deserialized in memory

JIRA: CONTROLLER-1928
Change-Id: I1403dbe27def5e0040a8d9f145a92ac06aae9d1e
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
(cherry picked from commit 5a824a836a00ff21a855d7339a2fa9b64678db52)

opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java

index b2549eaf4d70c5abce99a65fa516afdb1991819f..d6b8c02a4d53614d368c55ba5a5e6cad57e1afe4 100644 (file)
@@ -390,7 +390,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
 
     private void applyReplicatedCandidate(final CommitTransactionPayload payload)
             throws DataValidationFailedException, IOException {
-        final Entry<TransactionIdentifier, DataTreeCandidateWithVersion> entry = payload.getCandidate();
+        final Entry<TransactionIdentifier, DataTreeCandidateWithVersion> entry = payload.acquireCandidate();
         final TransactionIdentifier identifier = entry.getKey();
         LOG.debug("{}: Applying foreign transaction {}", logContext, identifier);