BUG-8639: always invalidate primary info cache 73/62973/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 11 Sep 2017 14:03:58 +0000 (16:03 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 11 Sep 2017 14:28:36 +0000 (16:28 +0200)
When we remove local shard, make sure we invalidate the associated
cache entry.

Change-Id: I83d6320e7308fe9bdf9c66c928fa91198674eae1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ModuleShardBackendResolver.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java

index f0775ba..ee549d3 100644 (file)
@@ -108,6 +108,9 @@ final class ModuleShardBackendResolver extends AbstractShardBackendResolver {
             if (failure != null) {
                 LOG.debug("Resolution of cookie {} shard {} failed, removing state", cookie, shardName, failure);
                 backends.remove(cookie, toInsert);
+
+                // Remove cache state in case someone else forgot to invalidate it
+                flushCache(shardName);
             }
         });
 
index 6a91bf7..781f7c9 100644 (file)
@@ -519,6 +519,9 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                     }
 
                     self().tell((RunnableMessage) () -> {
+                        // At any rate, invalidate primaryShardInfo cache
+                        primaryShardInfoCache.remove(shardName);
+
                         shardActorsStopping.remove(shardName);
                         notifyOnCompleteTasks(failure, result);
                     }, ActorRef.noSender());

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.