cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/2] git commit: clarify that PCI.MergeTask operates on Rows, not NotifyingSSTableIdentityIterators
Date Tue, 28 Aug 2012 22:28:32 GMT
clarify that PCI.MergeTask operates on Rows, not NotifyingSSTableIdentityIterators


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

Branch: refs/heads/trunk
Commit: b0c2fa7a8b6f13b11f5ad6e088e4d2490f51d476
Parents: 70754af
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Tue Aug 28 15:52:24 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Aug 28 17:27:53 2012 -0500

----------------------------------------------------------------------
 .../db/compaction/ParallelCompactionIterable.java  |   18 ++++++++++-----
 1 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0c2fa7a/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java b/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
index 47dc88a..f696ad4 100644
--- a/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
+++ b/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
@@ -174,7 +174,13 @@ public class ParallelCompactionIterable extends AbstractCompactionIterable
             }
 
             if (inMemory)
-                return new CompactedRowContainer(rows.get(0).getKey(), executor.submit(new
MergeTask(new ArrayList<RowContainer>(rows))));
+            {
+                // caller will re-use rows List, so make ourselves a copy
+                List<Row> rawRows = new ArrayList<Row>(rows.size());
+                for (RowContainer rowContainer : rows)
+                    rawRows.add(rowContainer.row);
+                return new CompactedRowContainer(rows.get(0).getKey(), executor.submit(new
MergeTask(rawRows)));
+            }
 
             List<ICountableColumnIterator> iterators = new ArrayList<ICountableColumnIterator>(rows.size());
             for (RowContainer container : rows)
@@ -189,9 +195,9 @@ public class ParallelCompactionIterable extends AbstractCompactionIterable
 
         private class MergeTask implements Callable<ColumnFamily>
         {
-            private final List<RowContainer> rows;
+            private final List<Row> rows;
 
-            public MergeTask(List<RowContainer> rows)
+            public MergeTask(List<Row> rows)
             {
                 this.rows = rows;
             }
@@ -199,9 +205,9 @@ public class ParallelCompactionIterable extends AbstractCompactionIterable
             public ColumnFamily call() throws Exception
             {
                 ColumnFamily cf = null;
-                for (RowContainer container : rows)
+                for (Row row : rows)
                 {
-                    ColumnFamily thisCF = container.row.cf;
+                    ColumnFamily thisCF = row.cf;
                     if (cf == null)
                     {
                         cf = thisCF;
@@ -213,7 +219,7 @@ public class ParallelCompactionIterable extends AbstractCompactionIterable
                     }
                 }
 
-                return PrecompactedRow.removeDeletedAndOldShards(rows.get(0).getKey(), controller,
cf);
+                return PrecompactedRow.removeDeletedAndOldShards(rows.get(0).key, controller,
cf);
             }
         }
 


Mime
View raw message