Bug 3194: Dynamically update PrimaryShardInfo cache when leader changes 71/20571/9
authorTom Pantelis <tpanteli@brocade.com>
Thu, 14 May 2015 16:40:48 +0000 (12:40 -0400)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 26 May 2015 15:14:09 +0000 (15:14 +0000)
commit7fbe47abd15ea486c69c08f20c4cb21324775c3f
treeb9928971e968cc14288c3169bae579d521dff858
parente60d699bfe040f3ce570b4e634b0612eadeaca45
Bug 3194: Dynamically update PrimaryShardInfo cache when leader changes

Added a PrimaryShardInfoFutureCache class which maintains the cache of
PrimaryShardInfo Future instances per shard. This code was moved from the ActorContext.

The PrimaryShardInfoFutureCache instance is created by the
DistributedDataStore and passed to the ShardManager, as well as to the
ActorContext. The ActorContext uses the cache as before.

On ShardLeaderChanged message, if the leaderId has changed, the
ShardManager calls remove on the PrimaryShardInfoFutureCache to
invalidate the entry for the shard name.

As part of this patch some refactoring was done which removed ShardInfoListeners.

There are a few miscellaneous changes in this patch as well,
- Create the appropriate type of transaction on the datatree for local transactions
- Tracking only read-only transactions which phantom references

Change-Id: I4c7a3845e311e5130d80f22f7cfb3c82c5ad731d
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
22 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContextFactory.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/LocalTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionFactoryImpl.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/TransactionChainProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextFactory.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/main/java/org/opendaylight/controller/cluster/datastore/utils/PrimaryShardInfoFutureCache.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ShardInfoListener.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ShardInfoListenerRegistration.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionProxyTest.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/DistributedDataStoreRemotingIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/IntegrationTestKit.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/LocalTransactionContextTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTestKit.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/PrimaryShardInfoFutureCacheTest.java [new file with mode: 0644]