cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bened...@apache.org
Subject [1/3] cassandra git commit: ninja follow-up to 8619
Date Thu, 29 Jan 2015 10:08:28 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 3ad0d3a8f -> a2d10c450
  refs/heads/trunk 25b18b758 -> cf4142902


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/a2d10c45
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a2d10c45
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a2d10c45

Branch: refs/heads/cassandra-2.1
Commit: a2d10c45076d0cc920c6649fcc797697102280f2
Parents: 3ad0d3a
Author: Benedict Elliott Smith <benedict@apache.org>
Authored: Thu Jan 29 09:41:49 2015 +0000
Committer: Benedict Elliott Smith <benedict@apache.org>
Committed: Thu Jan 29 10:07:54 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/a2d10c45/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 3e27ff9..a243175 100644
--- a/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
@@ -549,7 +549,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/a2d10c45/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 129dfca..af720c0 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();
                 }
             }


Mime
View raw message