Bug 3194: Dynamically update PrimaryShardInfo cache when leader changes 48/21148/2
authorTom Pantelis <tpanteli@brocade.com>
Thu, 14 May 2015 16:40:48 +0000 (12:40 -0400)
committerMoiz Raja <moraja@cisco.com>
Tue, 26 May 2015 16:26:40 +0000 (16:26 +0000)
commitd3a97264ecf47e8c60ea11a7caebce41b580e91d
tree5ac580ac73d3cad9b07b68ded65afe519ca622b4
parent5133f3d0a92e89d863000858d639baa20bb688d5
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>
(cherry picked from commit 7fbe47abd15ea486c69c08f20c4cb21324775c3f)
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]