cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [3/4] git commit: convert RowMutations on the cql3 path to use more-efficient mutations map
Date Thu, 28 Feb 2013 16:12:20 GMT
convert RowMutations on the cql3 path to use more-efficient mutations map


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

Branch: refs/heads/trunk
Commit: 200ed658454822985179cb1d82e0cbb12072f28b
Parents: a9b075d
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Feb 28 10:10:52 2013 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Feb 28 10:10:52 2013 -0600

----------------------------------------------------------------------
 .../cassandra/cql3/statements/DeleteStatement.java |    6 +++---
 .../cassandra/cql3/statements/UpdateStatement.java |    5 +++--
 .../org/apache/cassandra/service/StorageProxy.java |    5 +++--
 3 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/200ed658/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java b/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
index 91462d3..3461870 100644
--- a/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.cql3.statements;
 import java.nio.ByteBuffer;
 import java.util.*;
 
+import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.cql3.*;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.ConsistencyLevel;
@@ -102,8 +103,7 @@ public class DeleteStatement extends ModificationStatement
     throws InvalidRequestException
     {
         QueryProcessor.validateKey(key);
-        RowMutation rm = new RowMutation(cfDef.cfm.ksName, key);
-        ColumnFamily cf = rm.addOrGet(columnFamily());
+        ColumnFamily cf = ColumnFamily.create(Schema.instance.getCFMetaData(cfDef.cfm.ksName,
columnFamily()));
 
         if (toRemove.isEmpty() && builder.componentCount() == 0)
         {
@@ -135,7 +135,7 @@ public class DeleteStatement extends ModificationStatement
             }
         }
 
-        return rm;
+        return new RowMutation(cfDef.cfm.ksName, key, cf);
     }
 
     public ParsedStatement.Prepared prepare(ColumnSpecification[] boundNames) throws InvalidRequestException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/200ed658/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java b/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java
index 8abd09b..ad8aa48 100644
--- a/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/UpdateStatement.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.cql3.statements;
 import java.nio.ByteBuffer;
 import java.util.*;
 
+import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.cql3.*;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.*;
@@ -203,8 +204,7 @@ public class UpdateStatement extends ModificationStatement
         validateKey(key);
 
         QueryProcessor.validateKey(key);
-        RowMutation rm = new RowMutation(cfDef.cfm.ksName, key);
-        ColumnFamily cf = rm.addOrGet(cfDef.cfm.cfName);
+        ColumnFamily cf = ColumnFamily.create(Schema.instance.getCFMetaData(cfDef.cfm.ksName,
cfDef.cfm.cfName));
 
         // Inserting the CQL row marker (see #4361)
         // We always need to insert a marker, because of the following situation:
@@ -252,6 +252,7 @@ public class UpdateStatement extends ModificationStatement
                 op.execute(key, cf, builder.copy(), params);
         }
 
+        RowMutation rm = new RowMutation(cfDef.cfm.ksName, key, cf);
         return type == Type.COUNTER ? new CounterMutation(rm, cl) : rm;
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/200ed658/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index 3f76c0e..f157049 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -320,14 +320,15 @@ public class StorageProxy implements StorageProxyMBean
 
     private static void asyncRemoveFromBatchlog(Collection<InetAddress> endpoints,
UUID uuid)
     {
-        RowMutation rm = new RowMutation(Table.SYSTEM_KS, UUIDType.instance.decompose(uuid));
-        rm.delete(SystemTable.BATCHLOG_CF, FBUtilities.timestampMicros());
+        ColumnFamily cf = ColumnFamily.create(Schema.instance.getCFMetaData(Table.SYSTEM_KS,
SystemTable.BATCHLOG_CF));
+        cf.delete(new DeletionInfo(FBUtilities.timestampMicros(), (int) (System.currentTimeMillis()
/ 1000)));
         AbstractWriteResponseHandler handler = new WriteResponseHandler(endpoints,
                                                                         Collections.<InetAddress>emptyList(),
                                                                         ConsistencyLevel.ANY,
                                                                         Table.open(Table.SYSTEM_KS),
                                                                         null,
                                                                         WriteType.SIMPLE);
+        RowMutation rm = new RowMutation(Table.SYSTEM_KS, UUIDType.instance.decompose(uuid),
cf);
         updateBatchlog(rm, endpoints, handler);
     }
 


Mime
View raw message