cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject [2/3] git commit: update clhm to 1.3 patch by Vijay; reviewed by jbellis for CASSANDRA-4150
Date Mon, 21 May 2012 20:58:09 GMT
update clhm to 1.3
patch by Vijay; reviewed by jbellis for CASSANDRA-4150


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

Branch: refs/heads/trunk
Commit: 02672936f635c93e84ed6625bb994e1628da5a9b
Parents: 3558e45
Author: Vijay Parthasarathy <vijay2win@gmail.com>
Authored: Mon May 21 13:54:03 2012 -0700
Committer: Vijay Parthasarathy <vijay2win@gmail.com>
Committed: Mon May 21 13:56:17 2012 -0700

----------------------------------------------------------------------
 lib/concurrentlinkedhashmap-lru-1.2.jar            |  Bin 53011 -> 0 bytes
 lib/concurrentlinkedhashmap-lru-1.3.jar            |  Bin 0 -> 54345 bytes
 .../cassandra/cache/ConcurrentLinkedHashCache.java |   10 +++---
 .../cache/ConcurrentLinkedHashCacheProvider.java   |    2 +-
 src/java/org/apache/cassandra/cache/ICache.java    |    6 ++--
 .../apache/cassandra/cache/IRowCacheProvider.java  |    2 +-
 .../apache/cassandra/cache/InstrumentingCache.java |    8 +++---
 .../apache/cassandra/cache/SerializingCache.java   |    8 +++---
 .../cassandra/cache/SerializingCacheProvider.java  |    2 +-
 src/java/org/apache/cassandra/config/Config.java   |    4 +-
 .../cassandra/config/DatabaseDescriptor.java       |    6 ++--
 .../org/apache/cassandra/service/CacheService.java |   20 +++++++-------
 .../cassandra/service/CacheServiceMBean.java       |   16 ++++++------
 .../apache/cassandra/cache/CacheProviderTest.java  |    2 +-
 14 files changed, 43 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/lib/concurrentlinkedhashmap-lru-1.2.jar
----------------------------------------------------------------------
diff --git a/lib/concurrentlinkedhashmap-lru-1.2.jar b/lib/concurrentlinkedhashmap-lru-1.2.jar
deleted file mode 100644
index 74e7636..0000000
Binary files a/lib/concurrentlinkedhashmap-lru-1.2.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/lib/concurrentlinkedhashmap-lru-1.3.jar
----------------------------------------------------------------------
diff --git a/lib/concurrentlinkedhashmap-lru-1.3.jar b/lib/concurrentlinkedhashmap-lru-1.3.jar
new file mode 100644
index 0000000..7fbdf9f
Binary files /dev/null and b/lib/concurrentlinkedhashmap-lru-1.3.jar differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java b/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java
index ad651eb..62bd2a4 100644
--- a/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java
+++ b/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java
@@ -49,7 +49,7 @@ public class ConcurrentLinkedHashCache<K, V> implements ICache<K,
V>
      *
      * @return initialized cache
      */
-    public static <K, V> ConcurrentLinkedHashCache<K, V> create(int capacity)
+    public static <K, V> ConcurrentLinkedHashCache<K, V> create(long capacity)
     {
         return create(capacity, Weighers.<V>singleton());
     }
@@ -65,7 +65,7 @@ public class ConcurrentLinkedHashCache<K, V> implements ICache<K,
V>
      *
      * @return initialized cache
      */
-    public static <K, V> ConcurrentLinkedHashCache<K, V> create(int weightedCapacity,
Weigher<V> weigher)
+    public static <K, V> ConcurrentLinkedHashCache<K, V> create(long weightedCapacity,
Weigher<V> weigher)
     {
         ConcurrentLinkedHashMap<K, V> map = new ConcurrentLinkedHashMap.Builder<K,
V>()
                                             .weigher(weigher)
@@ -76,12 +76,12 @@ public class ConcurrentLinkedHashCache<K, V> implements ICache<K,
V>
         return new ConcurrentLinkedHashCache<K, V>(map);
     }
 
-    public int capacity()
+    public long capacity()
     {
         return map.capacity();
     }
 
-    public void setCapacity(int capacity)
+    public void setCapacity(long capacity)
     {
         map.setCapacity(capacity);
     }
@@ -96,7 +96,7 @@ public class ConcurrentLinkedHashCache<K, V> implements ICache<K,
V>
         return map.size();
     }
 
-    public int weightedSize()
+    public long weightedSize()
     {
         return map.weightedSize();
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java b/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java
index 71babd6..cab3df5 100644
--- a/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java
+++ b/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java
@@ -27,7 +27,7 @@ import org.github.jamm.MemoryMeter;
 
 public class ConcurrentLinkedHashCacheProvider implements IRowCacheProvider
 {
-    public ICache<RowCacheKey, IRowCacheEntry> create(int capacity, boolean useMemoryWeigher)
+    public ICache<RowCacheKey, IRowCacheEntry> create(long capacity, boolean useMemoryWeigher)
     {
         return ConcurrentLinkedHashCache.create(capacity, useMemoryWeigher
                                                             ? createMemoryWeigher()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/cache/ICache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/ICache.java b/src/java/org/apache/cassandra/cache/ICache.java
index 5f8e00b..07a7669 100644
--- a/src/java/org/apache/cassandra/cache/ICache.java
+++ b/src/java/org/apache/cassandra/cache/ICache.java
@@ -30,9 +30,9 @@ import java.util.Set;
  */
 public interface ICache<K, V>
 {
-    public int capacity();
+    public long capacity();
 
-    public void setCapacity(int capacity);
+    public void setCapacity(long capacity);
 
     public void put(K key, V value);
 
@@ -46,7 +46,7 @@ public interface ICache<K, V>
 
     public int size();
 
-    public int weightedSize();
+    public long weightedSize();
 
     public void clear();
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/cache/IRowCacheProvider.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/IRowCacheProvider.java b/src/java/org/apache/cassandra/cache/IRowCacheProvider.java
index 9e1eb7c..cb6c0d1 100644
--- a/src/java/org/apache/cassandra/cache/IRowCacheProvider.java
+++ b/src/java/org/apache/cassandra/cache/IRowCacheProvider.java
@@ -27,5 +27,5 @@ import org.apache.cassandra.db.ColumnFamily;
  */
 public interface IRowCacheProvider
 {
-    public ICache<RowCacheKey, IRowCacheEntry> create(int capacity, boolean useMemoryWeigher);
+    public ICache<RowCacheKey, IRowCacheEntry> create(long capacity, boolean useMemoryWeigher);
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/cache/InstrumentingCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/InstrumentingCache.java b/src/java/org/apache/cassandra/cache/InstrumentingCache.java
index b4d048f..405eb09 100644
--- a/src/java/org/apache/cassandra/cache/InstrumentingCache.java
+++ b/src/java/org/apache/cassandra/cache/InstrumentingCache.java
@@ -74,7 +74,7 @@ public class InstrumentingCache<K, V>
         map.remove(key);
     }
 
-    public int getCapacity()
+    public long getCapacity()
     {
         return map.capacity();
     }
@@ -84,12 +84,12 @@ public class InstrumentingCache<K, V>
         return capacitySetManually;
     }
 
-    public void updateCapacity(int capacity)
+    public void updateCapacity(long capacity)
     {
         map.setCapacity(capacity);
     }
 
-    public void setCapacity(int capacity)
+    public void setCapacity(long capacity)
     {
         updateCapacity(capacity);
         capacitySetManually = true;
@@ -100,7 +100,7 @@ public class InstrumentingCache<K, V>
         return map.size();
     }
 
-    public int weightedSize()
+    public long weightedSize()
     {
         return map.weightedSize();
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/cache/SerializingCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/SerializingCache.java b/src/java/org/apache/cassandra/cache/SerializingCache.java
index 08fad20..0754e06 100644
--- a/src/java/org/apache/cassandra/cache/SerializingCache.java
+++ b/src/java/org/apache/cassandra/cache/SerializingCache.java
@@ -49,7 +49,7 @@ public class SerializingCache<K, V> implements ICache<K, V>
     private final ConcurrentLinkedHashMap<K, FreeableMemory> map;
     private final ISerializer<V> serializer;
 
-    public SerializingCache(int capacity, boolean useMemoryWeigher, ISerializer<V>
serializer)
+    public SerializingCache(long capacity, boolean useMemoryWeigher, ISerializer<V>
serializer)
     {
         this.serializer = serializer;
 
@@ -122,12 +122,12 @@ public class SerializingCache<K, V> implements ICache<K, V>
         return freeableMemory;
     }
 
-    public int capacity()
+    public long capacity()
     {
         return map.capacity();
     }
 
-    public void setCapacity(int capacity)
+    public void setCapacity(long capacity)
     {
         map.setCapacity(capacity);
     }
@@ -142,7 +142,7 @@ public class SerializingCache<K, V> implements ICache<K, V>
         return map.size();
     }
 
-    public int weightedSize()
+    public long weightedSize()
     {
         return map.weightedSize();
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java b/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
index 3a06d36..934e7a4 100644
--- a/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
+++ b/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
@@ -31,7 +31,7 @@ import org.apache.cassandra.io.ISerializer;
 
 public class SerializingCacheProvider implements IRowCacheProvider
 {
-    public ICache<RowCacheKey, IRowCacheEntry> create(int capacity, boolean useMemoryWeigher)
+    public ICache<RowCacheKey, IRowCacheEntry> create(long capacity, boolean useMemoryWeigher)
     {
         return new SerializingCache<RowCacheKey, IRowCacheEntry>(capacity, useMemoryWeigher,
new RowCacheSerializer());
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index cb1847e..658c6e6 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -128,11 +128,11 @@ public class Config
     public boolean trickle_fsync = false;
     public int trickle_fsync_interval_in_kb = 10240;
 
-    public Integer key_cache_size_in_mb = null;
+    public Long key_cache_size_in_mb = null;
     public int key_cache_save_period = 14400;
     public int key_cache_keys_to_save = Integer.MAX_VALUE;
 
-    public int row_cache_size_in_mb = 0;
+    public long row_cache_size_in_mb = 0;
     public int row_cache_save_period = 0;
     public int row_cache_keys_to_save = Integer.MAX_VALUE;
     public String row_cache_provider = ConcurrentLinkedHashCacheProvider.class.getSimpleName();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index b6a1d4e..291bc2e 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -83,7 +83,7 @@ public class DatabaseDescriptor
     private static RequestSchedulerId requestSchedulerId;
     private static RequestSchedulerOptions requestSchedulerOptions;
 
-    private static int keyCacheSizeInMB;
+    private static long keyCacheSizeInMB;
     private static IRowCacheProvider rowCacheProvider;
 
     /**
@@ -1019,7 +1019,7 @@ public class DatabaseDescriptor
         return conf.trickle_fsync_interval_in_kb;
     }
 
-    public static int getKeyCacheSizeInMB()
+    public static long getKeyCacheSizeInMB()
     {
         return keyCacheSizeInMB;
     }
@@ -1034,7 +1034,7 @@ public class DatabaseDescriptor
         return conf.key_cache_keys_to_save;
     }
 
-    public static int getRowCacheSizeInMB()
+    public static long getRowCacheSizeInMB()
     {
         return conf.row_cache_size_in_mb;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/service/CacheService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CacheService.java b/src/java/org/apache/cassandra/service/CacheService.java
index 346f75b..bb57801 100644
--- a/src/java/org/apache/cassandra/service/CacheService.java
+++ b/src/java/org/apache/cassandra/service/CacheService.java
@@ -95,7 +95,7 @@ public class CacheService implements CacheServiceMBean
     {
         logger.info("Initializing key cache with capacity of {} MBs.", DatabaseDescriptor.getKeyCacheSizeInMB());
 
-        int keyCacheInMemoryCapacity = DatabaseDescriptor.getKeyCacheSizeInMB() * 1024 *
1024;
+        long keyCacheInMemoryCapacity = DatabaseDescriptor.getKeyCacheSizeInMB() * 1024 *
1024;
 
         // as values are constant size we can use singleton weigher
         // where 48 = 40 bytes (average size of the key) + 8 bytes (size of value)
@@ -122,7 +122,7 @@ public class CacheService implements CacheServiceMBean
                     DatabaseDescriptor.getRowCacheSizeInMB(),
                     DatabaseDescriptor.getRowCacheProvider().getClass().getName());
 
-        int rowCacheInMemoryCapacity = DatabaseDescriptor.getRowCacheSizeInMB() * 1024 *
1024;
+        long rowCacheInMemoryCapacity = DatabaseDescriptor.getRowCacheSizeInMB() * 1024 *
1024;
 
         // cache object
         ICache<RowCacheKey, IRowCacheEntry> rc = DatabaseDescriptor.getRowCacheProvider().create(rowCacheInMemoryCapacity,
true);
@@ -207,17 +207,17 @@ public class CacheService implements CacheServiceMBean
         rowCache.clear();
     }
 
-    public int getRowCacheCapacityInBytes()
+    public long getRowCacheCapacityInBytes()
     {
         return rowCache.getCapacity();
     }
 
-    public int getRowCacheCapacityInMB()
+    public long getRowCacheCapacityInMB()
     {
         return getRowCacheCapacityInBytes() / 1024 / 1024;
     }
 
-    public void setRowCacheCapacityInMB(int capacity)
+    public void setRowCacheCapacityInMB(long capacity)
     {
         if (capacity < 0)
             throw new RuntimeException("capacity should not be negative.");
@@ -225,17 +225,17 @@ public class CacheService implements CacheServiceMBean
         rowCache.setCapacity(capacity * 1024 * 1024);
     }
 
-    public int getKeyCacheCapacityInBytes()
+    public long getKeyCacheCapacityInBytes()
     {
         return keyCache.getCapacity() * AVERAGE_KEY_CACHE_ROW_SIZE;
     }
 
-    public int getKeyCacheCapacityInMB()
+    public long getKeyCacheCapacityInMB()
     {
         return getKeyCacheCapacityInBytes() / 1024 / 1024;
     }
 
-    public void setKeyCacheCapacityInMB(int capacity)
+    public void setKeyCacheCapacityInMB(long capacity)
     {
         if (capacity < 0)
             throw new RuntimeException("capacity should not be negative.");
@@ -243,12 +243,12 @@ public class CacheService implements CacheServiceMBean
         keyCache.setCapacity(capacity * 1024 * 1024 / 48);
     }
 
-    public int getRowCacheSize()
+    public long getRowCacheSize()
     {
         return rowCache.weightedSize();
     }
 
-    public int getKeyCacheSize()
+    public long getKeyCacheSize()
     {
         return keyCache.weightedSize() * AVERAGE_KEY_CACHE_ROW_SIZE;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/src/java/org/apache/cassandra/service/CacheServiceMBean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CacheServiceMBean.java b/src/java/org/apache/cassandra/service/CacheServiceMBean.java
index dfdd623..bf9e46e 100644
--- a/src/java/org/apache/cassandra/service/CacheServiceMBean.java
+++ b/src/java/org/apache/cassandra/service/CacheServiceMBean.java
@@ -46,17 +46,17 @@ public interface CacheServiceMBean
      */
     public void invalidateRowCache();
 
-    public int getRowCacheCapacityInMB();
-    public int getRowCacheCapacityInBytes();
-    public void setRowCacheCapacityInMB(int capacity);
+    public long getRowCacheCapacityInMB();
+    public long getRowCacheCapacityInBytes();
+    public void setRowCacheCapacityInMB(long capacity);
 
-    public int getKeyCacheCapacityInMB();
-    public int getKeyCacheCapacityInBytes();
-    public void setKeyCacheCapacityInMB(int capacity);
+    public long getKeyCacheCapacityInMB();
+    public long getKeyCacheCapacityInBytes();
+    public void setKeyCacheCapacityInMB(long capacity);
 
-    public int getRowCacheSize();
+    public long getRowCacheSize();
 
-    public int getKeyCacheSize();
+    public long getKeyCacheSize();
 
     /**
      * sets each cache's maximum capacity to "reduce_cache_capacity_to" of its current size

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02672936/test/unit/org/apache/cassandra/cache/CacheProviderTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cache/CacheProviderTest.java b/test/unit/org/apache/cassandra/cache/CacheProviderTest.java
index bbecdcd..fcafae2 100644
--- a/test/unit/org/apache/cassandra/cache/CacheProviderTest.java
+++ b/test/unit/org/apache/cassandra/cache/CacheProviderTest.java
@@ -38,7 +38,7 @@ public class CacheProviderTest extends SchemaLoader
     String key3 = "key3";
     String key4 = "key4";
     String key5 = "key5";
-    private static final int CAPACITY = 4;
+    private static final long CAPACITY = 4;
     private String tableName = "Keyspace1";
     private String cfName = "Standard1";
 


Mime
View raw message