You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2019/12/31 14:30:52 UTC

[cassandra] branch cassandra-3.0 updated: Fix sstabledump's position key value when partitions have multiple rows

This is an automated email from the ASF dual-hosted git repository.

mck pushed a commit to branch cassandra-3.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-3.0 by this push:
     new de4e250  Fix sstabledump's position key value when partitions have multiple rows
de4e250 is described below

commit de4e2504f4533f923ac4de2cac44abd86407e5a4
Author: Mick Semb Wever <mc...@apache.org>
AuthorDate: Sun Dec 29 11:34:54 2019 +0100

    Fix sstabledump's position key value when partitions have multiple rows
    
     patch by Cameron Zemek; reviewed by Chris Lohfink, Mick Semb Wever for CASSANDRA-14721
---
 CHANGES.txt                                        |  1 +
 .../apache/cassandra/tools/JsonTransformer.java    | 42 +++++++++++-----------
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 5c637cb..f5c4935 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.20
+ * Fix sstabledump's position key value when partitions have multiple rows (CASSANDRA-14721)
  * Avoid over-scanning data directories in LogFile.verify() (CASSANDRA-15364)
  * Bump generations and document changes to system_distributed and system_traces in 3.0, 3.11
    (CASSANDRA-15441)
diff --git a/src/java/org/apache/cassandra/tools/JsonTransformer.java b/src/java/org/apache/cassandra/tools/JsonTransformer.java
index c679fc3..a5e8553 100644
--- a/src/java/org/apache/cassandra/tools/JsonTransformer.java
+++ b/src/java/org/apache/cassandra/tools/JsonTransformer.java
@@ -197,33 +197,35 @@ public final class JsonTransformer
 
             json.writeEndObject();
 
-            if (partition.hasNext() || partition.staticRow() != null)
+            json.writeFieldName("rows");
+            json.writeStartArray();
+            updatePosition();
+
+            if (partition.staticRow() != null)
             {
-                json.writeFieldName("rows");
-                json.writeStartArray();
-                updatePosition();
                 if (!partition.staticRow().isEmpty())
                     serializeRow(partition.staticRow());
-
-                Unfiltered unfiltered;
                 updatePosition();
-                while (partition.hasNext())
+            }
+
+            Unfiltered unfiltered;
+            while (partition.hasNext())
+            {
+                unfiltered = partition.next();
+                if (unfiltered instanceof Row)
                 {
-                    unfiltered = partition.next();
-                    if (unfiltered instanceof Row)
-                    {
-                        serializeRow((Row) unfiltered);
-                    }
-                    else if (unfiltered instanceof RangeTombstoneMarker)
-                    {
-                        serializeTombstone((RangeTombstoneMarker) unfiltered);
-                    }
-                    updatePosition();
+                    serializeRow((Row) unfiltered);
                 }
-                json.writeEndArray();
-
-                json.writeEndObject();
+                else if (unfiltered instanceof RangeTombstoneMarker)
+                {
+                    serializeTombstone((RangeTombstoneMarker) unfiltered);
+                }
+                updatePosition();
             }
+
+            json.writeEndArray();
+
+            json.writeEndObject();
         }
         catch (IOException e)
         {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org