diff --git a/src/main/java/org/apache/cassandra/service/StorageService.java b/src/main/java/org/apache/cassandra/service/StorageService.java index 51ecc49..a60210b 100644 --- a/src/main/java/org/apache/cassandra/service/StorageService.java +++ b/src/main/java/org/apache/cassandra/service/StorageService.java @@ -1796,6 +1796,19 @@ public class StorageService extends MetricsMBean implements StorageServiceMBean, return client.getIntValue("/storage_service/keyspace_scrub/" + keyspaceName, queryParams); } + @Override + public int scrub(boolean disableSnapshot, String scrubMode, boolean checkData, boolean reinsertOverflowedTTL, + int jobs, String keyspaceName, String... columnFamilies) + throws IOException, ExecutionException, InterruptedException { + MultivaluedMap queryParams = new MultivaluedHashMap(); + APIClient.set_bool_query_param(queryParams, "disable_snapshot", disableSnapshot); + if (scrubMode != "") { + APIClient.set_query_param(queryParams, "scrub_mode", scrubMode); + } + APIClient.set_query_param(queryParams, "cf", APIClient.join(columnFamilies)); + return client.getIntValue("/storage_service/keyspace_scrub/" + keyspaceName, queryParams); + } + @Override public long getUptime() { log("getUptime()"); diff --git a/src/main/java/org/apache/cassandra/service/StorageServiceMBean.java b/src/main/java/org/apache/cassandra/service/StorageServiceMBean.java index a3dce1c..5a0a202 100644 --- a/src/main/java/org/apache/cassandra/service/StorageServiceMBean.java +++ b/src/main/java/org/apache/cassandra/service/StorageServiceMBean.java @@ -351,6 +351,10 @@ public interface StorageServiceMBean extends NotificationEmitter { * scrubbed. * * Scrubbed CFs will be snapshotted first, if disableSnapshot is false + * + * scrubMode controls what scrub does when encountering corruption. + * It replaces skipCorrupted where skipCorrupted is equivalent to scrubMode="SKIP". + * Can be one of: "ABORT", "SKIP", "SEGREGATE", or "VALIDATE". */ @Deprecated public int scrub(boolean disableSnapshot, boolean skipCorrupted, String keyspaceName, String... tableNames) @@ -364,10 +368,15 @@ public interface StorageServiceMBean extends NotificationEmitter { public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData, int jobs, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException; + @Deprecated public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData, boolean reinsertOverflowedTTL, int jobs, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException; + public int scrub(boolean disableSnapshot, String scrubMode, boolean checkData, boolean reinsertOverflowedTTL, + int jobs, String keyspaceName, String... columnFamilies) + throws IOException, ExecutionException, InterruptedException; + /** * Verify (checksums of) the given keyspace. If tableNames array is empty, * all CFs are verified.