You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/03/23 18:34:47 UTC

[19/20] usergrid git commit: Update the cache invalidation to be specific for the key and not invalidate the whole cache.

Update the cache invalidation to be specific for the key and not invalidate the whole cache.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/39351f1e
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/39351f1e
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/39351f1e

Branch: refs/heads/release-2.1.1
Commit: 39351f1eb59008348dc2b1812b2cf5159f693721
Parents: 317b182
Author: Michael Russo <mr...@apigee.com>
Authored: Tue Mar 22 20:14:22 2016 -0700
Committer: Michael Russo <mr...@apigee.com>
Committed: Tue Mar 22 20:14:22 2016 -0700

----------------------------------------------------------------------
 .../graph/serialization/impl/shard/NodeShardCache.java        | 2 +-
 .../impl/shard/impl/NodeShardAllocationImpl.java              | 2 +-
 .../serialization/impl/shard/impl/NodeShardCacheImpl.java     | 7 +++----
 .../impl/shard/impl/ShardGroupCompactionImpl.java             | 4 ++--
 4 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/39351f1e/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
index 23c2c25..91c180f 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/NodeShardCache.java
@@ -52,6 +52,6 @@ public interface NodeShardCache {
     Iterator<ShardEntryGroup> getReadShardGroup( final ApplicationScope scope, final long maxTimestamp, final DirectedEdgeMeta directedEdgeMeta  );
 
 
-    void invalidate();
+    void invalidate( final ApplicationScope scope, final DirectedEdgeMeta directedEdgeMeta );
 
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/39351f1e/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
index a6cf378..0c65912 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardAllocationImpl.java
@@ -252,7 +252,7 @@ public class NodeShardAllocationImpl implements NodeShardAllocation {
             }
 
             // invalidate the shard cache so we can be sure that all read shards are up to date
-            nodeShardCache.invalidate();
+            nodeShardCache.invalidate(scope, directedEdgeMeta);
         }
         catch ( ConnectionException e ) {
             throw new RuntimeException( "Unable to connect to casandra", e );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/39351f1e/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
index 5eaaaa0..bbc0431 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/NodeShardCacheImpl.java
@@ -72,8 +72,6 @@ import com.google.inject.Inject;
 @Singleton
 public class NodeShardCacheImpl implements NodeShardCache {
 
-    private static final Logger logger = LoggerFactory.getLogger( NodeShardCacheImpl.class );
-
     /**
      * Only cache shards that have < 10k groups.  This is an arbitrary amount, and may change with profiling and
      * testing
@@ -186,9 +184,10 @@ public class NodeShardCacheImpl implements NodeShardCache {
     }
 
     @Override
-    public void invalidate(){
+    public void invalidate( final ApplicationScope scope, final DirectedEdgeMeta directedEdgeMeta ){
 
-        graphs.invalidateAll();
+        final CacheKey cacheKey = new CacheKey(scope, directedEdgeMeta);
+        graphs.invalidate(cacheKey);
 
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/39351f1e/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupCompactionImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupCompactionImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupCompactionImpl.java
index 7854c3b..b26ee46 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupCompactionImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupCompactionImpl.java
@@ -341,7 +341,7 @@ public class ShardGroupCompactionImpl implements ShardGroupCompaction {
                 shardRemovalRollup.execute();
 
                 // invalidate the shard cache so we can be sure that all read shards are up to date
-                nodeShardCache.invalidate();
+                nodeShardCache.invalidate(scope, edgeMeta);
             }
             catch ( ConnectionException e ) {
                 throw new RuntimeException( "Unable to connect to cassandra", e );
@@ -359,7 +359,7 @@ public class ShardGroupCompactionImpl implements ShardGroupCompaction {
                 updateMark.execute();
 
                 // invalidate the shard cache so we can be sure that all read shards are up to date
-                nodeShardCache.invalidate();
+                nodeShardCache.invalidate(scope, edgeMeta);
             }
             catch ( ConnectionException e ) {
                 throw new RuntimeException( "Unable to connect to cassandra", e );