You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/06/18 22:17:30 UTC

svn commit: r786242 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra/db: BinaryVerbHandler.java Row.java RowMutation.java Table.java

Author: jbellis
Date: Thu Jun 18 20:17:29 2009
New Revision: 786242

URL: http://svn.apache.org/viewvc?rev=786242&view=rev
Log:
minor cleanup of Row code.  patch by jbellis; reviewed by Sandeep Tata for CASSANDRA-199

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java?rev=786242&r1=786241&r2=786242&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java Thu Jun 18 20:17:29 2009
@@ -21,7 +21,6 @@
 import org.apache.cassandra.db.RowMutationVerbHandler.RowMutationContext;
 import org.apache.cassandra.net.IVerbHandler;
 import org.apache.cassandra.net.Message;
-import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.LogUtil;
 import org.apache.log4j.Logger;
 
@@ -54,7 +53,7 @@
             RowMutationMessage rmMsg = RowMutationMessage.serializer().deserialize(rowMutationCtx.buffer_);
             RowMutation rm = rmMsg.getRowMutation();            	                
             rowMutationCtx.row_.key(rm.key());
-            rm.load(rowMutationCtx.row_);
+            rm.applyBinary(rowMutationCtx.row_);
 	
 	    }        
 	    catch ( Exception e )

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java?rev=786242&r1=786241&r2=786242&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java Thu Jun 18 20:17:29 2009
@@ -23,7 +23,6 @@
 import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Map;
 import java.util.Set;
 import java.util.Arrays;
@@ -47,7 +46,7 @@
 
     private String key_;
 
-    private Map<String, ColumnFamily> columnFamilies_ = new Hashtable<String, ColumnFamily>();
+    private Map<String, ColumnFamily> columnFamilies_ = new HashMap<String, ColumnFamily>();
 
     protected Row()
     {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java?rev=786242&r1=786241&r2=786242&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java Thu Jun 18 20:17:29 2009
@@ -252,16 +252,17 @@
      * This is equivalent to calling commit. Applies the changes to
      * to the table that is obtained by calling Table.open().
     */
-    void load(Row row) throws IOException, ExecutionException, InterruptedException
+    void applyBinary(Row emptyRow) throws IOException, ExecutionException, InterruptedException
     {
+        assert emptyRow.getColumnFamilies().size() == 0;
         Table table = Table.open(table_);
         Set<String> cfNames = modifications_.keySet();
         for (String cfName : cfNames)
         {
             assert table.isValidColumnFamily(cfName);
-            row.addColumnFamily(modifications_.get(cfName));
+            emptyRow.addColumnFamily(modifications_.get(cfName));
         }
-        table.load(row);
+        table.load(emptyRow);
     }
 
     public Message makeRowMutationMessage() throws IOException

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=786242&r1=786241&r2=786242&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 Thu Jun 18 20:17:29 2009
@@ -822,10 +822,10 @@
         }
     }
 
+    // for binary load path.  skips commitlog.
     void load(Row row) throws IOException
     {
         String key = row.key();
-        /* Add row to the commit log. */
         long start = System.currentTimeMillis();
                 
         for (ColumnFamily columnFamily : row.getColumnFamilies())