cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r816746 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra/db: ColumnFamilyStore.java CommitLog.java Table.java
Date Fri, 18 Sep 2009 19:02:55 GMT
Author: jbellis
Date: Fri Sep 18 19:02:54 2009
New Revision: 816746

URL: http://svn.apache.org/viewvc?rev=816746&view=rev
Log:
cleanup; r/m unused code
patch by jbellis; reviewed by junrao for CASSANDRA-444

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=816746&r1=816745&r2=816746&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Fri
Sep 18 19:02:54 2009
@@ -441,30 +441,13 @@
      * needs to be used. param @ key - key for update/insert param @
      * columnFamily - columnFamily changes
      */
-    void applyBinary(String key, byte[] buffer)
-            throws IOException
+    void applyBinary(String key, byte[] buffer) throws IOException
     {
         long start = System.currentTimeMillis();
         binaryMemtable_.get().put(key, buffer);
         writeStats_.add(System.currentTimeMillis() - start);
     }
 
-    /**
-     * like resolve, but leaves the resolved CF as the only item in the list
-     */
-    private static void merge(List<ColumnFamily> columnFamilies)
-    {
-        ColumnFamily cf = ColumnFamily.resolve(columnFamilies);
-        columnFamilies.clear();
-        columnFamilies.add(cf);
-    }
-
-    private static ColumnFamily resolveAndRemoveDeleted(List<ColumnFamily> columnFamilies)
-    {
-        ColumnFamily cf = ColumnFamily.resolve(columnFamilies);
-        return removeDeleted(cf);
-    }
-
     /*
      This is complicated because we need to preserve deleted columns, supercolumns, and columnfamilies
      until they have been deleted for at least GC_GRACE_IN_SECONDS.  But, we do not need
to preserve

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java?rev=816746&r1=816745&r2=816746&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CommitLog.java Fri Sep 18 19:02:54
2009
@@ -397,13 +397,13 @@
      * of any problems. This way we can assume that the subsequent commit log
      * entry will override the garbage left over by the previous write.
     */
-    CommitLogContext add(Row row, DataOutputBuffer serializedRow) throws IOException
+    void add(Row row, DataOutputBuffer serializedRow) throws IOException
     {
         Callable<CommitLogContext> task = new LogRecordAdder(row, serializedRow);
 
         try
         {
-            return executor.submit(task).get();
+            executor.submit(task).get();
         }
         catch (InterruptedException e)
         {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=816746&r1=816745&r2=816746&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Fri Sep 18 19:02:54
2009
@@ -594,7 +594,7 @@
     */
     void apply(Row row, DataOutputBuffer serializedRow) throws IOException
     {
-        HashMap<ColumnFamilyStore,Memtable> memtablesToFlush = new HashMap<ColumnFamilyStore,
Memtable>();
+        HashMap<ColumnFamilyStore,Memtable> memtablesToFlush = new HashMap<ColumnFamilyStore,
Memtable>(2);
 
         flusherLock_.readLock().lock();
         try
@@ -605,7 +605,7 @@
             {
                 Memtable memtableToFlush;
                 ColumnFamilyStore cfStore = columnFamilyStores_.get(columnFamily.name());
-                if ( (memtableToFlush=cfStore.apply(row.key(), columnFamily)) != null)
+                if ((memtableToFlush=cfStore.apply(row.key(), columnFamily)) != null)
                     memtablesToFlush.put(cfStore, memtableToFlush);
             }
         }
@@ -613,12 +613,10 @@
         {
             flusherLock_.readLock().unlock();
         }
-        
-        if (memtablesToFlush.size() > 0)
-        {
-            for (Map.Entry<ColumnFamilyStore, Memtable> entry : memtablesToFlush.entrySet())
-                entry.getKey().switchMemtable(entry.getValue());
-        }
+
+        // usually mTF will be empty and this will be a no-op
+        for (Map.Entry<ColumnFamilyStore, Memtable> entry : memtablesToFlush.entrySet())
+            entry.getKey().switchMemtable(entry.getValue());
     }
 
     void applyNow(Row row) throws IOException



Mime
View raw message