cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1078236 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/tools/SSTableExport.java
Date Sat, 05 Mar 2011 05:34:32 GMT
Author: jbellis
Date: Sat Mar  5 05:34:31 2011
New Revision: 1078236

URL: http://svn.apache.org/viewvc?rev=1078236&view=rev
Log:
avoid exporting an un-requested row in sstable2json,when exporting
a key that does not exist
patch by Ben Coverston; reviewed by jbellis for CASSANDRA-2168

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/SSTableExport.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1078236&r1=1078235&r2=1078236&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Sat Mar  5 05:34:31 2011
@@ -5,6 +5,8 @@
  * add ability to write to Cassandra from Pig (CASSANDRA-1828)
  * add rpc_[min|max]_threads (CASSANDRA-2176)
  * add CL.TWO, CL.THREE (CASSANDRA-2013)
+ * avoid exporting an un-requested row in sstable2json, when exporting 
+   a key that does not exist (CASSANDRA-2168)
 
 
 0.7.3

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/SSTableExport.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/SSTableExport.java?rev=1078236&r1=1078235&r2=1078236&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/SSTableExport.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/SSTableExport.java
Sat Mar  5 05:34:31 2011
@@ -283,10 +283,8 @@ public class SSTableExport
 
         IPartitioner<?> partitioner = StorageService.getPartitioner();
 
-        for (String toExclude : excludes)
-        {
-            toExport.remove(toExclude); // excluding key from export
-        }
+        if (excludes != null)
+            toExport.removeAll(Arrays.asList(excludes));
 
         outs.println("{");
 
@@ -309,7 +307,11 @@ public class SSTableExport
             if (!scanner.hasNext())
                 continue;
 
-            serializeRow(reader, (SSTableIdentityIterator) scanner.next(), decoratedKey,
outs);
+            SSTableIdentityIterator row = (SSTableIdentityIterator) scanner.next();
+            if (!row.getKey().equals(decoratedKey))
+                continue;
+
+            serializeRow(reader, row, decoratedKey, outs);
 
             if (i != 0)
                 outs.println(",");



Mime
View raw message