scrub: support scrubMode and deprecate skipCorrupted

Support new scrubMode option and deprecate skipCorrupted
that's equivalent to scrubMode="SKIP".

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes #175
This commit is contained in:
Benny Halevy 2021-08-15 19:24:51 +03:00 committed by Nadav Har'El
parent 5311e9bae3
commit 70b19e6270
2 changed files with 22 additions and 0 deletions

View File

@ -1796,6 +1796,19 @@ public class StorageService extends MetricsMBean implements StorageServiceMBean,
return client.getIntValue("/storage_service/keyspace_scrub/" + keyspaceName, queryParams); 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<String, String> queryParams = new MultivaluedHashMap<String, String>();
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 @Override
public long getUptime() { public long getUptime() {
log("getUptime()"); log("getUptime()");

View File

@ -351,6 +351,10 @@ public interface StorageServiceMBean extends NotificationEmitter {
* scrubbed. * scrubbed.
* *
* Scrubbed CFs will be snapshotted first, if disableSnapshot is false * 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 @Deprecated
public int scrub(boolean disableSnapshot, boolean skipCorrupted, String keyspaceName, String... tableNames) 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, public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData, int jobs, String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, InterruptedException; String... columnFamilies) throws IOException, ExecutionException, InterruptedException;
@Deprecated
public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData, boolean reinsertOverflowedTTL, public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData, boolean reinsertOverflowedTTL,
int jobs, String keyspaceName, String... columnFamilies) int jobs, String keyspaceName, String... columnFamilies)
throws IOException, ExecutionException, InterruptedException; 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, * Verify (checksums of) the given keyspace. If tableNames array is empty,
* all CFs are verified. * all CFs are verified.