Bug 2055: Handle shard not initialized resiliently 94/11994/9
authortpantelis <tpanteli@brocade.com>
Sat, 4 Oct 2014 06:37:00 +0000 (02:37 -0400)
committertpantelis <tpanteli@brocade.com>
Sun, 12 Oct 2014 10:10:18 +0000 (06:10 -0400)
commitc8e6e650e2dd0647dbfed665244445cf64c1e262
tree9b42d69b28269e280cc5589f28d2f4f1c0864192
parent1222784937d4cb70662f066779133ab2bdd27cfc
Bug 2055: Handle shard not initialized resiliently

Added a flag to the FindLocalShard and FindPrimaryShard messages to
specify whether or not to wait for he shard to be initialized.

Modified FindLocalShard and FindPrimaryShard message handling in the
ShardManager to wait for the shard to be initialized before replying if
the flag is set in the message. This is done async by caching the
response info in the ShardInformation and sending the response when the
ActorInitialized message for the shard is received.

Modified DistributedDataStore#registerChangeListener to always create a
DataChangeListenerRegistrationProxy and moved the code that performs the
findLocalShard and RegisterChangeListener operations into
DataChangeListenerRegistrationProxy. In DataChangeListenerRegistrationProxy,
the findLocalShard operation is done async (with a long time out). On success,
the RegisterChangeListener message is sent.

Added change listener test to DistributedDataStoreIntegrationTest and
removed the DistributedDataStoreTest since most of the tests tested
registration and the bulk of that logic is now in
DataChangeListenerRegistrationProxy with associated tests. The rest of
the tests in DistributedDataStoreTest are covered by
DistributedDataStoreIntegrationTest.

Change-Id: I9f0d412801110c97eb48ecc4d0fd77ee081a7e81
Signed-off-by: tpantelis <tpanteli@brocade.com>
14 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpCohort.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpDataChangeListenerRegistration.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/LocalShardNotFoundException.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindLocalShard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java