Skip to content

Instantly share code, notes, and snippets.

@jeromatron
Created March 1, 2011 00:06
Show Gist options
  • Save jeromatron/848327 to your computer and use it in GitHub Desktop.
Save jeromatron/848327 to your computer and use it in GitHub Desktop.
Index: src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java
===================================================================
--- src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java (revision 1075592)
+++ src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordWriter.java (revision )
@@ -325,7 +325,7 @@
}
Map<ByteBuffer, Map<String, List<Mutation>>> batch = new HashMap<ByteBuffer, Map<String, List<Mutation>>>();
- while (batch.size() < batchThreshold)
+ while (mutation != null)
{
Map<String, List<Mutation>> subBatch = batch.get(mutation.left);
if (subBatch == null)
@@ -333,10 +333,12 @@
subBatch = Collections.singletonMap(columnFamily, (List<Mutation>) new ArrayList<Mutation>());
batch.put(mutation.left, subBatch);
}
-
+
subBatch.get(columnFamily).add(mutation.right);
- if ((mutation = queue.poll()) == null)
+ if (batch.size() >= batchThreshold)
break;
+
+ mutation = queue.poll();
}
Iterator<InetAddress> iter = endpoints.iterator();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment