Bug 8385: Fix testMultipleRegistrationsAtOnePrefix failure 74/56774/2
authorTom Pantelis <tompantelis@gmail.com>
Tue, 9 May 2017 12:29:07 +0000 (08:29 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Wed, 10 May 2017 13:33:07 +0000 (13:33 +0000)
commitbd8ae452ab45390645d48e0967156c96ce70a2b9
tree79eb4a0807f9c1858723b0d8468b998796e8605f
parent150486bc3c2deeadf2e39b4e33e74f4dd273e06a
Bug 8385: Fix testMultipleRegistrationsAtOnePrefix failure

The previous patch added a callback on the Future returned by
gracefulStop on shard removal. The timout was set to 3 * election timeout
which is 30 s in production by default. For the tests the election
timeout is 500 ms so the timeout is 1500 ms. However, if the timing is right,
the leader may not be able to transfer leadership on shutdown if the other
member was already shutdown. On shutdown there's a 2 sec wait to hear from
a new leader - this is greater than the 1500 ms shutdown timeout which
leads to test failure. To alleviate this, I made 10 s the minimum for the
shutdown timeout.

Another problem was that, after the stop future failed, the OnComplete
callback for PrefixShardCreated was repeated many times before the
OnComplete callback queued the message to remove the Future from the map.
To alleviate this, I added a CompositeOnComplete containing a list of
deferred OnComplete tasks. This allows the control to remove the entry
from the map before the deferred tasks run.

Change-Id: I899518e6d7e92533d2c4008a978ac772b02863cf
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
(cherry picked from commit 6ef8a6b4e403d5908e7090a5bd387f81c10c91c6)
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/CompositeOnComplete.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeRemotingTest.java