cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [3/4] cassandra git commit: Make anticompactions visible in compactionstats
Date Fri, 17 Apr 2015 14:34:48 GMT
Make anticompactions visible in compactionstats

Patch by marcuse; reviewed by yukim for CASSANDRA-9098


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

Branch: refs/heads/trunk
Commit: df014036bb720895837a44d0273ff41ebc357cba
Parents: 19eb5e2
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Wed Apr 8 15:13:38 2015 +0200
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Fri Apr 17 16:29:38 2015 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../db/compaction/CompactionManager.java        | 32 ++++++++++++--------
 2 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/df014036/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0f6329a..74ec921 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.5
+ * Make anticompaction visible in compactionstats (CASSANDRA-9098)
  * Improve nodetool getendpoints documentation about the partition
    key parameter (CASSANDRA-6458)
  * Don't check other keyspaces for schema changes when an user-defined

http://git-wip-us.apache.org/repos/asf/cassandra/blob/df014036/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index a33e533..72deb21 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -1079,22 +1079,30 @@ public class CompactionManager implements CompactionManagerMBean
 
                 CompactionIterable ci = new CompactionIterable(OperationType.ANTICOMPACTION,
scanners.scanners, controller);
                 Iterator<AbstractCompactedRow> iter = ci.iterator();
-                while(iter.hasNext())
+                metrics.beginCompaction(ci);
+                try
                 {
-                    AbstractCompactedRow row = iter.next();
-                    // if current range from sstable is repaired, save it into the new repaired
sstable
-                    if (Range.isInRanges(row.key.getToken(), ranges))
-                    {
-                        repairedSSTableWriter.append(row);
-                        repairedKeyCount++;
-                    }
-                    // otherwise save into the new 'non-repaired' table
-                    else
+                    while (iter.hasNext())
                     {
-                        unRepairedSSTableWriter.append(row);
-                        unrepairedKeyCount++;
+                        AbstractCompactedRow row = iter.next();
+                        // if current range from sstable is repaired, save it into the new
repaired sstable
+                        if (Range.isInRanges(row.key.getToken(), ranges))
+                        {
+                            repairedSSTableWriter.append(row);
+                            repairedKeyCount++;
+                        }
+                        // otherwise save into the new 'non-repaired' table
+                        else
+                        {
+                            unRepairedSSTableWriter.append(row);
+                            unrepairedKeyCount++;
+                        }
                     }
                 }
+                finally
+                {
+                    metrics.finishCompaction(ci);
+                }
                 anticompactedSSTables.addAll(repairedSSTableWriter.finish(repairedAt));
                 anticompactedSSTables.addAll(unRepairedSSTableWriter.finish(ActiveRepairService.UNREPAIRED_SSTABLE));
                 cfs.getDataTracker().markCompactedSSTablesReplaced(sstableAsSet, anticompactedSSTables,
OperationType.ANTICOMPACTION);


Mime
View raw message