BUG 5690 : No owner present even when entity has a candidate 68/37368/2
authorMoiz Raja <moraja@cisco.com>
Fri, 8 Apr 2016 18:09:50 +0000 (11:09 -0700)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 11 Apr 2016 14:17:08 +0000 (14:17 +0000)
commitacbbcc0278c08cf49d71a35b776608fee9e7d417
tree1b799491038f76600f286ad727b9a5ff9275ed0e
parent630cb61cc1e51a486785162995eab7b541fcf237
BUG 5690 : No owner present even when entity has a candidate

If a candidate for an entity is removed and another added in quick
succession it can leave the owner of the entity blank. This happens
because the BatchedModifications for candidate removal happen one
after another which results in the commit of those modifications.
The BatchedModification which writes an owner on removal is committed
only after the addition of the new candidate. In this scenario when
the new candidate is added it finds that there is still an owner
for that entity and so it does not assign a new owner for that entity.

To fix this problem in onCandidateAdded we check if the currentOwner
is present in the current candidate list and if it is not then we
choose a new owner.

Change-Id: I47f90314e018e25f2c1dac82342b931c4e2d882d
Signed-off-by: Moiz Raja <moraja@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShard.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipIntegrationTest.java