cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject svn commit: r1058263 - in /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra: db/ColumnFamilyStore.java db/ColumnFamilyStoreMBean.java service/StorageService.java service/StorageServiceMBean.java tools/NodeCmd.java tools/NodeProbe.java
Date Wed, 12 Jan 2011 18:20:11 GMT
Author: brandonwilliams
Date: Wed Jan 12 18:20:11 2011
New Revision: 1058263

URL: http://svn.apache.org/viewvc?rev=1058263&view=rev
Log:
Add ability to invalidate row/key caches from nodetool.
Patch by Jon Hermes, reviewed by brandonwilliams for CASSANDRA-1857

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeProbe.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1058263&r1=1058262&r2=1058263&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Wed Jan 12 18:20:11 2011
@@ -1627,6 +1627,11 @@ public class ColumnFamilyStore implement
         ssTables.getRowCache().clear();
     }
 
+    public void invalidateKeyCache()
+    {
+        ssTables.getKeyCache().clear();
+    }
+
     public int getRowCacheCapacity()
     {
         return ssTables.getRowCache().getCapacity();

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java?rev=1058263&r1=1058262&r2=1058263&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
Wed Jan 12 18:20:11 2011
@@ -146,10 +146,16 @@ public interface ColumnFamilyStoreMBean
     public void forceMajorCompaction() throws ExecutionException, InterruptedException;
 
     /**
+     * invalidate the key cache; for use after invalidating row cache
+     */
+    public void invalidateKeyCache();
+
+    /**
      * invalidate the row cache; for use after bulk loading via BinaryMemtable
      */
     public void invalidateRowCache();
 
+
     /**
      * return the size of the smallest compacted row
      * @return

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java?rev=1058263&r1=1058262&r2=1058263&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
Wed Jan 12 18:20:11 2011
@@ -1145,6 +1145,22 @@ public class StorageService implements I
         }
     }
 
+    public void invalidateKeyCaches(String tableName, String... columnFamilies) throws IOException
+    {
+        for (ColumnFamilyStore cfStore : getValidColumnFamilies(tableName, columnFamilies))
+        {
+            cfStore.invalidateKeyCache();
+        }
+    }
+
+    public void invalidateRowCaches(String tableName, String... columnFamilies) throws IOException
+    {
+        for (ColumnFamilyStore cfStore : getValidColumnFamilies(tableName, columnFamilies))
+        {
+            cfStore.invalidateRowCache();
+        }
+    }
+
     /**
      * Takes the snapshot for a given table.
      *

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java?rev=1058263&r1=1058262&r2=1058263&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageServiceMBean.java
Wed Jan 12 18:20:11 2011
@@ -279,4 +279,7 @@ public interface StorageServiceMBean
 
     // to determine if gossip is disabled
     public boolean isInitialized();
+
+    public void invalidateKeyCaches(String ks, String... cfs) throws IOException;
+    public void invalidateRowCaches(String ks, String... cfs) throws IOException;
 }

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java?rev=1058263&r1=1058262&r2=1058263&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java Wed
Jan 12 18:20:11 2011
@@ -74,7 +74,7 @@ public class NodeCmd {
         RING, INFO, CFSTATS, SNAPSHOT, CLEARSNAPSHOT, VERSION, TPSTATS, FLUSH, DRAIN,
         DECOMMISSION, MOVE, LOADBALANCE, REMOVETOKEN, REPAIR, CLEANUP, COMPACT,
         SETCACHECAPACITY, GETCOMPACTIONTHRESHOLD, SETCOMPACTIONTHRESHOLD, NETSTATS, CFHISTOGRAMS,
-        COMPACTIONSTATS, DISABLEGOSSIP, ENABLEGOSSIP
+        COMPACTIONSTATS, DISABLEGOSSIP, ENABLEGOSSIP, INVALIDATEKEYCACHE, INVALIDATEROWCACHE
     }
 
     
@@ -110,6 +110,8 @@ public class NodeCmd {
                          + "repair [keyspace] [cfnames]\n"
                          + "cleanup [keyspace] [cfnames]\n"
                          + "compact [keyspace] [cfnames]\n"
+                         + "invalidatekeycache [keyspace] [cfnames]\n"
+                         + "invalidaterowcache [keyspace] [cfnames]\n"
                          + "getcompactionthreshold <keyspace> <cfname>\n"
                          + "cfhistograms <keyspace> <cfname>\n"
 
@@ -556,6 +558,8 @@ public class NodeCmd {
             case COMPACT :
             case REPAIR  :
             case FLUSH   :
+            case INVALIDATEKEYCACHE :
+            case INVALIDATEROWCACHE :
                 optionalKSandCFs(nc, arguments, probe);
                 break;
 
@@ -615,7 +619,9 @@ public class NodeCmd {
             {
                 switch (nc)
                 {
-                    case REPAIR  : probe.forceTableRepair(keyspace); break;
+                    case REPAIR             : probe.forceTableRepair(keyspace); break;
+                    case INVALIDATEKEYCACHE : probe.invalidateKeyCaches(keyspace); break;
+                    case INVALIDATEROWCACHE : probe.invalidateRowCaches(keyspace); break;
                     case FLUSH   :
                         try { probe.forceTableFlush(keyspace); }
                         catch (ExecutionException ee) { err(ee, "Error occured while flushing
keyspace " + keyspace); }
@@ -646,6 +652,8 @@ public class NodeCmd {
             switch (nc)
             {
                 case REPAIR  : probe.forceTableRepair(keyspace, columnFamilies); break;
+                case INVALIDATEKEYCACHE : probe.invalidateKeyCaches(keyspace, columnFamilies);
break;
+                case INVALIDATEROWCACHE : probe.invalidateRowCaches(keyspace, columnFamilies);
break;
                 case FLUSH   :
                     try { probe.forceTableFlush(keyspace, columnFamilies); }
                     catch (ExecutionException ee) { err(ee, "Error occured during flushing");
}

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeProbe.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeProbe.java?rev=1058263&r1=1058262&r2=1058263&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeProbe.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeProbe.java Wed
Jan 12 18:20:11 2011
@@ -181,7 +181,17 @@ public class NodeProbe
     {
         ssProxy.forceTableRepair(tableName, columnFamilies);
     }
-    
+
+    public void invalidateKeyCaches(String tableName, String... columnFamilies) throws IOException
+    {
+        ssProxy.invalidateKeyCaches(tableName, columnFamilies);
+    }
+
+    public void invalidateRowCaches(String tableName, String... columnFamilies) throws IOException
+    {
+        ssProxy.invalidateRowCaches(tableName, columnFamilies);
+    }
+
     public void drain() throws IOException, InterruptedException, ExecutionException
     {
         ssProxy.drain();	



Mime
View raw message