You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2016/03/17 11:11:51 UTC
cassandra git commit: Print current leveling in sstableofflinerelevel
Repository: cassandra
Updated Branches:
refs/heads/trunk 3508cd1af -> e739f6057
Print current leveling in sstableofflinerelevel
Patch by marcuse; reviewed by Sylvain Lebresne for CASSANDRA-9588
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e739f605
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e739f605
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e739f605
Branch: refs/heads/trunk
Commit: e739f60570aaeb7cd8194c8cbed4bbe1ea9ca006
Parents: 3508cd1
Author: Marcus Eriksson <ma...@apache.org>
Authored: Thu Mar 17 10:01:32 2016 +0100
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Thu Mar 17 11:09:54 2016 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cassandra/tools/SSTableOfflineRelevel.java | 20 +++++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/e739f605/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index cf0c0ab..0779083 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.6
+ * Print current leveling in sstableofflinerelevel (CASSANDRA-9588)
* Remove hard-coded SSL cipher suites and protocols (CASSANDRA-10508)
* Improve concurrency in CompactionStrategyManager (CASSANDRA-10099)
* (cqlsh) interpret CQL type for formatting blobs (CASSANDRA-11274)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/e739f605/src/java/org/apache/cassandra/tools/SSTableOfflineRelevel.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableOfflineRelevel.java b/src/java/org/apache/cassandra/tools/SSTableOfflineRelevel.java
index b62512a..9f0395b 100644
--- a/src/java/org/apache/cassandra/tools/SSTableOfflineRelevel.java
+++ b/src/java/org/apache/cassandra/tools/SSTableOfflineRelevel.java
@@ -29,7 +29,9 @@ import java.util.Map;
import java.util.Set;
import com.google.common.base.Throwables;
+import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
import org.apache.cassandra.config.Schema;
@@ -143,8 +145,23 @@ public class SSTableOfflineRelevel
approxExpectedLevels = (int) Math.ceil(Math.log10(sstables.size()));
}
+ private void printLeveling(Iterable<SSTableReader> sstables)
+ {
+ Multimap<Integer, SSTableReader> leveling = ArrayListMultimap.create();
+ int maxLevel = 0;
+ for (SSTableReader sstable : sstables)
+ {
+ leveling.put(sstable.getSSTableLevel(), sstable);
+ maxLevel = Math.max(sstable.getSSTableLevel(), maxLevel);
+ }
+ System.out.println("Current leveling:");
+ for (int i = 0; i <= maxLevel; i++)
+ System.out.println(String.format("L%d=%d", i, leveling.get(i).size()));
+ }
+
public void relevel(boolean dryRun) throws IOException
{
+ printLeveling(sstables);
List<SSTableReader> sortedSSTables = new ArrayList<>(sstables);
Collections.sort(sortedSSTables, new Comparator<SSTableReader>()
{
@@ -187,8 +204,9 @@ public class SSTableOfflineRelevel
System.out.println("New leveling: ");
System.out.println("L0="+l0.size());
+ // item 0 in levels is the highest level we will create, printing from L1 up here:
for (int i = levels.size() - 1; i >= 0; i--)
- System.out.println(String.format("L%d %d", levels.size() - i, levels.get(i).size()));
+ System.out.println(String.format("L%d=%d", levels.size() - i, levels.get(i).size()));
if (!dryRun)
{