cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cassandra git commit: Delete processed sstables in sstablesplit/sstableupgrade. Adds option to keep originals in sstableupgrade. Removes unused verbose option in sstablesplit.
Date Thu, 07 May 2015 18:21:03 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 049a965bf -> 09ccf60ed


Delete processed sstables in sstablesplit/sstableupgrade. Adds option to keep originals in
sstableupgrade. Removes unused verbose option in sstablesplit.

patch by Branimir Lambov; reviewed by tjake for (CASSANDRA-8606)


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

Branch: refs/heads/cassandra-2.1
Commit: 09ccf60ed3372cc8378fb2f788b97e826a21d7e1
Parents: 049a965
Author: Branimir Lambov <branimir.lambov@datastax.com>
Authored: Tue Mar 31 14:41:42 2015 +0100
Committer: T Jake Luciani <jake@apache.org>
Committed: Thu May 7 14:19:39 2015 -0400

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 .../org/apache/cassandra/tools/StandaloneSplitter.java  |  8 ++++----
 .../org/apache/cassandra/tools/StandaloneUpgrader.java  | 12 ++++++++++++
 3 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/09ccf60e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d512973..098cfe0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.6
+ * Delete processed sstables in sstablesplit/sstableupgrade (CASSANDRA-8606)
  * Improve sstable exclusion from partition tombstones (CASSANDRA-9298)
  * Validate the indexed column rather than the cell's contents for 2i (CASSANDRA-9057)
  * Add support for top-k custom 2i queries (CASSANDRA-8717)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/09ccf60e/src/java/org/apache/cassandra/tools/StandaloneSplitter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/StandaloneSplitter.java b/src/java/org/apache/cassandra/tools/StandaloneSplitter.java
index bc614cc..fd93f03 100644
--- a/src/java/org/apache/cassandra/tools/StandaloneSplitter.java
+++ b/src/java/org/apache/cassandra/tools/StandaloneSplitter.java
@@ -42,7 +42,6 @@ public class StandaloneSplitter
     public static final int DEFAULT_SSTABLE_SIZE = 50;
 
     private static final String TOOL_NAME = "sstablessplit";
-    private static final String VERBOSE_OPTION = "verbose";
     private static final String DEBUG_OPTION = "debug";
     private static final String HELP_OPTION = "help";
     private static final String NO_SNAPSHOT_OPTION = "no-snapshot";
@@ -152,6 +151,10 @@ public class StandaloneSplitter
                 try
                 {
                     new SSTableSplitter(cfs, sstable, options.sizeInMB).split();
+
+                    // Remove the sstable (it's been copied by split and snapshotted)
+                    sstable.markObsolete();
+                    sstable.selfRef().release();
                 }
                 catch (Exception e)
                 {
@@ -185,7 +188,6 @@ public class StandaloneSplitter
         public final List<String> filenames;
 
         public boolean debug;
-        public boolean verbose;
         public boolean snapshot;
         public int sizeInMB;
 
@@ -217,7 +219,6 @@ public class StandaloneSplitter
                 }
                 Options opts = new Options(Arrays.asList(args));
                 opts.debug = cmd.hasOption(DEBUG_OPTION);
-                opts.verbose = cmd.hasOption(VERBOSE_OPTION);
                 opts.snapshot = !cmd.hasOption(NO_SNAPSHOT_OPTION);
                 opts.sizeInMB = DEFAULT_SSTABLE_SIZE;
 
@@ -244,7 +245,6 @@ public class StandaloneSplitter
         {
             CmdLineOptions options = new CmdLineOptions();
             options.addOption(null, DEBUG_OPTION,          "display stack traces");
-            options.addOption("v",  VERBOSE_OPTION,        "verbose output");
             options.addOption("h",  HELP_OPTION,           "display this help message");
             options.addOption(null, NO_SNAPSHOT_OPTION,    "don't snapshot the sstables before
splitting");
             options.addOption("s",  SIZE_OPTION, "size",   "maximum size in MB for the output
sstables (default: " + DEFAULT_SSTABLE_SIZE + ")");

http://git-wip-us.apache.org/repos/asf/cassandra/blob/09ccf60e/src/java/org/apache/cassandra/tools/StandaloneUpgrader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/StandaloneUpgrader.java b/src/java/org/apache/cassandra/tools/StandaloneUpgrader.java
index 8fa5b60..22c57f7 100644
--- a/src/java/org/apache/cassandra/tools/StandaloneUpgrader.java
+++ b/src/java/org/apache/cassandra/tools/StandaloneUpgrader.java
@@ -41,6 +41,7 @@ public class StandaloneUpgrader
     private static final String TOOL_NAME = "sstableupgrade";
     private static final String DEBUG_OPTION  = "debug";
     private static final String HELP_OPTION  = "help";
+    private static final String KEEP_SOURCE = "keep-source";
 
     public static void main(String args[]) throws IOException
     {
@@ -101,6 +102,14 @@ public class StandaloneUpgrader
                 {
                     Upgrader upgrader = new Upgrader(cfs, sstable, handler);
                     upgrader.upgrade();
+
+                    if (!options.keepSource)
+                    {
+                        // Remove the sstable (it's been copied by upgrade)
+                        System.out.format("Deleting table %s.\n", sstable.descriptor.baseFilename());
+                        sstable.markObsolete();
+                        sstable.selfRef().release();
+                    }
                 }
                 catch (Exception e)
                 {
@@ -129,6 +138,7 @@ public class StandaloneUpgrader
         public final String snapshot;
 
         public boolean debug;
+        public boolean keepSource;
 
         private Options(String keyspace, String cf, String snapshot)
         {
@@ -168,6 +178,7 @@ public class StandaloneUpgrader
                 Options opts = new Options(keyspace, cf, snapshot);
 
                 opts.debug = cmd.hasOption(DEBUG_OPTION);
+                opts.keepSource = cmd.hasOption(KEEP_SOURCE);
 
                 return opts;
             }
@@ -190,6 +201,7 @@ public class StandaloneUpgrader
             CmdLineOptions options = new CmdLineOptions();
             options.addOption(null, DEBUG_OPTION,          "display stack traces");
             options.addOption("h",  HELP_OPTION,           "display this help message");
+            options.addOption("k",  KEEP_SOURCE,           "do not delete the source sstables");
             return options;
         }
 


Mime
View raw message