jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1499281 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: cache/CacheLIRS.java plugins/mongomk/MongoMK.java
Date Wed, 03 Jul 2013 09:04:34 GMT
Author: thomasm
Date: Wed Jul  3 09:04:33 2013
New Revision: 1499281

URL: http://svn.apache.org/r1499281
Log:
OAK-863 - Disable the LIRS cache by default; fix statistics

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java?rev=1499281&r1=1499280&r2=1499281&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java
Wed Jul  3 09:04:33 2013
@@ -127,8 +127,18 @@ public class CacheLIRS<K, V> implements 
     public void invalidateAll() {
         long max = Math.max(1, maxMemory / segmentCount);
         for (int i = 0; i < segmentCount; i++) {
-            segments[i] = new Segment<K, V>(this,
+            Segment<K, V> old = segments[i];
+            Segment<K, V> s = new Segment<K, V>(this,
                     max, averageMemory, stackMoveDistance);
+            if (old != null) {
+                s.hitCount = old.hitCount;
+                s.missCount = old.missCount;
+                s.loadSuccessCount = old.loadSuccessCount;
+                s.loadExceptionCount = old.loadExceptionCount;
+                s.totalLoadTime = old.totalLoadTime;
+                s.evictionCount = old.evictionCount;
+            }
+            segments[i] = s;
         }
     }
 
@@ -455,8 +465,9 @@ public class CacheLIRS<K, V> implements 
             totalLoadTime += s.totalLoadTime;
             evictionCount += s.evictionCount;
         }
-        return new CacheStats(hitCount, missCount, loadSuccessCount, 
+        CacheStats stats = new CacheStats(hitCount, missCount, loadSuccessCount, 
                 loadExceptionCount, totalLoadTime, evictionCount);
+        return stats;
     }
 
     /**
@@ -750,6 +761,7 @@ public class CacheLIRS<K, V> implements 
             mapSize++;
             // added entries are always added to the stack
             addToStack(e);
+            missCount++;
             return old;
         }
 
@@ -1117,7 +1129,7 @@ public class CacheLIRS<K, V> implements 
     @Override
     @Nullable
     public V getIfPresent(Object key) {
-        return peek((K) key);
+        return get((K) key);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java?rev=1499281&r1=1499280&r2=1499281&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
Wed Jul  3 09:04:33 2013
@@ -80,7 +80,7 @@ public class MongoMK implements MicroKer
      * Enable the LIRS cache.
      */
     static final boolean LIRS_CACHE = Boolean.parseBoolean(
-            System.getProperty("oak.mongoMK.lirsCache", "true"));
+            System.getProperty("oak.mongoMK.lirsCache", "false"));
 
     private static final Logger LOG = LoggerFactory.getLogger(MongoMK.class);
 



Mime
View raw message