scylla-jmx: fix the forceRepairAsync() used by "nodetool repair"

"nodetool repair" ends up calling one of the dozen forceAsyncRepair()
functions. This function ignored its option rather than passing it on,
so this patch fixes that.

Note that there are still many more forceAsyncRepair() overloads which
similarly ignore their options, and it is possible that certain invocation
of "nodetool repair" will need them, so we will need to fix all of them
in the future.

After this patch, "nodetool repair" no longer works because now Scylla
needs to be fixed to understand the "parallelism" and "incremental" options
passed to it.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This commit is contained in:
Nadav Har'El 2015-12-28 15:55:25 +02:00 committed by Pekka Enberg
parent f8b4dfed38
commit 69c6913668

View File

@ -47,6 +47,8 @@ import org.apache.cassandra.streaming.StreamManager;
import com.scylladb.jmx.api.APIClient;
import com.scylladb.jmx.utils.FileUtils;
import com.google.common.base.Joiner;
/**
* This abstraction contains the token/identifier of this node on the identifier
* space. This token gets gossiped around. This class will also maintain
@ -1288,9 +1290,21 @@ public class StorageService extends NotificationBroadcasterSupport
Collection<String> dataCenters, Collection<String> hosts,
boolean primaryRange, boolean fullRepair,
String... columnFamilies) {
// TODO Auto-generated method stub
log(" forceRepairAsync()");
log(" forceRepairAsync(keyspace, parallelismDegree, dataCenters, hosts, primaryRange, fullRepair, columnFamilies)");
Map<String, String> options = new HashMap<String, String>();
Joiner commas = Joiner.on(",");
options.put("parallelism", Integer.toString(parallelismDegree));
if (dataCenters != null) {
options.put("dataCenters", commas.join(dataCenters));
}
if (hosts != null) {
options.put("hosts", commas.join(hosts));
}
options.put("primaryRange", Boolean.toString(primaryRange));
options.put("incremental", Boolean.toString(!fullRepair));
if (columnFamilies != null && columnFamilies.length > 0) {
options.put("columnFamilies", commas.join(columnFamilies));
}
return repairAsync(keyspace, options);
}
@ -1300,7 +1314,7 @@ public class StorageService extends NotificationBroadcasterSupport
Collection<String> dataCenters, Collection<String> hosts,
boolean fullRepair, String... columnFamilies) {
// TODO Auto-generated method stub
log(" forceRepairRangeAsync()");
log(" forceRepairRangeAsync(beginToken, endToken, keyspaceName, parallelismDegree, dataCenters, hosts, fullRepair, columnFamilies)");
return c.getIntValue("");
}