cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [11/15] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
Date Tue, 29 Mar 2016 09:12:57 GMT
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/cassandra-3.5
Commit: 0c91977da68f054cf0ddf996b49423d736b42006
Parents: 3efc609 897ffe8
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Tue Mar 29 11:00:13 2016 +0200
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Tue Mar 29 11:00:13 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../apache/cassandra/db/ColumnFamilyStore.java  | 16 ++++----
 .../db/compaction/CompactionManager.java        | 40 +++++++++++++-------
 .../cassandra/service/StorageService.java       | 23 +++++++++--
 .../cassandra/service/StorageServiceMBean.java  |  6 +++
 .../org/apache/cassandra/tools/NodeProbe.java   | 34 +++++++++++------
 .../cassandra/tools/nodetool/Cleanup.java       |  9 ++++-
 .../apache/cassandra/tools/nodetool/Scrub.java  | 13 +++++--
 .../tools/nodetool/UpgradeSSTable.java          | 10 ++++-
 .../org/apache/cassandra/db/CleanupTest.java    |  6 +--
 .../unit/org/apache/cassandra/db/ScrubTest.java | 16 ++++----
 11 files changed, 120 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index fe19df7,098d062..fdc873e
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -20,36 -8,13 +20,38 @@@ Merged from 2.2
   * Add missing newline at end of bin/cqlsh (CASSANDRA-11325)
   * Fix AE in nodetool cfstats (backport CASSANDRA-10859) (CASSANDRA-11297)
   * Unresolved hostname leads to replace being ignored (CASSANDRA-11210)
 - * Fix filtering on non-primary key columns for thrift static column families
 -   (CASSANDRA-6377)
   * Only log yaml config once, at startup (CASSANDRA-11217)
 - * Preserve order for preferred SSL cipher suites (CASSANDRA-11164)
   * Reference leak with parallel repairs on the same table (CASSANDRA-11215)
 +Merged from 2.1:
++ * Add a -j parameter to scrub/cleanup/upgradesstables to state how
++   many threads to use (CASSANDRA-11179)
 + * Backport CASSANDRA-10679 (CASSANDRA-9598)
 + * InvalidateKeys should have a weak ref to key cache (CASSANDRA-11176)
 + * COPY FROM on large datasets: fix progress report and debug performance (CASSANDRA-11053)
 +
 +3.0.4
 + * Preserve order for preferred SSL cipher suites (CASSANDRA-11164)
 + * MV should only query complex columns included in the view (CASSANDRA-11069)
 + * Failed aggregate creation breaks server permanently (CASSANDRA-11064)
 + * Add sstabledump tool (CASSANDRA-7464)
 + * Introduce backpressure for hints (CASSANDRA-10972)
 + * Fix ClusteringPrefix not being able to read tombstone range boundaries (CASSANDRA-11158)
 + * Prevent logging in sandboxed state (CASSANDRA-11033)
 + * Disallow drop/alter operations of UDTs used by UDAs (CASSANDRA-10721)
 + * Add query time validation method on Index (CASSANDRA-11043)
 + * Avoid potential AssertionError in mixed version cluster (CASSANDRA-11128)
 + * Properly handle hinted handoff after topology changes (CASSANDRA-5902)
 + * AssertionError when listing sstable files on inconsistent disk state (CASSANDRA-11156)
 + * Fix wrong rack counting and invalid conditions check for TokenAllocation
 +   (CASSANDRA-11139)
 + * Avoid creating empty hint files (CASSANDRA-11090)
 + * Fix leak detection strong reference loop using weak reference (CASSANDRA-11120)
 + * Configurie BatchlogManager to stop delayed tasks on shutdown (CASSANDRA-11062)
 + * Hadoop integration is incompatible with Cassandra Driver 3.0.0 (CASSANDRA-11001)
 + * Add dropped_columns to the list of schema table so it gets handled
 +   properly (CASSANDRA-11050)
 + * Fix NPE when using forceRepairRangeAsync without DC (CASSANDRA-11239)
 +Merged from 2.2:
   * Range.compareTo() violates the contract of Comparable (CASSANDRA-11216)
   * Avoid NPE when serializing ErrorMessage with null message (CASSANDRA-11167)
   * Replacing an aggregate with a new version doesn't reset INITCOND (CASSANDRA-10840)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 7c46fcb,ca02747..f339660
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@@ -434,10 -441,10 +448,10 @@@ public class CompactionManager implemen
              @Override
              public void execute(LifecycleTransaction txn) throws IOException
              {
 -                CleanupStrategy cleanupStrategy = CleanupStrategy.get(cfStore, ranges);
 +                CleanupStrategy cleanupStrategy = CleanupStrategy.get(cfStore, ranges, FBUtilities.nowInSeconds());
                  doCleanupOne(cfStore, txn, cleanupStrategy, ranges, hasIndexes);
              }
-         }, OperationType.CLEANUP);
+         }, jobs, OperationType.CLEANUP);
      }
  
      public ListenableFuture<?> submitAntiCompaction(final ColumnFamilyStore cfs,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 3a62063,bca5996..75573ac
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -2633,32 -2553,42 +2633,42 @@@ public class StorageService extends Not
          return Gossiper.instance.getCurrentGenerationNumber(FBUtilities.getBroadcastAddress());
      }
  
 -    public int forceKeyspaceCleanup(String keyspaceName, String... columnFamilies) throws
IOException, ExecutionException, InterruptedException
 +    public int forceKeyspaceCleanup(String keyspaceName, String... tables) throws IOException,
ExecutionException, InterruptedException
      {
 -        return forceKeyspaceCleanup(0, keyspaceName, columnFamilies);
++        return forceKeyspaceCleanup(0, keyspaceName, tables);
+     }
+ 
 -    public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... columnFamilies)
throws IOException, ExecutionException, InterruptedException
++    public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... tables) throws
IOException, ExecutionException, InterruptedException
+     {
 -        if (keyspaceName.equals(SystemKeyspace.NAME))
 +        if (Schema.isSystemKeyspace(keyspaceName))
              throw new RuntimeException("Cleanup of the system keyspace is neither necessary
nor wise");
  
          CompactionManager.AllSSTableOpStatus status = CompactionManager.AllSSTableOpStatus.SUCCESSFUL;
 -        for (ColumnFamilyStore cfStore : getValidColumnFamilies(false, false, keyspaceName,
columnFamilies))
 +        for (ColumnFamilyStore cfStore : getValidColumnFamilies(false, false, keyspaceName,
tables))
          {
-             CompactionManager.AllSSTableOpStatus oneStatus = cfStore.forceCleanup();
+             CompactionManager.AllSSTableOpStatus oneStatus = cfStore.forceCleanup(jobs);
              if (oneStatus != CompactionManager.AllSSTableOpStatus.SUCCESSFUL)
                  status = oneStatus;
          }
          return status.statusCode;
      }
  
 -    public int scrub(boolean disableSnapshot, boolean skipCorrupted, String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, InterruptedException
 +    public int scrub(boolean disableSnapshot, boolean skipCorrupted, String keyspaceName,
String... tables) throws IOException, ExecutionException, InterruptedException
      {
-         return scrub(disableSnapshot, skipCorrupted, true, keyspaceName, tables);
 -        return scrub(disableSnapshot, skipCorrupted, true, 0, keyspaceName, columnFamilies);
++        return scrub(disableSnapshot, skipCorrupted, true, 0, keyspaceName, tables);
      }
  
 -    public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException
 +    public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
String keyspaceName, String... tables) throws IOException, ExecutionException, InterruptedException
      {
 -        return scrub(disableSnapshot, skipCorrupted, checkData, 0, keyspaceName, columnFamilies);
++        return scrub(disableSnapshot, skipCorrupted, checkData, 0, keyspaceName, tables);
+     }
+ 
 -    public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
int jobs, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException
++    public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
int jobs, String keyspaceName, String... tables) throws IOException, ExecutionException, InterruptedException
+     {
          CompactionManager.AllSSTableOpStatus status = CompactionManager.AllSSTableOpStatus.SUCCESSFUL;
 -        for (ColumnFamilyStore cfStore : getValidColumnFamilies(true, false, keyspaceName,
columnFamilies))
 +        for (ColumnFamilyStore cfStore : getValidColumnFamilies(true, false, keyspaceName,
tables))
          {
-             CompactionManager.AllSSTableOpStatus oneStatus = cfStore.scrub(disableSnapshot,
skipCorrupted, checkData);
+             CompactionManager.AllSSTableOpStatus oneStatus = cfStore.scrub(disableSnapshot,
skipCorrupted, checkData, jobs);
              if (oneStatus != CompactionManager.AllSSTableOpStatus.SUCCESSFUL)
                  status = oneStatus;
          }
@@@ -2677,12 -2606,17 +2687,17 @@@
          return status.statusCode;
      }
  
 -    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, String...
columnFamilies) throws IOException, ExecutionException, InterruptedException
 +    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, String...
tableNames) throws IOException, ExecutionException, InterruptedException
      {
 -        return upgradeSSTables(keyspaceName, excludeCurrentVersion, 2, columnFamilies);
++        return upgradeSSTables(keyspaceName, excludeCurrentVersion, 0, tableNames);
+     }
+ 
 -    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, int jobs,
String... columnFamilies) throws IOException, ExecutionException, InterruptedException
++    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, int jobs,
String... tableNames) throws IOException, ExecutionException, InterruptedException
+     {
          CompactionManager.AllSSTableOpStatus status = CompactionManager.AllSSTableOpStatus.SUCCESSFUL;
 -        for (ColumnFamilyStore cfStore : getValidColumnFamilies(true, true, keyspaceName,
columnFamilies))
 +        for (ColumnFamilyStore cfStore : getValidColumnFamilies(true, true, keyspaceName,
tableNames))
          {
-             CompactionManager.AllSSTableOpStatus oneStatus = cfStore.sstablesRewrite(excludeCurrentVersion);
+             CompactionManager.AllSSTableOpStatus oneStatus = cfStore.sstablesRewrite(excludeCurrentVersion,
jobs);
              if (oneStatus != CompactionManager.AllSSTableOpStatus.SUCCESSFUL)
                  status = oneStatus;
          }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/src/java/org/apache/cassandra/service/StorageServiceMBean.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageServiceMBean.java
index 049b4f9,761eed6..5b7331d
--- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java
+++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
@@@ -251,7 -251,9 +251,9 @@@ public interface StorageServiceMBean ex
      /**
       * Trigger a cleanup of keys on a single keyspace
       */
+     @Deprecated
 -    public int forceKeyspaceCleanup(String keyspaceName, String... columnFamilies) throws
IOException, ExecutionException, InterruptedException;
 -    public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... columnFamilies)
throws IOException, ExecutionException, InterruptedException;
 +    public int forceKeyspaceCleanup(String keyspaceName, String... tables) throws IOException,
ExecutionException, InterruptedException;
++    public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... tables) throws
IOException, ExecutionException, InterruptedException;
  
      /**
       * Scrub (deserialize + reserialize at the latest version, skipping bad rows if any)
the given keyspace.
@@@ -260,8 -262,10 +262,10 @@@
       * Scrubbed CFs will be snapshotted first, if disableSnapshot is false
       */
      @Deprecated
 -    public int scrub(boolean disableSnapshot, boolean skipCorrupted, String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, InterruptedException;
 +    public int scrub(boolean disableSnapshot, boolean skipCorrupted, String keyspaceName,
String... tableNames) throws IOException, ExecutionException, InterruptedException;
+     @Deprecated
 -    public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException;
 +    public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
String keyspaceName, String... tableNames) throws IOException, ExecutionException, InterruptedException;
+     public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
int jobs, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException;
  
      /**
       * Verify (checksums of) the given keyspace.
@@@ -275,7 -279,9 +279,9 @@@
       * Rewrite all sstables to the latest version.
       * Unlike scrub, it doesn't skip bad rows and do not snapshot sstables first.
       */
+     @Deprecated
 -    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, String...
columnFamilies) throws IOException, ExecutionException, InterruptedException;
 -    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, int jobs,
String... columnFamilies) throws IOException, ExecutionException, InterruptedException;
 +    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, String...
tableNames) throws IOException, ExecutionException, InterruptedException;
++    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, int jobs,
String... tableNames) throws IOException, ExecutionException, InterruptedException;
  
      /**
       * Flush all memtables for the given column families, or all columnfamilies for the
given keyspace

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/NodeProbe.java
index cdce497,2f27cea..a9d71d8
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@@ -53,9 -53,9 +53,10 @@@ import javax.management.remote.JMXConne
  import javax.management.remote.JMXServiceURL;
  import javax.rmi.ssl.SslRMIClientSocketFactory;
  
 +import org.apache.cassandra.batchlog.BatchlogManager;
 +import org.apache.cassandra.batchlog.BatchlogManagerMBean;
+ import org.apache.cassandra.config.DatabaseDescriptor;
  import org.apache.cassandra.db.ColumnFamilyStoreMBean;
 -import org.apache.cassandra.db.HintedHandOffManager;
  import org.apache.cassandra.db.HintedHandOffManagerMBean;
  import org.apache.cassandra.db.compaction.CompactionManager;
  import org.apache.cassandra.db.compaction.CompactionManagerMBean;
@@@ -236,38 -231,46 +237,46 @@@ public class NodeProbe implements AutoC
          jmxc.close();
      }
  
-     public int forceKeyspaceCleanup(String keyspaceName, String... tables) throws IOException,
ExecutionException, InterruptedException
 -    public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... columnFamilies)
throws IOException, ExecutionException, InterruptedException
++    public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... tables) throws
IOException, ExecutionException, InterruptedException
      {
-         return ssProxy.forceKeyspaceCleanup(keyspaceName, tables);
 -        return ssProxy.forceKeyspaceCleanup(jobs, keyspaceName, columnFamilies);
++        return ssProxy.forceKeyspaceCleanup(jobs, keyspaceName, tables);
      }
  
-     public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
String keyspaceName, String... tables) throws IOException, ExecutionException, InterruptedException
 -    public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
int jobs, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException
++    public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData,
int jobs, String keyspaceName, String... tables) throws IOException, ExecutionException, InterruptedException
      {
-         return ssProxy.scrub(disableSnapshot, skipCorrupted, checkData, keyspaceName, tables);
 -        return ssProxy.scrub(disableSnapshot, skipCorrupted, checkData, jobs, keyspaceName,
columnFamilies);
++        return ssProxy.scrub(disableSnapshot, skipCorrupted, checkData, jobs, keyspaceName,
tables);
      }
  
 -    public int verify(boolean extendedVerify, String keyspaceName, String... columnFamilies)
throws IOException, ExecutionException, InterruptedException
 +    public int verify(boolean extendedVerify, String keyspaceName, String... tableNames)
throws IOException, ExecutionException, InterruptedException
      {
 -        return ssProxy.verify(extendedVerify, keyspaceName, columnFamilies);
 +        return ssProxy.verify(extendedVerify, keyspaceName, tableNames);
      }
  
-     public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, String...
tableNames) throws IOException, ExecutionException, InterruptedException
 -    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, int jobs,
String... columnFamilies) throws IOException, ExecutionException, InterruptedException
++    public int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, int jobs,
String... tableNames) throws IOException, ExecutionException, InterruptedException
      {
-         return ssProxy.upgradeSSTables(keyspaceName, excludeCurrentVersion, tableNames);
 -        return ssProxy.upgradeSSTables(keyspaceName, excludeCurrentVersion, jobs, columnFamilies);
++        return ssProxy.upgradeSSTables(keyspaceName, excludeCurrentVersion, jobs, tableNames);
      }
  
-     public void forceKeyspaceCleanup(PrintStream out, String keyspaceName, String... tableNames)
throws IOException, ExecutionException, InterruptedException
+     private void checkJobs(PrintStream out, int jobs)
      {
-         if (forceKeyspaceCleanup(keyspaceName, tableNames) != 0)
+         if (jobs > DatabaseDescriptor.getConcurrentCompactors())
+             out.println(String.format("jobs (%d) is bigger than configured concurrent_compactors
(%d), using at most %d threads", jobs, DatabaseDescriptor.getConcurrentCompactors(), DatabaseDescriptor.getConcurrentCompactors()));
+     }
+ 
 -    public void forceKeyspaceCleanup(PrintStream out, int jobs, String keyspaceName, String...
columnFamilies) throws IOException, ExecutionException, InterruptedException
++    public void forceKeyspaceCleanup(PrintStream out, int jobs, String keyspaceName, String...
tableNames) throws IOException, ExecutionException, InterruptedException
+     {
+         checkJobs(out, jobs);
 -        if (forceKeyspaceCleanup(jobs, keyspaceName, columnFamilies) != 0)
++        if (forceKeyspaceCleanup(jobs, keyspaceName, tableNames) != 0)
          {
              failed = true;
              out.println("Aborted cleaning up at least one table in keyspace "+keyspaceName+",
check server logs for more information.");
          }
      }
  
-     public void scrub(PrintStream out, boolean disableSnapshot, boolean skipCorrupted, boolean
checkData, String keyspaceName, String... tables) throws IOException, ExecutionException,
InterruptedException
 -    public void scrub(PrintStream out, boolean disableSnapshot, boolean skipCorrupted, boolean
checkData, int jobs, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException
++    public void scrub(PrintStream out, boolean disableSnapshot, boolean skipCorrupted, boolean
checkData, int jobs, String keyspaceName, String... tables) throws IOException, ExecutionException,
InterruptedException
      {
-         if (scrub(disableSnapshot, skipCorrupted, checkData, keyspaceName, tables) != 0)
+         checkJobs(out, jobs);
 -        if (scrub(disableSnapshot, skipCorrupted, checkData, jobs, keyspaceName, columnFamilies)
!= 0)
++        if (scrub(disableSnapshot, skipCorrupted, checkData, jobs, keyspaceName, tables)
!= 0)
          {
              failed = true;
              out.println("Aborted scrubbing at least one table in keyspace "+keyspaceName+",
check server logs for more information.");
@@@ -284,9 -287,10 +293,10 @@@
      }
  
  
-     public void upgradeSSTables(PrintStream out, String keyspaceName, boolean excludeCurrentVersion,
String... tableNames) throws IOException, ExecutionException, InterruptedException
 -    public void upgradeSSTables(PrintStream out, String keyspaceName, boolean excludeCurrentVersion,
int jobs, String... columnFamilies) throws IOException, ExecutionException, InterruptedException
++    public void upgradeSSTables(PrintStream out, String keyspaceName, boolean excludeCurrentVersion,
int jobs, String... tableNames) throws IOException, ExecutionException, InterruptedException
      {
-         if (upgradeSSTables(keyspaceName, excludeCurrentVersion, tableNames) != 0)
+         checkJobs(out, jobs);
 -        if (upgradeSSTables(keyspaceName, excludeCurrentVersion, jobs, columnFamilies) !=
0)
++        if (upgradeSSTables(keyspaceName, excludeCurrentVersion, jobs, tableNames) != 0)
          {
              failed = true;
              out.println("Aborted upgrading sstables for atleast one table in keyspace "+keyspaceName+",
check server logs for more information.");

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/src/java/org/apache/cassandra/tools/nodetool/Cleanup.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/nodetool/Cleanup.java
index cbfd4d6,6c6676d..a7507b1
--- a/src/java/org/apache/cassandra/tools/nodetool/Cleanup.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/Cleanup.java
@@@ -23,8 -23,8 +23,8 @@@ import io.airlift.command.Command
  import java.util.ArrayList;
  import java.util.List;
  
 +import org.apache.cassandra.config.Schema;
- import org.apache.cassandra.db.SystemKeyspace;
+ import io.airlift.command.Option;
 -import org.apache.cassandra.db.SystemKeyspace;
  import org.apache.cassandra.tools.NodeProbe;
  import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
  
@@@ -47,9 -52,8 +52,9 @@@ public class Cleanup extends NodeToolCm
  
              try
              {
-                 probe.forceKeyspaceCleanup(System.out, keyspace, tableNames);
 -                probe.forceKeyspaceCleanup(System.out, jobs, keyspace, cfnames);
 -            } catch (Exception e)
++                probe.forceKeyspaceCleanup(System.out, jobs, keyspace, tableNames);
 +            }
 +            catch (Exception e)
              {
                  throw new RuntimeException("Error occurred during cleanup", e);
              }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/src/java/org/apache/cassandra/tools/nodetool/Scrub.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/nodetool/Scrub.java
index f92ae0d,dafe8d1..2345a85
--- a/src/java/org/apache/cassandra/tools/nodetool/Scrub.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/Scrub.java
@@@ -58,11 -63,11 +63,13 @@@ public class Scrub extends NodeToolCm
          {
              try
              {
-                 probe.scrub(System.out, disableSnapshot, skipCorrupted, !noValidation, keyspace,
tableNames);
 -                probe.scrub(System.out, disableSnapshot, skipCorrupted, !noValidation, jobs,
keyspace, cfnames);
--            } catch (IllegalArgumentException e)
++                probe.scrub(System.out, disableSnapshot, skipCorrupted, !noValidation, jobs,
keyspace, tableNames);
++            }
++            catch (IllegalArgumentException e)
              {
                  throw e;
--            } catch (Exception e)
++            }
++            catch (Exception e)
              {
                  throw new RuntimeException("Error occurred during scrubbing", e);
              }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/src/java/org/apache/cassandra/tools/nodetool/UpgradeSSTable.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/nodetool/UpgradeSSTable.java
index a775878,596f353..82866e0
--- a/src/java/org/apache/cassandra/tools/nodetool/UpgradeSSTable.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/UpgradeSSTable.java
@@@ -46,8 -51,8 +51,9 @@@ public class UpgradeSSTable extends Nod
          {
              try
              {
-                 probe.upgradeSSTables(System.out, keyspace, !includeAll, tableNames);
 -                probe.upgradeSSTables(System.out, keyspace, !includeAll, jobs, cfnames);
--            } catch (Exception e)
++                probe.upgradeSSTables(System.out, keyspace, !includeAll, jobs, tableNames);
++            }
++            catch (Exception e)
              {
                  throw new RuntimeException("Error occurred during enabling auto-compaction",
e);
              }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/test/unit/org/apache/cassandra/db/CleanupTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/CleanupTest.java
index 167f3b0,5777af4..b4ffe57
--- a/test/unit/org/apache/cassandra/db/CleanupTest.java
+++ b/test/unit/org/apache/cassandra/db/CleanupTest.java
@@@ -92,11 -94,11 +92,11 @@@ public class CleanupTes
          // record max timestamps of the sstables pre-cleanup
          List<Long> expectedMaxTimestamps = getMaxTimestampList(cfs);
  
 -        rows = Util.getRangeSlice(cfs);
 -        assertEquals(LOOPS, rows.size());
 +        iter = Util.getRangeSlice(cfs);
 +        assertEquals(LOOPS, Iterators.size(iter));
  
          // with one token in the ring, owned by the local node, cleanup should be a no-op
-         CompactionManager.instance.performCleanup(cfs);
+         CompactionManager.instance.performCleanup(cfs, 2);
  
          // ensure max timestamp of the sstables are retained post-cleanup
          assert expectedMaxTimestamps.equals(getMaxTimestampList(cfs));
@@@ -137,16 -143,18 +137,16 @@@
          tmd.updateNormalToken(new BytesToken(tk1), InetAddress.getByName("127.0.0.1"));
          tmd.updateNormalToken(new BytesToken(tk2), InetAddress.getByName("127.0.0.2"));
  
-         CompactionManager.instance.performCleanup(cfs);
+         CompactionManager.instance.performCleanup(cfs, 2);
  
          // row data should be gone
 -        rows = Util.getRangeSlice(cfs);
 -        assertEquals(0, rows.size());
 +        assertEquals(0, Util.getAll(Util.cmd(cfs).build()).size());
  
          // not only should it be gone but there should be no data on disk, not even tombstones
 -        assert cfs.getSSTables().isEmpty();
 +        assert cfs.getLiveSSTables().isEmpty();
  
          // 2ary indexes should result in no results, too (although tombstones won't be gone
until compacted)
 -        rows = cfs.search(range, clause, filter, Integer.MAX_VALUE);
 -        assertEquals(0, rows.size());
 +        assertEquals(0, Util.getAll(Util.cmd(cfs).filterOn("birthdate", Operator.EQ, VALUE).build()).size());
      }
  
      @Test
@@@ -168,9 -180,10 +168,9 @@@
          tk2[0] = 1;
          tmd.updateNormalToken(new BytesToken(tk1), InetAddress.getByName("127.0.0.1"));
          tmd.updateNormalToken(new BytesToken(tk2), InetAddress.getByName("127.0.0.2"));
-         CompactionManager.instance.performCleanup(cfs);
+         CompactionManager.instance.performCleanup(cfs, 2);
  
 -        rows = Util.getRangeSlice(cfs);
 -        assertEquals(0, rows.size());
 +        assertEquals(0, Util.getAll(Util.cmd(cfs).build()).size());
      }
  
      @Test

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c91977d/test/unit/org/apache/cassandra/db/ScrubTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ScrubTest.java
index 6dbbb1b,4cca7ff..936ccd8
--- a/test/unit/org/apache/cassandra/db/ScrubTest.java
+++ b/test/unit/org/apache/cassandra/db/ScrubTest.java
@@@ -110,14 -127,18 +110,14 @@@ public class ScrubTes
          ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
          cfs.clearUnsafe();
  
 -        List<Row> rows;
 -
          // insert data and verify we get it back w/ range query
          fillCF(cfs, 1);
 -        rows = cfs.getRangeSlice(Util.range("", ""), null, new IdentityQueryFilter(), 1000);
 -        assertEquals(1, rows.size());
 +        assertOrderedAll(cfs, 1);
  
-         CompactionManager.instance.performScrub(cfs, false, true);
+         CompactionManager.instance.performScrub(cfs, false, true, 2);
  
          // check data is still there
 -        rows = cfs.getRangeSlice(Util.range("", ""), null, new IdentityQueryFilter(), 1000);
 -        assertEquals(1, rows.size());
 +        assertOrderedAll(cfs, 1);
      }
  
      @Test
@@@ -235,17 -260,21 +235,17 @@@
          ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
          cfs.clearUnsafe();
  
 -        List<Row> rows;
 -
          // insert data and verify we get it back w/ range query
          fillCF(cfs, 4);
 -        rows = cfs.getRangeSlice(Util.range("", ""), null, new IdentityQueryFilter(), 1000);
 -        assertEquals(4, rows.size());
 +        assertOrderedAll(cfs, 4);
  
 -        SSTableReader sstable = cfs.getSSTables().iterator().next();
 +        SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
          overrideWithGarbage(sstable, 0, 2);
  
-         CompactionManager.instance.performScrub(cfs, false, true);
+         CompactionManager.instance.performScrub(cfs, false, true, 2);
  
          // check data is still there
 -        rows = cfs.getRangeSlice(Util.range("", ""), null, new IdentityQueryFilter(), 1000);
 -        assertEquals(4, rows.size());
 +        assertOrderedAll(cfs, 4);
      }
  
      @Test
@@@ -271,14 -318,18 +271,14 @@@
          ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
          cfs.clearUnsafe();
  
 -        List<Row> rows;
 -
          // insert data and verify we get it back w/ range query
          fillCF(cfs, 10);
 -        rows = cfs.getRangeSlice(Util.range("", ""), null, new IdentityQueryFilter(), 1000);
 -        assertEquals(10, rows.size());
 +        assertOrderedAll(cfs, 10);
  
-         CompactionManager.instance.performScrub(cfs, false, true);
+         CompactionManager.instance.performScrub(cfs, false, true, 2);
  
          // check data is still there
 -        rows = cfs.getRangeSlice(Util.range("", ""), null, new IdentityQueryFilter(), 1000);
 -        assertEquals(10, rows.size());
 +        assertOrderedAll(cfs, 10);
      }
  
      @Test
@@@ -289,17 -340,21 +289,17 @@@
          ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
          cfs.clearUnsafe();
  
 -        List<Row> rows;
 -
          // insert data and verify we get it back w/ range query
          fillCF(cfs, 10);
 -        rows = cfs.getRangeSlice(Util.range("", ""), null, new IdentityQueryFilter(), 1000);
 -        assertEquals(10, rows.size());
 +        assertOrderedAll(cfs, 10);
  
 -        for (SSTableReader sstable : cfs.getSSTables())
 +        for (SSTableReader sstable : cfs.getLiveSSTables())
              new File(sstable.descriptor.filenameFor(Component.PRIMARY_INDEX)).delete();
  
-         CompactionManager.instance.performScrub(cfs, false, true);
+         CompactionManager.instance.performScrub(cfs, false, true, 2);
  
          // check data is still there
 -        rows = cfs.getRangeSlice(Util.range("", ""), null, new IdentityQueryFilter(), 1000);
 -        assertEquals(10, rows.size());
 +        assertOrderedAll(cfs, 10);
      }
  
      @Test
@@@ -504,11 -599,13 +504,11 @@@
  
          QueryProcessor.process("CREATE TABLE \"Keyspace1\".test_scrub_validation (a text
primary key, b int)", ConsistencyLevel.ONE);
          ColumnFamilyStore cfs2 = keyspace.getColumnFamilyStore("test_scrub_validation");
 -        Mutation mutation = new Mutation("Keyspace1", UTF8Type.instance.decompose("key"));
 -        CellNameType ct = cfs2.getComparator();
 -        mutation.add("test_scrub_validation", ct.makeCellName("b"), LongType.instance.decompose(1L),
System.currentTimeMillis());
 -        mutation.apply();
 +
 +        new Mutation(UpdateBuilder.create(cfs2.metadata, "key").newRow().add("b", LongType.instance.decompose(1L)).build()).apply();
          cfs2.forceBlockingFlush();
  
-         CompactionManager.instance.performScrub(cfs2, false, false);
+         CompactionManager.instance.performScrub(cfs2, false, false, 2);
      }
  
      /**
@@@ -614,9 -763,9 +614,9 @@@
                  boolean failure = !scrubs[i];
                  if (failure)
                  { //make sure the next scrub fails
 -                    overrideWithGarbage(indexCfs.getSSTables().iterator().next(), ByteBufferUtil.bytes(1L),
ByteBufferUtil.bytes(2L));
 +                    overrideWithGarbage(indexCfs.getLiveSSTables().iterator().next(), ByteBufferUtil.bytes(1L),
ByteBufferUtil.bytes(2L));
                  }
-                 CompactionManager.AllSSTableOpStatus result = indexCfs.scrub(false, false,
true, true);
+                 CompactionManager.AllSSTableOpStatus result = indexCfs.scrub(false, false,
true, true, 0);
                  assertEquals(failure ?
                               CompactionManager.AllSSTableOpStatus.ABORTED :
                               CompactionManager.AllSSTableOpStatus.SUCCESSFUL,


Mime
View raw message