cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From goffi...@apache.org
Subject svn commit: r1130863 - in /cassandra/branches/cassandra-0.8: src/java/org/apache/cassandra/cache/ src/java/org/apache/cassandra/db/ test/unit/org/apache/cassandra/cache/
Date Thu, 02 Jun 2011 22:51:14 GMT
Author: goffinet
Date: Thu Jun  2 22:51:14 2011
New Revision: 1130863

URL: http://svn.apache.org/viewvc?rev=1130863&view=rev
Log:
Support passing tableName and cfName to RowCacheProviders
Patch by goffinet, reviewed by stuhood for CASSANDRA-2702

Modified:
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/IRowCacheProvider.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCache.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cache/CacheProviderTest.java

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java?rev=1130863&r1=1130862&r2=1130863&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java
Thu Jun  2 22:51:14 2011
@@ -40,7 +40,7 @@ public class ConcurrentLinkedHashCache<K
         this.map = map;
     }
 
-    public static <K, V> ConcurrentLinkedHashCache<K, V> create(int capacity)
+    public static <K, V> ConcurrentLinkedHashCache<K, V> create(int capacity,
String tableName, String cfname)
     {
         ConcurrentLinkedHashMap<K, V> map = new ConcurrentLinkedHashMap.Builder<K,
V>()
                                             .weigher(Weighers.<V>singleton())

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java?rev=1130863&r1=1130862&r2=1130863&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java
Thu Jun  2 22:51:14 2011
@@ -27,8 +27,8 @@ import org.apache.cassandra.db.Decorated
 
 public class ConcurrentLinkedHashCacheProvider implements IRowCacheProvider
 {
-    public ICache<DecoratedKey, ColumnFamily> create(int capacity)
+    public ICache<DecoratedKey, ColumnFamily> create(int capacity, String tableName,
String cfName)
     {
-        return ConcurrentLinkedHashCache.create(capacity);
+        return ConcurrentLinkedHashCache.create(capacity, tableName, cfName);
     }
 }

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/IRowCacheProvider.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/IRowCacheProvider.java?rev=1130863&r1=1130862&r2=1130863&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/IRowCacheProvider.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/IRowCacheProvider.java
Thu Jun  2 22:51:14 2011
@@ -29,5 +29,5 @@ import org.apache.cassandra.db.Decorated
  */
 public interface IRowCacheProvider
 {
-    public ICache<DecoratedKey, ColumnFamily> create(int capacity);
+    public ICache<DecoratedKey, ColumnFamily> create(int capacity, String tableName,
String cfName);
 }

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCache.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCache.java?rev=1130863&r1=1130862&r2=1130863&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCache.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCache.java
Thu Jun  2 22:51:14 2011
@@ -47,7 +47,7 @@ public class SerializingCache<K, V> impl
     private final ConcurrentLinkedHashMap<K, FreeableMemory> map;
     private final ICompactSerializer3<V> serializer;
 
-    public SerializingCache(int capacity, ICompactSerializer3<V> serializer)
+    public SerializingCache(int capacity, ICompactSerializer3<V> serializer, String
tableName, String cfName)
     {
         this.serializer = serializer;
 

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java?rev=1130863&r1=1130862&r2=1130863&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
Thu Jun  2 22:51:14 2011
@@ -41,8 +41,8 @@ public class SerializingCacheProvider im
         }
     }
 
-    public ICache<DecoratedKey, ColumnFamily> create(int capacity)
+    public ICache<DecoratedKey, ColumnFamily> create(int capacity, String tableName,
String cfName)
     {
-        return new SerializingCache<DecoratedKey, ColumnFamily>(capacity, ColumnFamily.serializer());
+        return new SerializingCache<DecoratedKey, ColumnFamily>(capacity, ColumnFamily.serializer(),
tableName, cfName);
     }
 }

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1130863&r1=1130862&r2=1130863&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Thu Jun  2 22:51:14 2011
@@ -262,9 +262,9 @@ public class ColumnFamilyStore implement
         if (logger.isDebugEnabled())
             logger.debug("Starting CFS {}", columnFamily);
 
-        ICache<Pair<Descriptor, DecoratedKey>, Long> kc = ConcurrentLinkedHashCache.create(0);
+        ICache<Pair<Descriptor, DecoratedKey>, Long> kc = ConcurrentLinkedHashCache.create(0,
table.name, columnFamilyName);
         keyCache = new AutoSavingKeyCache<Pair<Descriptor, DecoratedKey>, Long>(kc,
table.name, columnFamilyName);
-        ICache<DecoratedKey, ColumnFamily> rc = metadata.getRowCacheProvider().create(0);
       
+        ICache<DecoratedKey, ColumnFamily> rc = metadata.getRowCacheProvider().create(0,
table.name, columnFamilyName);
         rowCache = new AutoSavingRowCache<DecoratedKey, ColumnFamily>(rc, table.name,
columnFamilyName);
 
         // scan for sstables corresponding to this cf and load them

Modified: cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cache/CacheProviderTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cache/CacheProviderTest.java?rev=1130863&r1=1130862&r2=1130863&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cache/CacheProviderTest.java
(original)
+++ cassandra/branches/cassandra-0.8/test/unit/org/apache/cassandra/cache/CacheProviderTest.java
Thu Jun  2 22:51:14 2011
@@ -42,6 +42,8 @@ public class CacheProviderTest extends S
     String key4 = "key4";
     String key5 = "key5";
     private static final int CAPACITY = 4;
+    private String tableName = "Keyspace1";
+    private String cfName = "Standard1";
 
     private void simpleCase(ColumnFamily cf, ICache<String, ColumnFamily> cache)
     {
@@ -92,7 +94,7 @@ public class CacheProviderTest extends S
 
     private ColumnFamily createCF()
     {
-        ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
+        ColumnFamily cf = ColumnFamily.create(tableName, cfName);
         cf.addColumn(column("vijay", "great", 1));
         cf.addColumn(column("awesome", "vijay", 1));
         return cf;
@@ -101,7 +103,7 @@ public class CacheProviderTest extends S
     @Test
     public void testHeapCache() throws InterruptedException
     {
-        ICache<String, ColumnFamily> cache = ConcurrentLinkedHashCache.create(CAPACITY);
+        ICache<String, ColumnFamily> cache = ConcurrentLinkedHashCache.create(CAPACITY,
tableName, cfName);
         ColumnFamily cf = createCF();
         simpleCase(cf, cache);
         concurrentCase(cf, cache);
@@ -110,7 +112,7 @@ public class CacheProviderTest extends S
     @Test
     public void testSerializingCache() throws InterruptedException
     {
-        ICache<String, ColumnFamily> cache = new SerializingCache<String, ColumnFamily>(CAPACITY,
ColumnFamily.serializer());
+        ICache<String, ColumnFamily> cache = new SerializingCache<String, ColumnFamily>(CAPACITY,
ColumnFamily.serializer(), tableName, cfName);
         ColumnFamily cf = createCF();
         simpleCase(cf, cache);
         // concurrentCase(cf, cache);



Mime
View raw message