storage_service: support keyspace_validate

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy 2021-07-27 17:14:42 +03:00
parent 5311e9bae3
commit 42d7dc394e
2 changed files with 32 additions and 0 deletions

View File

@ -675,6 +675,18 @@ public class StorageService extends MetricsMBean implements StorageServiceMBean,
return client.postInt("/storage_service/keyspace_cleanup/" + keyspaceName, queryParams);
}
/**
* Run validation compaction of tables in a single keyspace.
*/
@Override
public int validate(String keyspaceName, String... tables)
throws IOException, ExecutionException, InterruptedException {
log(" validate(String keyspaceName, String... tables) throws IOException, ExecutionException, InterruptedException");
MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>();
APIClient.set_query_param(queryParams, "cf", APIClient.join(tables));
return client.postInt("/storage_service/keyspace_validate/" + keyspaceName, queryParams);
}
/**
* Scrub (deserialize + reserialize at the latest version, skipping bad rows
* if any) the given keyspace. If columnFamilies array is empty, all CFs are
@ -1711,6 +1723,13 @@ public class StorageService extends MetricsMBean implements StorageServiceMBean,
return forceKeyspaceCleanup(keyspaceName, tables);
}
@Override
public int validate(int jobs, String keyspaceName, String... tables)
throws IOException, ExecutionException, InterruptedException {
// "jobs" not (yet) relevant for scylla. (though possibly useful...)
return validate(keyspaceName, tables);
}
@Override
public int scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData, int jobs, String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, InterruptedException {

View File

@ -345,6 +345,19 @@ public interface StorageServiceMBean extends NotificationEmitter {
public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... tables)
throws IOException, ExecutionException, InterruptedException;
/**
* Run validation compaction of tables in a single keyspace.
* If tables array is empty, all tables are validated.
*
* This is essentially a read-only version of scrub.
*/
@Deprecated
public int validate(String keyspaceName, String... tables)
throws IOException, ExecutionException, InterruptedException;
public int validate(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. If columnFamilies array is empty, all CFs are