cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r989371 - /cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java
Date Wed, 25 Aug 2010 20:51:04 GMT
Author: jbellis
Date: Wed Aug 25 20:51:04 2010
New Revision: 989371

URL: http://svn.apache.org/viewvc?rev=989371&view=rev
Log:
Allow multiple mutations per key to arrive during individual write calls.  patch by Stu Hood;
reviewed by jbellis for CASSANDRA-1315

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java?rev=989371&r1=989370&r2=989371&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java Wed
Aug 25 20:51:04 2010
@@ -157,11 +157,19 @@ final class ColumnFamilyRecordWriter ext
             mutationsByEndpoint.put(endpoint, mutationsByKey);
         }
 
-        Map<String, List<Mutation>> cfMutation = new HashMap<String, List<Mutation>>();
-        mutationsByKey.put(key, cfMutation);
+        Map<String, List<Mutation>> cfMutation = mutationsByKey.get(key);
+        if (cfMutation == null)
+        {
+            cfMutation = new HashMap<String, List<Mutation>>();
+            mutationsByKey.put(key, cfMutation);
+        }
 
-        List<Mutation> mutationList = new ArrayList<Mutation>();
-        cfMutation.put(ConfigHelper.getOutputColumnFamily(context.getConfiguration()), mutationList);
+        List<Mutation> mutationList = cfMutation.get(ConfigHelper.getOutputColumnFamily(context.getConfiguration()));
+        if (mutationList == null)
+        {
+            mutationList = new ArrayList<Mutation>();
+            cfMutation.put(ConfigHelper.getOutputColumnFamily(context.getConfiguration()),
mutationList);
+        }
 
         for (org.apache.cassandra.avro.Mutation amut : value)
             mutationList.add(avroToThrift(amut));



Mime
View raw message