cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Fix total bytes count for parallel compaction
Date Fri, 30 Mar 2012 14:20:39 GMT
Updated Branches:
  refs/heads/cassandra-1.0 7326ba887 -> 3931ee709


Fix total bytes count for parallel compaction

patch by slebresne; reviewed by jbellis for CASSANDRA-3758


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

Branch: refs/heads/cassandra-1.0
Commit: 3931ee709da29d3b9d9c28b8d0ef34cfdb357c1c
Parents: 7326ba8
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Fri Mar 30 16:19:27 2012 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Fri Mar 30 16:19:27 2012 +0200

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../db/compaction/AbstractCompactionIterable.java  |   13 +++++++++++--
 .../db/compaction/CompactionIterable.java          |    7 +------
 .../db/compaction/ParallelCompactionIterable.java  |    4 +---
 4 files changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3931ee70/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3316e87..438bc91 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -15,6 +15,7 @@
    tasks and upgradesstables (CASSANDRA-3985)
  * fix NPE on invalid CQL delete command (CASSANDRA-3755)
  * allow custom types in CLI's assume command (CASSANDRA-4081)
+ * Fix totalBytes count for parallel compactions (CASSANDRA-3758)
 
 
 1.0.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3931ee70/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java
index 53b1ba9..3182219 100644
--- a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java
+++ b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java
@@ -41,15 +41,24 @@ public abstract class AbstractCompactionIterable implements Iterable<AbstractCom
 
     protected final OperationType type;
     protected final CompactionController controller;
-    protected long totalBytes;
+    protected final long totalBytes;
     protected volatile long bytesRead;
+    protected final List<SSTableScanner> scanners;
 
     protected final Throttle throttle;
 
-    public AbstractCompactionIterable(CompactionController controller, OperationType type)
+    public AbstractCompactionIterable(CompactionController controller, OperationType type,
List<SSTableScanner> scanners)
     {
         this.controller = controller;
         this.type = type;
+        this.scanners = scanners;
+        this.bytesRead = 0;
+
+        long bytes = 0;
+        for (SSTableScanner scanner : scanners)
+            bytes += scanner.getFileLength();
+        this.totalBytes = bytes;
+
         this.throttle = new Throttle(toString(), new Throttle.ThroughputFunction()
         {
             /** @return Instantaneous throughput target in bytes per millisecond. */

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3931ee70/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java b/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java
index 5e0dfa7..65e4b54 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java
@@ -41,7 +41,6 @@ public class CompactionIterable extends AbstractCompactionIterable
     private static Logger logger = LoggerFactory.getLogger(CompactionIterable.class);
 
     private long row;
-    private final List<SSTableScanner> scanners;
 
     private static final Comparator<IColumnIterator> comparator = new Comparator<IColumnIterator>()
     {
@@ -58,12 +57,8 @@ public class CompactionIterable extends AbstractCompactionIterable
 
     protected CompactionIterable(OperationType type, List<SSTableScanner> scanners,
CompactionController controller)
     {
-        super(controller, type);
-        this.scanners = scanners;
+        super(controller, type, scanners);
         row = 0;
-        totalBytes = bytesRead = 0;
-        for (SSTableScanner scanner : scanners)
-            totalBytes += scanner.getFileLength();
     }
 
     protected static List<SSTableScanner> getScanners(Iterable<SSTableReader>
sstables) throws IOException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3931ee70/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 dba8f55..52f81e0 100644
--- a/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
+++ b/src/java/org/apache/cassandra/db/compaction/ParallelCompactionIterable.java
@@ -59,7 +59,6 @@ public class ParallelCompactionIterable extends AbstractCompactionIterable
 {
     private static Logger logger = LoggerFactory.getLogger(ParallelCompactionIterable.class);
 
-    private final List<SSTableScanner> scanners;
     private final int maxInMemorySize;
 
     public ParallelCompactionIterable(OperationType type, Iterable<SSTableReader> sstables,
CompactionController controller) throws IOException
@@ -74,8 +73,7 @@ public class ParallelCompactionIterable extends AbstractCompactionIterable
 
     protected ParallelCompactionIterable(OperationType type, List<SSTableScanner> scanners,
CompactionController controller, int maxInMemorySize)
     {
-        super(controller, type);
-        this.scanners = scanners;
+        super(controller, type, scanners);
         this.maxInMemorySize = maxInMemorySize;
     }
 


Mime
View raw message