Fixup "Leader should always apply modifications as local" regression 16/87616/4
authorTomas Cere <tomas.cere@pantheon.tech>
Wed, 12 Feb 2020 12:23:22 +0000 (13:23 +0100)
committerTomas Cere <tomas.cere@pantheon.tech>
Fri, 20 Mar 2020 11:38:07 +0000 (11:38 +0000)
commit78d3eea7d730f07f89c36fe24afbf51781a21bc3
tree55eb8d5f489bb50c08baf34b01391ce8b398adf5
parent8da08c9f008d371c491cf6b35494ca36c2ebdcb9
Fixup "Leader should always apply modifications as local" regression

This reintroduces the original commit:
 e66759266dc43d5f58b2837aca5047b42c205e4a
and fixes up the two bugs it introduced.

First one didn't account for the fact that the new leader might have not
tracked forwarded transactions from the previous leader which would
be ignored. Previously not tracked transactions are now applied
normally on the new leader.

Second issue was that we started keeping around deserialized
candidates in memory in each CommitTransactionPayload even after they
were applied and no longer needed.During the final use of the
candidate in ShardDataTree the candidate is now clearedduring
CommitTransactionPayload.acquireCandidate() which allows the
deserialized candidate to be cleared by GC.

JIRA: CONTROLLER-1927
JIRA: CONTROLLER-1928
Change-Id: I47876d4d29a8e9b6b9283d70e47108f3dc2ed3ee
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
17 files changed:
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Candidate.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Follower.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/IdentifiablePayload.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractIdentifiablePayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/CommitTransactionPayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardInformation.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/TestClientBackedDataStore.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/LocalShardStore.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TestDistributedDataStore.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TestShard.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/TestShardManager.java