You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2015/06/03 18:06:15 UTC

[1/6] cassandra git commit: Fix empty partition assertion in unsorted sstable writing tools

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 655f05698 -> 66a48e7ab
  refs/heads/cassandra-2.2 2a9fc0e88 -> 46ea0402f
  refs/heads/trunk 0603af90e -> 34962c300


Fix empty partition assertion in unsorted sstable writing tools

patch by Fabien Rousseau; reviewed by benedict for CASSANDRA-9071


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

Branch: refs/heads/cassandra-2.1
Commit: 66a48e7ab137e7ec54b0bab5eaee44a9449930dd
Parents: 655f056
Author: Fabien Rousseau <fa...@yahoo.fr>
Authored: Wed Jun 3 17:00:10 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Wed Jun 3 17:00:10 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../io/sstable/SSTableSimpleUnsortedWriter.java | 17 +++++++++---
 .../io/sstable/CQLSSTableWriterTest.java        | 29 ++++++++++++++++++++
 3 files changed, 43 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f5c3b41..4d38e1e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.6
+ * Fix empty partition assertion in unsorted sstable writing tools (CASSANDRA-9071)
  * Ensure truncate without snapshot cannot produce corrupt responses (CASSANDRA-9388) 
  * Consistent error message when a table mixes counter and non-counter
    columns (CASSANDRA-9492)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/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 4d7f4fa..9ee9ea1 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
@@ -175,6 +175,7 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
         buffer = new Buffer();
         currentSize = 0;
         columnFamily = getColumnFamily();
+        buffer.setFirstInsertedKey(currentKey);
     }
 
     private void put(Buffer buffer) throws IOException
@@ -207,7 +208,17 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
     }
 
     // typedef
-    private static class Buffer extends TreeMap<DecoratedKey, ColumnFamily> {}
+    private static class Buffer extends TreeMap<DecoratedKey, ColumnFamily> {
+        private DecoratedKey firstInsertedKey;
+
+        public void setFirstInsertedKey(DecoratedKey firstInsertedKey) {
+            this.firstInsertedKey = firstInsertedKey;
+        }
+
+        public DecoratedKey getFirstInsertedKey() {
+            return firstInsertedKey;
+        }
+    }
 
     private class DiskWriter extends Thread
     {
@@ -225,14 +236,12 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
                         return;
 
                     writer = getWriter();
-                    boolean first = true;
                     for (Map.Entry<DecoratedKey, ColumnFamily> entry : b.entrySet())
                     {
                         if (entry.getValue().getColumnCount() > 0)
                             writer.append(entry.getKey(), entry.getValue());
-                        else if (!first)
+                        else if (!entry.getKey().equals(b.getFirstInsertedKey()))
                             throw new AssertionError("Empty partition");
-                        first = false;
                     }
                     writer.close();
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
index a7b751e..fa5cbb4 100644
--- a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
@@ -22,6 +22,7 @@ import java.io.FilenameFilter;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Iterator;
+import java.util.UUID;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.io.Files;
@@ -173,6 +174,34 @@ public class CQLSSTableWriterTest
     }
 
 
+    @Test
+    public void testSyncNoEmptyRows() throws Exception
+    {
+        // Check that the write does not throw an empty partition error (#9071)
+        File tempdir = Files.createTempDir();
+        String schema = "CREATE TABLE ks.test2 ("
+                        + "  k UUID,"
+                        + "  c int,"
+                        + "  PRIMARY KEY (k)"
+                        + ")";
+        String insert = "INSERT INTO ks.test2 (k, c) VALUES (?, ?)";
+        CQLSSTableWriter writer = CQLSSTableWriter.builder()
+                                                  .inDirectory(tempdir)
+                                                  .forTable(schema)
+                                                  .withPartitioner(StorageService.instance.getPartitioner())
+                                                  .using(insert)
+                                                  .withBufferSizeInMB(1)
+                                                  .build();
+
+        for (int i = 0 ; i < 50000 ; i++) {
+            writer.addRow(UUID.randomUUID(), 0);
+        }
+        writer.close();
+
+    }
+
+
+
     private static final int NUMBER_WRITES_IN_RUNNABLE = 10;
     private class WriterThread extends Thread
     {


[2/6] cassandra git commit: Fix empty partition assertion in unsorted sstable writing tools

Posted by be...@apache.org.
Fix empty partition assertion in unsorted sstable writing tools

patch by Fabien Rousseau; reviewed by benedict for CASSANDRA-9071


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

Branch: refs/heads/cassandra-2.2
Commit: 66a48e7ab137e7ec54b0bab5eaee44a9449930dd
Parents: 655f056
Author: Fabien Rousseau <fa...@yahoo.fr>
Authored: Wed Jun 3 17:00:10 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Wed Jun 3 17:00:10 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../io/sstable/SSTableSimpleUnsortedWriter.java | 17 +++++++++---
 .../io/sstable/CQLSSTableWriterTest.java        | 29 ++++++++++++++++++++
 3 files changed, 43 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f5c3b41..4d38e1e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.6
+ * Fix empty partition assertion in unsorted sstable writing tools (CASSANDRA-9071)
  * Ensure truncate without snapshot cannot produce corrupt responses (CASSANDRA-9388) 
  * Consistent error message when a table mixes counter and non-counter
    columns (CASSANDRA-9492)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/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 4d7f4fa..9ee9ea1 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
@@ -175,6 +175,7 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
         buffer = new Buffer();
         currentSize = 0;
         columnFamily = getColumnFamily();
+        buffer.setFirstInsertedKey(currentKey);
     }
 
     private void put(Buffer buffer) throws IOException
@@ -207,7 +208,17 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
     }
 
     // typedef
-    private static class Buffer extends TreeMap<DecoratedKey, ColumnFamily> {}
+    private static class Buffer extends TreeMap<DecoratedKey, ColumnFamily> {
+        private DecoratedKey firstInsertedKey;
+
+        public void setFirstInsertedKey(DecoratedKey firstInsertedKey) {
+            this.firstInsertedKey = firstInsertedKey;
+        }
+
+        public DecoratedKey getFirstInsertedKey() {
+            return firstInsertedKey;
+        }
+    }
 
     private class DiskWriter extends Thread
     {
@@ -225,14 +236,12 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
                         return;
 
                     writer = getWriter();
-                    boolean first = true;
                     for (Map.Entry<DecoratedKey, ColumnFamily> entry : b.entrySet())
                     {
                         if (entry.getValue().getColumnCount() > 0)
                             writer.append(entry.getKey(), entry.getValue());
-                        else if (!first)
+                        else if (!entry.getKey().equals(b.getFirstInsertedKey()))
                             throw new AssertionError("Empty partition");
-                        first = false;
                     }
                     writer.close();
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
index a7b751e..fa5cbb4 100644
--- a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
@@ -22,6 +22,7 @@ import java.io.FilenameFilter;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Iterator;
+import java.util.UUID;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.io.Files;
@@ -173,6 +174,34 @@ public class CQLSSTableWriterTest
     }
 
 
+    @Test
+    public void testSyncNoEmptyRows() throws Exception
+    {
+        // Check that the write does not throw an empty partition error (#9071)
+        File tempdir = Files.createTempDir();
+        String schema = "CREATE TABLE ks.test2 ("
+                        + "  k UUID,"
+                        + "  c int,"
+                        + "  PRIMARY KEY (k)"
+                        + ")";
+        String insert = "INSERT INTO ks.test2 (k, c) VALUES (?, ?)";
+        CQLSSTableWriter writer = CQLSSTableWriter.builder()
+                                                  .inDirectory(tempdir)
+                                                  .forTable(schema)
+                                                  .withPartitioner(StorageService.instance.getPartitioner())
+                                                  .using(insert)
+                                                  .withBufferSizeInMB(1)
+                                                  .build();
+
+        for (int i = 0 ; i < 50000 ; i++) {
+            writer.addRow(UUID.randomUUID(), 0);
+        }
+        writer.close();
+
+    }
+
+
+
     private static final int NUMBER_WRITES_IN_RUNNABLE = 10;
     private class WriterThread extends Thread
     {


[3/6] cassandra git commit: Fix empty partition assertion in unsorted sstable writing tools

Posted by be...@apache.org.
Fix empty partition assertion in unsorted sstable writing tools

patch by Fabien Rousseau; reviewed by benedict for CASSANDRA-9071


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

Branch: refs/heads/trunk
Commit: 66a48e7ab137e7ec54b0bab5eaee44a9449930dd
Parents: 655f056
Author: Fabien Rousseau <fa...@yahoo.fr>
Authored: Wed Jun 3 17:00:10 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Wed Jun 3 17:00:10 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../io/sstable/SSTableSimpleUnsortedWriter.java | 17 +++++++++---
 .../io/sstable/CQLSSTableWriterTest.java        | 29 ++++++++++++++++++++
 3 files changed, 43 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f5c3b41..4d38e1e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.6
+ * Fix empty partition assertion in unsorted sstable writing tools (CASSANDRA-9071)
  * Ensure truncate without snapshot cannot produce corrupt responses (CASSANDRA-9388) 
  * Consistent error message when a table mixes counter and non-counter
    columns (CASSANDRA-9492)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/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 4d7f4fa..9ee9ea1 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
@@ -175,6 +175,7 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
         buffer = new Buffer();
         currentSize = 0;
         columnFamily = getColumnFamily();
+        buffer.setFirstInsertedKey(currentKey);
     }
 
     private void put(Buffer buffer) throws IOException
@@ -207,7 +208,17 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
     }
 
     // typedef
-    private static class Buffer extends TreeMap<DecoratedKey, ColumnFamily> {}
+    private static class Buffer extends TreeMap<DecoratedKey, ColumnFamily> {
+        private DecoratedKey firstInsertedKey;
+
+        public void setFirstInsertedKey(DecoratedKey firstInsertedKey) {
+            this.firstInsertedKey = firstInsertedKey;
+        }
+
+        public DecoratedKey getFirstInsertedKey() {
+            return firstInsertedKey;
+        }
+    }
 
     private class DiskWriter extends Thread
     {
@@ -225,14 +236,12 @@ public class SSTableSimpleUnsortedWriter extends AbstractSSTableSimpleWriter
                         return;
 
                     writer = getWriter();
-                    boolean first = true;
                     for (Map.Entry<DecoratedKey, ColumnFamily> entry : b.entrySet())
                     {
                         if (entry.getValue().getColumnCount() > 0)
                             writer.append(entry.getKey(), entry.getValue());
-                        else if (!first)
+                        else if (!entry.getKey().equals(b.getFirstInsertedKey()))
                             throw new AssertionError("Empty partition");
-                        first = false;
                     }
                     writer.close();
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/66a48e7a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
index a7b751e..fa5cbb4 100644
--- a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
@@ -22,6 +22,7 @@ import java.io.FilenameFilter;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Iterator;
+import java.util.UUID;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.io.Files;
@@ -173,6 +174,34 @@ public class CQLSSTableWriterTest
     }
 
 
+    @Test
+    public void testSyncNoEmptyRows() throws Exception
+    {
+        // Check that the write does not throw an empty partition error (#9071)
+        File tempdir = Files.createTempDir();
+        String schema = "CREATE TABLE ks.test2 ("
+                        + "  k UUID,"
+                        + "  c int,"
+                        + "  PRIMARY KEY (k)"
+                        + ")";
+        String insert = "INSERT INTO ks.test2 (k, c) VALUES (?, ?)";
+        CQLSSTableWriter writer = CQLSSTableWriter.builder()
+                                                  .inDirectory(tempdir)
+                                                  .forTable(schema)
+                                                  .withPartitioner(StorageService.instance.getPartitioner())
+                                                  .using(insert)
+                                                  .withBufferSizeInMB(1)
+                                                  .build();
+
+        for (int i = 0 ; i < 50000 ; i++) {
+            writer.addRow(UUID.randomUUID(), 0);
+        }
+        writer.close();
+
+    }
+
+
+
     private static final int NUMBER_WRITES_IN_RUNNABLE = 10;
     private class WriterThread extends Thread
     {


[5/6] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

Posted by be...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2

Conflicts:
	src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java


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

Branch: refs/heads/cassandra-2.2
Commit: 46ea0402f760ed99a93fa463688a59e26a1c543a
Parents: 2a9fc0e 66a48e7
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Wed Jun 3 17:01:59 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Wed Jun 3 17:01:59 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../io/sstable/SSTableSimpleUnsortedWriter.java | 19 +++++++++----
 .../io/sstable/CQLSSTableWriterTest.java        | 29 ++++++++++++++++++++
 3 files changed, 44 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/46ea0402/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index b4364ba,4d38e1e..aeae5e8
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,20 -1,5 +1,21 @@@
 +2.2
 + * Clean up gossiper logic for old versions (CASSANDRA-9370)
 + * Fix custom payload coding/decoding to match the spec (CASSANDRA-9515)
 + * ant test-all results incomplete when parsed (CASSANDRA-9463)
 + * Disallow frozen<> types in function arguments and return types for
 +   clarity (CASSANDRA-9411)
 + * Static Analysis to warn on unsafe use of Autocloseable instances (CASSANDRA-9431)
 + * Update commitlog archiving examples now that commitlog segments are
 +   not recycled (CASSANDRA-9350)
 + * Extend Transactional API to sstable lifecycle management (CASSANDRA-8568)
 + * (cqlsh) Add support for native protocol 4 (CASSANDRA-9399)
 + * Ensure that UDF and UDAs are keyspace-isolated (CASSANDRA-9409)
 + * Revert CASSANDRA-7807 (tracing completion client notifications) (CASSANDRA-9429)
 + * Add ability to stop compaction by ID (CASSANDRA-7207)
 + * Let CassandraVersion handle SNAPSHOT version (CASSANDRA-9438)
 +Merged from 2.1:
  2.1.6
+  * Fix empty partition assertion in unsorted sstable writing tools (CASSANDRA-9071)
   * Ensure truncate without snapshot cannot produce corrupt responses (CASSANDRA-9388) 
   * Consistent error message when a table mixes counter and non-counter
     columns (CASSANDRA-9492)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/46ea0402/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
index d6ab940,9ee9ea1..cc47845
--- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
@@@ -219,36 -229,29 +230,34 @@@ public class SSTableSimpleUnsortedWrite
              {
                  while (true)
                  {
 -                    Buffer b = writeQueue.take();
 -                    if (b == SENTINEL)
 -                        return;
 +                    try
 +                    {
 +                        Buffer b = writeQueue.take();
 +                        if (b == SENTINEL)
 +                            return;
  
 -                    writer = getWriter();
 -                    for (Map.Entry<DecoratedKey, ColumnFamily> entry : b.entrySet())
 +                        try (SSTableWriter writer = getWriter();)
 +                        {
-                             boolean first = true;
 +                            for (Map.Entry<DecoratedKey, ColumnFamily> entry : b.entrySet())
 +                            {
 +                                if (entry.getValue().getColumnCount() > 0)
 +                                    writer.append(entry.getKey(), entry.getValue());
-                                 else if (!first)
++                                else if (!entry.getKey().equals(b.getFirstInsertedKey()))
 +                                    throw new AssertionError("Empty partition");
-                                 first = false;
 +                            }
- 
++                            
 +                            writer.finish(false);
 +                        }
 +                    }
 +                    catch (Throwable e)
                      {
 -                        if (entry.getValue().getColumnCount() > 0)
 -                            writer.append(entry.getKey(), entry.getValue());
 -                        else if (!entry.getKey().equals(b.getFirstInsertedKey()))
 -                            throw new AssertionError("Empty partition");
 +                        JVMStabilityInspector.inspectThrowable(e);
 +                        // Keep only the first exception
 +                        if (exception == null)
 +                            exception = e;
                      }
 -                    writer.close();
                  }
 -            }
 -            catch (Throwable e)
 -            {
 -                JVMStabilityInspector.inspectThrowable(e);
 -                if (writer != null)
 -                    writer.abort();
 -                exception = e;
 +
              }
          }
      }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/46ea0402/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------


[4/6] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

Posted by be...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2

Conflicts:
	src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java


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

Branch: refs/heads/trunk
Commit: 46ea0402f760ed99a93fa463688a59e26a1c543a
Parents: 2a9fc0e 66a48e7
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Wed Jun 3 17:01:59 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Wed Jun 3 17:01:59 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../io/sstable/SSTableSimpleUnsortedWriter.java | 19 +++++++++----
 .../io/sstable/CQLSSTableWriterTest.java        | 29 ++++++++++++++++++++
 3 files changed, 44 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/46ea0402/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index b4364ba,4d38e1e..aeae5e8
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,20 -1,5 +1,21 @@@
 +2.2
 + * Clean up gossiper logic for old versions (CASSANDRA-9370)
 + * Fix custom payload coding/decoding to match the spec (CASSANDRA-9515)
 + * ant test-all results incomplete when parsed (CASSANDRA-9463)
 + * Disallow frozen<> types in function arguments and return types for
 +   clarity (CASSANDRA-9411)
 + * Static Analysis to warn on unsafe use of Autocloseable instances (CASSANDRA-9431)
 + * Update commitlog archiving examples now that commitlog segments are
 +   not recycled (CASSANDRA-9350)
 + * Extend Transactional API to sstable lifecycle management (CASSANDRA-8568)
 + * (cqlsh) Add support for native protocol 4 (CASSANDRA-9399)
 + * Ensure that UDF and UDAs are keyspace-isolated (CASSANDRA-9409)
 + * Revert CASSANDRA-7807 (tracing completion client notifications) (CASSANDRA-9429)
 + * Add ability to stop compaction by ID (CASSANDRA-7207)
 + * Let CassandraVersion handle SNAPSHOT version (CASSANDRA-9438)
 +Merged from 2.1:
  2.1.6
+  * Fix empty partition assertion in unsorted sstable writing tools (CASSANDRA-9071)
   * Ensure truncate without snapshot cannot produce corrupt responses (CASSANDRA-9388) 
   * Consistent error message when a table mixes counter and non-counter
     columns (CASSANDRA-9492)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/46ea0402/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
index d6ab940,9ee9ea1..cc47845
--- a/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableSimpleUnsortedWriter.java
@@@ -219,36 -229,29 +230,34 @@@ public class SSTableSimpleUnsortedWrite
              {
                  while (true)
                  {
 -                    Buffer b = writeQueue.take();
 -                    if (b == SENTINEL)
 -                        return;
 +                    try
 +                    {
 +                        Buffer b = writeQueue.take();
 +                        if (b == SENTINEL)
 +                            return;
  
 -                    writer = getWriter();
 -                    for (Map.Entry<DecoratedKey, ColumnFamily> entry : b.entrySet())
 +                        try (SSTableWriter writer = getWriter();)
 +                        {
-                             boolean first = true;
 +                            for (Map.Entry<DecoratedKey, ColumnFamily> entry : b.entrySet())
 +                            {
 +                                if (entry.getValue().getColumnCount() > 0)
 +                                    writer.append(entry.getKey(), entry.getValue());
-                                 else if (!first)
++                                else if (!entry.getKey().equals(b.getFirstInsertedKey()))
 +                                    throw new AssertionError("Empty partition");
-                                 first = false;
 +                            }
- 
++                            
 +                            writer.finish(false);
 +                        }
 +                    }
 +                    catch (Throwable e)
                      {
 -                        if (entry.getValue().getColumnCount() > 0)
 -                            writer.append(entry.getKey(), entry.getValue());
 -                        else if (!entry.getKey().equals(b.getFirstInsertedKey()))
 -                            throw new AssertionError("Empty partition");
 +                        JVMStabilityInspector.inspectThrowable(e);
 +                        // Keep only the first exception
 +                        if (exception == null)
 +                            exception = e;
                      }
 -                    writer.close();
                  }
 -            }
 -            catch (Throwable e)
 -            {
 -                JVMStabilityInspector.inspectThrowable(e);
 -                if (writer != null)
 -                    writer.abort();
 -                exception = e;
 +
              }
          }
      }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/46ea0402/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
----------------------------------------------------------------------


[6/6] cassandra git commit: Merge branch 'cassandra-2.2' into trunk

Posted by be...@apache.org.
Merge branch 'cassandra-2.2' into trunk


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

Branch: refs/heads/trunk
Commit: 34962c300fe357283b066bd76dccf1ced55613e2
Parents: 0603af9 46ea040
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Wed Jun 3 17:02:08 2015 +0100
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Wed Jun 3 17:02:08 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../io/sstable/SSTableSimpleUnsortedWriter.java | 19 +++++++++----
 .../io/sstable/CQLSSTableWriterTest.java        | 29 ++++++++++++++++++++
 3 files changed, 44 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/34962c30/CHANGES.txt
----------------------------------------------------------------------