BUG-7033: Fix commit exception due to pipe-lining 62/49762/3
authorTom Pantelis <tpanteli@brocade.com>
Thu, 22 Dec 2016 21:57:22 +0000 (16:57 -0500)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 29 Dec 2016 09:48:03 +0000 (09:48 +0000)
commit823bd74f34ee1c651f1f90daeef386a35c68d431
tree378907260a93e7545a83773a5d63ca48a3f2fe10
parent3ed71a2888cb0e38096d9bf15b78213948d1f328
BUG-7033: Fix commit exception due to pipe-lining

The DistributedDataStoreRemotingIntegrationTest#testTransactionWithIsolatedLeader
has failed sporadically on commit with the "Store tree X and candidate
base Y differ" error due to an edge case bug with the pipe-lining. Basically
this occurs if tx 1 is pending completion of replication and tx 2 is progressed
to the COMMIT_PENDING state but the associated DataTreeCandidate has
ModificationType.UNMODIFIED. In that case we elide replication and proceed
immdiately to finishCommit which results in the error due to tx 2 committing
before tx 1. To fix it, I added a new FINISH_COMMIT_PENDING state and call
payloadReplicationComplete, which checks the head of the pendingFinishCommits
queue, when replication is elided..

Change-Id: I5a0d033df131c9c3f4e24670a02a971dec331a4d
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
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/ShardDataTreeCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTest.java