Repository: cassandra Updated Branches: refs/heads/trunk 2e4ad069d -> c1960d8b7
ninja follow-up to 8619 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6ae8adaa Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6ae8adaa Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6ae8adaa Branch: refs/heads/trunk Commit: 6ae8adaa3c9eef3606ef1f6a27b828066225aac2 Parents: 31324ee Author: Benedict Elliott Smith <bened...@apache.org> Authored: Thu Jan 29 09:41:49 2015 +0000 Committer: Benedict Elliott Smith <bened...@apache.org> Committed: Thu Jan 29 09:41:49 2015 +0000 ---------------------------------------------------------------------- .../cassandra/io/sstable/CQLSSTableWriter.java | 2 +- .../io/sstable/SSTableSimpleUnsortedWriter.java | 32 ++++++++++++++------ 2 files changed, 23 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ae8adaa/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java index d58b28f..8006112 100644 --- a/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java +++ b/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java @@ -534,7 +534,7 @@ public class CQLSSTableWriter implements Closeable }; } - protected void addColumn(Cell cell) throws IOException + protected void addColumn(Column column) throws IOException { throw new UnsupportedOperationException(); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/6ae8adaa/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java index b58e574..db03ea1 100644 --- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java @@ -23,6 +23,7 @@ import java.util.Map; import java.util.TreeMap; import java.util.concurrent.BlockingQueue; import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.TimeUnit; import com.google.common.base.Throwables; @@ -165,17 +166,21 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter if (buffer.isEmpty()) return; - checkForWriterException(); - - columnFamily = null; - try + while (true) { - writeQueue.put(buffer); - } - catch (InterruptedException e) - { - throw new RuntimeException(e); + checkForWriterException(); + columnFamily = null; + try + { + if (writeQueue.offer(buffer, 1L, TimeUnit.SECONDS)) + break; + } + catch (InterruptedException e) + { + throw new RuntimeException(e); + + } } buffer = new Buffer(); currentSize = 0; @@ -213,8 +218,15 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter return; writer = getWriter(); + boolean first = true; for (Map.Entry<DecoratedKey, ColumnFamily> entry : b.entrySet()) - writer.append(entry.getKey(), entry.getValue()); + { + if (entry.getValue().getColumnCount() > 0) + writer.append(entry.getKey(), entry.getValue()); + else if (!first) + throw new AssertionError("Empty partition"); + first = false; + } writer.close(); } }