Merge "Moving the MBean definition to version 2.1" from Amnon

"The series changes the MBean definition to 2.1. The MBean interface where
 copied from origin. To the current implementation methods where added as needed
 so all interface methods will have an implementation. All added methods are
 stubed with a trace line."
This commit is contained in:
Pekka Enberg 2015-07-30 12:13:11 +03:00
commit db71bf6f89
10 changed files with 363 additions and 101 deletions

View File

@ -30,6 +30,8 @@ import java.util.concurrent.*;
import javax.json.JsonArray; import javax.json.JsonArray;
import javax.json.JsonObject; import javax.json.JsonObject;
import javax.management.*; import javax.management.*;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.OpenDataException;
import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.MultivaluedMap;
import org.apache.cassandra.metrics.ColumnFamilyMetrics; import org.apache.cassandra.metrics.ColumnFamilyMetrics;
@ -341,8 +343,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean {
/** /**
* force a major compaction of this column family * force a major compaction of this column family
*/ */
public void forceMajorCompaction() throws ExecutionException, public void forceMajorCompaction()
InterruptedException { throws ExecutionException, InterruptedException {
log(" forceMajorCompaction() throws ExecutionException, InterruptedException"); log(" forceMajorCompaction() throws ExecutionException, InterruptedException");
c.post("column_family/major_compaction/" + getCFName()); c.post("column_family/major_compaction/" + getCFName());
} }
@ -515,8 +517,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean {
*/ */
public String getCompactionStrategyClass() { public String getCompactionStrategyClass() {
log(" getCompactionStrategyClass()"); log(" getCompactionStrategyClass()");
return c.getStringValue("column_family/compaction_strategy/" return c.getStringValue(
+ getCFName()); "column_family/compaction_strategy/" + getCFName());
} }
/** /**
@ -524,8 +526,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean {
*/ */
public Map<String, String> getCompressionParameters() { public Map<String, String> getCompressionParameters() {
log(" getCompressionParameters()"); log(" getCompressionParameters()");
return c.getMapStrValue("column_family/compression_parameters/" return c.getMapStrValue(
+ getCFName()); "column_family/compression_parameters/" + getCFName());
} }
/** /**
@ -623,8 +625,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean {
log(" getSSTablesForKey(String key)"); log(" getSSTablesForKey(String key)");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("key", key); queryParams.add("key", key);
return c.getListStrValue( return c.getListStrValue("column_family/sstables/by_key/" + getCFName(),
"column_family/sstables/by_key/" + getCFName(), queryParams); queryParams);
} }
/** /**
@ -652,8 +654,8 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean {
*/ */
public int[] getSSTableCountPerLevel() { public int[] getSSTableCountPerLevel() {
log(" getSSTableCountPerLevel()"); log(" getSSTableCountPerLevel()");
return c.getIntArrValue("column_family/sstables/per_level/" return c.getIntArrValue(
+ getCFName()); "column_family/sstables/per_level/" + getCFName());
} }
/** /**
@ -680,4 +682,54 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean {
return keyspace; return keyspace;
} }
@Override
public long getRangeCount() {
// TODO Auto-generated method stub
log("getRangeCount()");
return c.getLongValue("");
}
@Override
public long getTotalRangeLatencyMicros() {
// TODO Auto-generated method stub
log("getTotalRangeLatencyMicros()");
return c.getLongValue("");
}
@Override
public long[] getLifetimeRangeLatencyHistogramMicros() {
// TODO Auto-generated method stub
log("getLifetimeRangeLatencyHistogramMicros()");
return c.getLongArrValue("");
}
@Override
public long[] getRecentRangeLatencyHistogramMicros() {
// TODO Auto-generated method stub
log("getRecentRangeLatencyHistogramMicros()");
return c.getLongArrValue("");
}
@Override
public double getRecentRangeLatencyMicros() {
// TODO Auto-generated method stub
log("getRecentRangeLatencyMicros()");
return c.getDoubleValue("");
}
@Override
public void beginLocalSampling(String sampler, int capacity) {
// TODO Auto-generated method stub
log("beginLocalSampling()");
}
@Override
public CompositeData finishLocalSampling(String sampler, int count)
throws OpenDataException {
// TODO Auto-generated method stub
log("finishLocalSampling()");
return null;
}
} }

View File

@ -21,6 +21,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.OpenDataException;
/** /**
* The MBean interface for ColumnFamilyStore * The MBean interface for ColumnFamilyStore
*/ */
@ -145,6 +148,41 @@ public interface ColumnFamilyStoreMBean
@Deprecated @Deprecated
public double getRecentWriteLatencyMicros(); public double getRecentWriteLatencyMicros();
/**
* @see org.apache.cassandra.metrics.ColumnFamilyMetrics#rangeLatency
* @return the number of range slice operations on this column family
*/
@Deprecated
public long getRangeCount();
/**
* @see org.apache.cassandra.metrics.ColumnFamilyMetrics#rangeLatency
* @return total range slice latency (divide by getRangeCount() for average)
*/
@Deprecated
public long getTotalRangeLatencyMicros();
/**
* @see org.apache.cassandra.metrics.ColumnFamilyMetrics#rangeLatency
* @return an array representing the latency histogram
*/
@Deprecated
public long[] getLifetimeRangeLatencyHistogramMicros();
/**
* @see org.apache.cassandra.metrics.ColumnFamilyMetrics#rangeLatency
* @return an array representing the latency histogram
*/
@Deprecated
public long[] getRecentRangeLatencyHistogramMicros();
/**
* @see org.apache.cassandra.metrics.ColumnFamilyMetrics#rangeLatency
* @return average latency per range slice operation since the last call
*/
@Deprecated
public double getRecentRangeLatencyMicros();
/** /**
* @see org.apache.cassandra.metrics.ColumnFamilyMetrics#pendingFlushes * @see org.apache.cassandra.metrics.ColumnFamilyMetrics#pendingFlushes
* @return the estimated number of tasks pending for this column family * @return the estimated number of tasks pending for this column family
@ -367,4 +405,15 @@ public interface ColumnFamilyStoreMBean
* @return the size of SSTables in "snapshots" subdirectory which aren't live anymore * @return the size of SSTables in "snapshots" subdirectory which aren't live anymore
*/ */
public long trueSnapshotsSize(); public long trueSnapshotsSize();
/**
* begin sampling for a specific sampler with a given capacity. The cardinality may
* be larger than the capacity, but depending on the use case it may affect its accuracy
*/
public void beginLocalSampling(String sampler, int capacity);
/**
* @return top <i>count</i> items for the sampler since beginLocalSampling was called
*/
public CompositeData finishLocalSampling(String sampler, int count) throws OpenDataException;
} }

View File

@ -58,8 +58,8 @@ public class CommitLog implements CommitLogMBean {
private CommitLog() { private CommitLog() {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try { try {
mbs.registerMBean(this, new ObjectName( mbs.registerMBean(this,
"org.apache.cassandra.db:type=Commitlog")); new ObjectName("org.apache.cassandra.db:type=Commitlog"));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -135,4 +135,39 @@ public class CommitLog implements CommitLogMBean {
return new ArrayList<String>(set); return new ArrayList<String>(set);
} }
@Override
public String getArchiveCommand() {
// TODO Auto-generated method stub
log(" getArchiveCommand()");
return c.getStringValue("");
}
@Override
public String getRestoreCommand() {
// TODO Auto-generated method stub
log(" getRestoreCommand()");
return c.getStringValue("");
}
@Override
public String getRestoreDirectories() {
// TODO Auto-generated method stub
log(" getRestoreDirectories()");
return c.getStringValue("");
}
@Override
public long getRestorePointInTime() {
// TODO Auto-generated method stub
log(" getRestorePointInTime()");
return c.getLongValue("");
}
@Override
public String getRestorePrecision() {
// TODO Auto-generated method stub
log(" getRestorePrecision()");
return c.getStringValue("");
}
} }

View File

@ -45,6 +45,37 @@ public interface CommitLogMBean {
@Deprecated @Deprecated
public long getTotalCommitlogSize(); public long getTotalCommitlogSize();
/**
* Command to execute to archive a commitlog segment. Blank to disabled.
*/
public String getArchiveCommand();
/**
* Command to execute to make an archived commitlog live again
*/
public String getRestoreCommand();
/**
* Directory to scan the recovery files in
*/
public String getRestoreDirectories();
/**
* Restore mutations created up to and including this timestamp in GMT
* Format: yyyy:MM:dd HH:mm:ss (2012:04:31 20:43:12)
*
* Recovery will continue through the segment when the first client-supplied
* timestamp greater than this time is encountered, but only mutations less
* than or equal to this timestamp will be applied.
*/
public long getRestorePointInTime();
/**
* get precision of the timestamp used in the restore (MILLISECONDS,
* MICROSECONDS, ...) to determine if passed the restore point in time.
*/
public String getRestorePrecision();
/** /**
* Recover a single file. * Recover a single file.
*/ */

View File

@ -66,9 +66,7 @@ public interface CompactionManagerMBean {
* keyspace/columnfamily. * keyspace/columnfamily.
* *
* @param dataFiles * @param dataFiles
* a comma separated list of sstable file to compact. must * a comma separated list of sstable filename to compact
* contain keyspace and columnfamily name in path(for 2.1+) or
* file name itself.
*/ */
public void forceUserDefinedCompaction(String dataFiles); public void forceUserDefinedCompaction(String dataFiles);

View File

@ -27,6 +27,4 @@ public interface GossiperMBean
public void unsafeAssassinateEndpoint(String address) throws UnknownHostException; public void unsafeAssassinateEndpoint(String address) throws UnknownHostException;
public void assassinateEndpoint(String address) throws UnknownHostException;
} }

View File

@ -54,16 +54,16 @@ public class StorageProxy implements StorageProxyMBean {
public static final String UNREACHABLE = "UNREACHABLE"; public static final String UNREACHABLE = "UNREACHABLE";
private static final ClientRequestMetrics readMetrics = new ClientRequestMetrics("storage_proxy/metrics/read/", private static final ClientRequestMetrics readMetrics = new ClientRequestMetrics(
"Read"); "storage_proxy/metrics/read/", "Read");
private static final ClientRequestMetrics rangeMetrics = new ClientRequestMetrics("storage_proxy/metrics/range/", private static final ClientRequestMetrics rangeMetrics = new ClientRequestMetrics(
"RangeSlice"); "storage_proxy/metrics/range/", "RangeSlice");
private static final ClientRequestMetrics writeMetrics = new ClientRequestMetrics("storage_proxy/metrics/write/", private static final ClientRequestMetrics writeMetrics = new ClientRequestMetrics(
"Write"); "storage_proxy/metrics/write/", "Write");
private static final CASClientRequestMetrics casWriteMetrics = new CASClientRequestMetrics("storage_proxy/metrics/cas_write/", private static final CASClientRequestMetrics casWriteMetrics = new CASClientRequestMetrics(
"CASWrite"); "storage_proxy/metrics/cas_write/", "CASWrite");
private static final CASClientRequestMetrics casReadMetrics = new CASClientRequestMetrics("storage_proxy/metrics/cas_read/", private static final CASClientRequestMetrics casReadMetrics = new CASClientRequestMetrics(
"CASRead"); "storage_proxy/metrics/cas_read/", "CASRead");
private static final double CONCURRENT_SUBREQUESTS_MARGIN = 0.10; private static final double CONCURRENT_SUBREQUESTS_MARGIN = 0.10;
@ -197,15 +197,15 @@ public class StorageProxy implements StorageProxyMBean {
public Set<String> getHintedHandoffEnabledByDC() { public Set<String> getHintedHandoffEnabledByDC() {
log(" getHintedHandoffEnabledByDC()"); log(" getHintedHandoffEnabledByDC()");
return c.getSetStringValue("storage_proxy/hinted_handoff_enabled_by_dc"); return c.getSetStringValue(
"storage_proxy/hinted_handoff_enabled_by_dc");
} }
public void setHintedHandoffEnabled(boolean b) { public void setHintedHandoffEnabled(boolean b) {
log(" setHintedHandoffEnabled(boolean b)"); log(" setHintedHandoffEnabled(boolean b)");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("enable", Boolean.toString(b)); queryParams.add("enable", Boolean.toString(b));
c.post("storage_proxy/hinted_handoff_enabled", c.post("storage_proxy/hinted_handoff_enabled", queryParams);
queryParams);
} }
public void setHintedHandoffEnabledByDCList(String dcs) { public void setHintedHandoffEnabledByDCList(String dcs) {
@ -289,8 +289,7 @@ public class StorageProxy implements StorageProxyMBean {
log(" setCounterWriteRpcTimeout(Long timeoutInMillis)"); log(" setCounterWriteRpcTimeout(Long timeoutInMillis)");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("timeout", Long.toString(timeoutInMillis)); queryParams.add("timeout", Long.toString(timeoutInMillis));
c.post("storage_proxy/counter_write_rpc_timeout", c.post("storage_proxy/counter_write_rpc_timeout", queryParams);
queryParams);
} }
public Long getCasContentionTimeout() { public Long getCasContentionTimeout() {
@ -302,8 +301,7 @@ public class StorageProxy implements StorageProxyMBean {
log(" setCasContentionTimeout(Long timeoutInMillis)"); log(" setCasContentionTimeout(Long timeoutInMillis)");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("timeout", Long.toString(timeoutInMillis)); queryParams.add("timeout", Long.toString(timeoutInMillis));
c.post("storage_proxy/cas_contention_timeout", c.post("storage_proxy/cas_contention_timeout", queryParams);
queryParams);
} }
public Long getRangeRpcTimeout() { public Long getRangeRpcTimeout() {
@ -356,4 +354,19 @@ public class StorageProxy implements StorageProxyMBean {
return c.getMapStringListStrValue("storage_proxy/schema_versions"); return c.getMapStringListStrValue("storage_proxy/schema_versions");
} }
@Override
public void setNativeTransportMaxConcurrentConnections(
Long nativeTransportMaxConcurrentConnections) {
// TODO Auto-generated method stub
log(" setNativeTransportMaxConcurrentConnections()");
}
@Override
public Long getNativeTransportMaxConcurrentConnections() {
// TODO Auto-generated method stub
log(" getNativeTransportMaxConcurrentConnections()");
return c.getLongValue("");
}
} }

View File

@ -130,6 +130,11 @@ public interface StorageProxyMBean {
public void setTruncateRpcTimeout(Long timeoutInMillis); public void setTruncateRpcTimeout(Long timeoutInMillis);
public void setNativeTransportMaxConcurrentConnections(
Long nativeTransportMaxConcurrentConnections);
public Long getNativeTransportMaxConcurrentConnections();
public void reloadTriggerClasses(); public void reloadTriggerClasses();
public long getReadRepairAttempted(); public long getReadRepairAttempted();

View File

@ -45,15 +45,15 @@ import com.sun.jersey.core.util.MultivaluedMapImpl;
* space. This token gets gossiped around. This class will also maintain * space. This token gets gossiped around. This class will also maintain
* histograms of the load information of other nodes in the cluster. * histograms of the load information of other nodes in the cluster.
*/ */
public class StorageService extends NotificationBroadcasterSupport implements public class StorageService extends NotificationBroadcasterSupport
StorageServiceMBean { implements StorageServiceMBean {
private static final java.util.logging.Logger logger = java.util.logging.Logger private static final java.util.logging.Logger logger = java.util.logging.Logger
.getLogger(StorageService.class.getName()); .getLogger(StorageService.class.getName());
private APIClient c = new APIClient(); private APIClient c = new APIClient();
private StorageMetrics metrics = new StorageMetrics(); private StorageMetrics metrics = new StorageMetrics();
public static final StorageService instance = new StorageService(); public static final StorageService instance = new StorageService();
public static StorageService getInstance() { public static StorageService getInstance() {
@ -211,7 +211,8 @@ public class StorageService extends NotificationBroadcasterSupport implements
* *
* @return mapping of ranges to end points * @return mapping of ranges to end points
*/ */
public Map<List<String>, List<String>> getRangeToEndpointMap(String keyspace) { public Map<List<String>, List<String>> getRangeToEndpointMap(
String keyspace) {
log(" getRangeToEndpointMap(String keyspace)"); log(" getRangeToEndpointMap(String keyspace)");
return c.getMapListStrValue("/storage_service/range/" + keyspace); return c.getMapListStrValue("/storage_service/range/" + keyspace);
} }
@ -257,8 +258,8 @@ public class StorageService extends NotificationBroadcasterSupport implements
public Map<List<String>, List<String>> getPendingRangeToEndpointMap( public Map<List<String>, List<String>> getPendingRangeToEndpointMap(
String keyspace) { String keyspace) {
log(" getPendingRangeToEndpointMap(String keyspace)"); log(" getPendingRangeToEndpointMap(String keyspace)");
return c.getMapListStrValue("/storage_service/pending_range/" return c.getMapListStrValue(
+ keyspace); "/storage_service/pending_range/" + keyspace);
} }
/** /**
@ -328,14 +329,15 @@ public class StorageService extends NotificationBroadcasterSupport implements
* - key for which we need to find the endpoint return value - * - key for which we need to find the endpoint return value -
* the endpoint responsible for this key * the endpoint responsible for this key
*/ */
public List<InetAddress> getNaturalEndpoints(String keyspaceName, public List<InetAddress> getNaturalEndpoints(String keyspaceName, String cf,
String cf, String key) { String key) {
log(" getNaturalEndpoints(String keyspaceName, String cf, String key)"); log(" getNaturalEndpoints(String keyspaceName, String cf, String key)");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("cf", cf); queryParams.add("cf", cf);
queryParams.add("key", key); queryParams.add("key", key);
return c.getListInetAddressValue("/storage_service/natural_endpoints/" return c.getListInetAddressValue(
+ keyspaceName, queryParams); "/storage_service/natural_endpoints/" + keyspaceName,
queryParams);
} }
public List<InetAddress> getNaturalEndpoints(String keyspaceName, public List<InetAddress> getNaturalEndpoints(String keyspaceName,
@ -430,7 +432,7 @@ public class StorageService extends NotificationBroadcasterSupport implements
*/ */
public void forceKeyspaceCompaction(String keyspaceName, public void forceKeyspaceCompaction(String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException { InterruptedException {
log(" forceKeyspaceCompaction(String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException"); log(" forceKeyspaceCompaction(String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
APIClient.set_query_param(queryParams, "cf", APIClient.set_query_param(queryParams, "cf",
@ -444,13 +446,14 @@ public class StorageService extends NotificationBroadcasterSupport implements
*/ */
public int forceKeyspaceCleanup(String keyspaceName, public int forceKeyspaceCleanup(String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException { InterruptedException {
log(" forceKeyspaceCleanup(String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException"); log(" forceKeyspaceCleanup(String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
APIClient.set_query_param(queryParams, "cf", APIClient.set_query_param(queryParams, "cf",
APIClient.join(columnFamilies)); APIClient.join(columnFamilies));
return c.getIntValue("/storage_service/keyspace_compaction/" return c.getIntValue(
+ keyspaceName, queryParams); "/storage_service/keyspace_compaction/" + keyspaceName,
queryParams);
} }
/** /**
@ -462,7 +465,7 @@ public class StorageService extends NotificationBroadcasterSupport implements
*/ */
public int scrub(boolean disableSnapshot, boolean skipCorrupted, public int scrub(boolean disableSnapshot, boolean skipCorrupted,
String keyspaceName, String... columnFamilies) throws IOException, String keyspaceName, String... columnFamilies) throws IOException,
ExecutionException, InterruptedException { ExecutionException, InterruptedException {
log(" scrub(boolean disableSnapshot, boolean skipCorrupted, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException"); log(" scrub(boolean disableSnapshot, boolean skipCorrupted, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
APIClient.set_bool_query_param(queryParams, "disable_snapshot", APIClient.set_bool_query_param(queryParams, "disable_snapshot",
@ -480,15 +483,16 @@ public class StorageService extends NotificationBroadcasterSupport implements
*/ */
public int upgradeSSTables(String keyspaceName, public int upgradeSSTables(String keyspaceName,
boolean excludeCurrentVersion, String... columnFamilies) boolean excludeCurrentVersion, String... columnFamilies)
throws IOException, ExecutionException, InterruptedException { throws IOException, ExecutionException,
InterruptedException {
log(" upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, String... columnFamilies) throws IOException, ExecutionException, InterruptedException"); log(" upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion, String... columnFamilies) throws IOException, ExecutionException, InterruptedException");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
APIClient.set_bool_query_param(queryParams, "exclude_current_version", APIClient.set_bool_query_param(queryParams, "exclude_current_version",
excludeCurrentVersion); excludeCurrentVersion);
APIClient.set_query_param(queryParams, "cf", APIClient.set_query_param(queryParams, "cf",
APIClient.join(columnFamilies)); APIClient.join(columnFamilies));
return c.getIntValue("/storage_service/keyspace_upgrade_sstables/" return c.getIntValue(
+ keyspaceName); "/storage_service/keyspace_upgrade_sstables/" + keyspaceName);
} }
/** /**
@ -501,7 +505,7 @@ public class StorageService extends NotificationBroadcasterSupport implements
*/ */
public void forceKeyspaceFlush(String keyspaceName, public void forceKeyspaceFlush(String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException { InterruptedException {
log(" forceKeyspaceFlush(String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException"); log(" forceKeyspaceFlush(String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
APIClient.set_query_param(queryParams, "cf", APIClient.set_query_param(queryParams, "cf",
@ -539,16 +543,16 @@ public class StorageService extends NotificationBroadcasterSupport implements
public int forceRepairAsync(String keyspace, boolean isSequential, public int forceRepairAsync(String keyspace, boolean isSequential,
Collection<String> dataCenters, Collection<String> hosts, Collection<String> dataCenters, Collection<String> hosts,
boolean primaryRange, boolean repairedAt, String... columnFamilies) boolean primaryRange, boolean repairedAt, String... columnFamilies)
throws IOException { throws IOException {
log(" forceRepairAsync(String keyspace, boolean isSequential, Collection<String> dataCenters, Collection<String> hosts, boolean primaryRange, boolean repairedAt, String... columnFamilies) throws IOException"); log(" forceRepairAsync(String keyspace, boolean isSequential, Collection<String> dataCenters, Collection<String> hosts, boolean primaryRange, boolean repairedAt, String... columnFamilies) throws IOException");
return c.getIntValue(""); return c.getIntValue("");
} }
@Deprecated @Deprecated
public int forceRepairAsync(String keyspace, public int forceRepairAsync(String keyspace,
RepairParallelism parallelismDegree, RepairParallelism parallelismDegree, Collection<String> dataCenters,
Collection<String> dataCenters, Collection<String> hosts, Collection<String> hosts, boolean primaryRange, boolean fullRepair,
boolean primaryRange, boolean fullRepair, String... columnFamilies) { String... columnFamilies) {
log(" forceRepairAsync(String keyspace, RepairParallelism parallelismDegree, Collection<String> dataCenters, Collection<String> hosts, boolean primaryRange, boolean fullRepair, String... columnFamilies)"); log(" forceRepairAsync(String keyspace, RepairParallelism parallelismDegree, Collection<String> dataCenters, Collection<String> hosts, boolean primaryRange, boolean fullRepair, String... columnFamilies)");
return c.getIntValue(""); return c.getIntValue("");
} }
@ -699,8 +703,8 @@ public class StorageService extends NotificationBroadcasterSupport implements
* makes node unavailable for writes, flushes memtables and replays * makes node unavailable for writes, flushes memtables and replays
* commitlog. * commitlog.
*/ */
public void drain() throws IOException, InterruptedException, public void drain()
ExecutionException { throws IOException, InterruptedException, ExecutionException {
log(" drain() throws IOException, InterruptedException, ExecutionException"); log(" drain() throws IOException, InterruptedException, ExecutionException");
c.post("/storage_service/drain"); c.post("/storage_service/drain");
} }
@ -946,7 +950,8 @@ public class StorageService extends NotificationBroadcasterSupport implements
*/ */
public String bulkLoadAsync(String directory) { public String bulkLoadAsync(String directory) {
log(" bulkLoadAsync(String directory)"); log(" bulkLoadAsync(String directory)");
return c.getStringValue("/storage_service/bulk_load_async/" + directory); return c.getStringValue(
"/storage_service/bulk_load_async/" + directory);
} }
public void rescheduleFailedDeletions() { public void rescheduleFailedDeletions() {
@ -1104,7 +1109,9 @@ public class StorageService extends NotificationBroadcasterSupport implements
c.post("/storage_service/batch_size_failure_threshold", queryParams); c.post("/storage_service/batch_size_failure_threshold", queryParams);
} }
/** Sets the hinted handoff throttle in kb per second, per delivery thread. */ /**
* Sets the hinted handoff throttle in kb per second, per delivery thread.
*/
public void setHintedHandoffThrottleInKB(int throttleInKB) { public void setHintedHandoffThrottleInKB(int throttleInKB) {
log(" setHintedHandoffThrottleInKB(int throttleInKB)"); log(" setHintedHandoffThrottleInKB(int throttleInKB)");
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
@ -1112,4 +1119,48 @@ public class StorageService extends NotificationBroadcasterSupport implements
c.post("/storage_service/hinted_handoff", queryParams); c.post("/storage_service/hinted_handoff", queryParams);
} }
@Override
public void takeMultipleColumnFamilySnapshot(String tag,
String... columnFamilyList) throws IOException {
// TODO Auto-generated method stub
log(" takeMultipleColumnFamilySnapshot");
}
@Override
public int scrub(boolean disableSnapshot, boolean skipCorrupted,
boolean checkData, String keyspaceName, String... columnFamilies)
throws IOException, ExecutionException,
InterruptedException {
// TODO Auto-generated method stub
log(" scrub()");
return c.getIntValue("");
}
@Override
public int forceRepairAsync(String keyspace, int parallelismDegree,
Collection<String> dataCenters, Collection<String> hosts,
boolean primaryRange, boolean fullRepair,
String... columnFamilies) {
// TODO Auto-generated method stub
log(" forceRepairAsync()");
return c.getIntValue("");
}
@Override
public int forceRepairRangeAsync(String beginToken, String endToken,
String keyspaceName, int parallelismDegree,
Collection<String> dataCenters, Collection<String> hosts,
boolean fullRepair, String... columnFamilies) {
// TODO Auto-generated method stub
log(" forceRepairRangeAsync()");
return c.getIntValue("");
}
@Override
public double getTracingProbability() {
// TODO Auto-generated method stub
log(" getTracingProbability()");
return c.getDoubleValue("");
}
} }

View File

@ -17,8 +17,6 @@
*/ */
package org.apache.cassandra.service; package org.apache.cassandra.service;
import org.apache.cassandra.repair.RepairParallelism;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@ -127,7 +125,8 @@ public interface StorageServiceMBean extends NotificationEmitter {
* *
* @return mapping of ranges to end points * @return mapping of ranges to end points
*/ */
public Map<List<String>, List<String>> getRangeToEndpointMap(String keyspace); public Map<List<String>, List<String>> getRangeToEndpointMap(
String keyspace);
/** /**
* Retrieve a map of range to rpc addresses that describe the ring topology * Retrieve a map of range to rpc addresses that describe the ring topology
@ -207,8 +206,8 @@ public interface StorageServiceMBean extends NotificationEmitter {
* - key for which we need to find the endpoint return value - * - key for which we need to find the endpoint return value -
* the endpoint responsible for this key * the endpoint responsible for this key
*/ */
public List<InetAddress> getNaturalEndpoints(String keyspaceName, public List<InetAddress> getNaturalEndpoints(String keyspaceName, String cf,
String cf, String key); String key);
public List<InetAddress> getNaturalEndpoints(String keyspaceName, public List<InetAddress> getNaturalEndpoints(String keyspaceName,
ByteBuffer key); ByteBuffer key);
@ -239,6 +238,19 @@ public interface StorageServiceMBean extends NotificationEmitter {
public void takeColumnFamilySnapshot(String keyspaceName, public void takeColumnFamilySnapshot(String keyspaceName,
String columnFamilyName, String tag) throws IOException; String columnFamilyName, String tag) throws IOException;
/**
* Takes the snapshot of a multiple column family from different keyspaces.
* A snapshot name must be specified.
*
* @param tag
* the tag given to the snapshot; may not be null or empty
* @param columnFamilyList
* list of columnfamily from different keyspace in the form of
* ks1.cf1 ks2.cf2
*/
public void takeMultipleColumnFamilySnapshot(String tag,
String... columnFamilyList) throws IOException;
/** /**
* Remove the snapshot with the given name from the given keyspaces. If no * Remove the snapshot with the given name from the given keyspaces. If no
* tag is specified we will remove all snapshots. * tag is specified we will remove all snapshots.
@ -265,14 +277,14 @@ public interface StorageServiceMBean extends NotificationEmitter {
*/ */
public void forceKeyspaceCompaction(String keyspaceName, public void forceKeyspaceCompaction(String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException; InterruptedException;
/** /**
* Trigger a cleanup of keys on a single keyspace * Trigger a cleanup of keys on a single keyspace
*/ */
public int forceKeyspaceCleanup(String keyspaceName, public int forceKeyspaceCleanup(String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException; InterruptedException;
/** /**
* Scrub (deserialize + reserialize at the latest version, skipping bad rows * Scrub (deserialize + reserialize at the latest version, skipping bad rows
@ -281,9 +293,15 @@ public interface StorageServiceMBean extends NotificationEmitter {
* *
* Scrubbed CFs will be snapshotted first, if disableSnapshot is false * Scrubbed CFs will be snapshotted first, if disableSnapshot is false
*/ */
@Deprecated
public int scrub(boolean disableSnapshot, boolean skipCorrupted, public int scrub(boolean disableSnapshot, boolean skipCorrupted,
String keyspaceName, String... columnFamilies) throws IOException, String keyspaceName, String... columnFamilies) throws IOException,
ExecutionException, InterruptedException; ExecutionException, InterruptedException;
public int scrub(boolean disableSnapshot, boolean skipCorrupted,
boolean checkData, String keyspaceName, String... columnFamilies)
throws IOException, ExecutionException,
InterruptedException;
/** /**
* Rewrite all sstables to the latest version. Unlike scrub, it doesn't skip * Rewrite all sstables to the latest version. Unlike scrub, it doesn't skip
@ -291,7 +309,8 @@ public interface StorageServiceMBean extends NotificationEmitter {
*/ */
public int upgradeSSTables(String keyspaceName, public int upgradeSSTables(String keyspaceName,
boolean excludeCurrentVersion, String... columnFamilies) boolean excludeCurrentVersion, String... columnFamilies)
throws IOException, ExecutionException, InterruptedException; throws IOException, ExecutionException,
InterruptedException;
/** /**
* Flush all memtables for the given column families, or all columnfamilies * Flush all memtables for the given column families, or all columnfamilies
@ -303,52 +322,69 @@ public interface StorageServiceMBean extends NotificationEmitter {
*/ */
public void forceKeyspaceFlush(String keyspaceName, public void forceKeyspaceFlush(String keyspaceName,
String... columnFamilies) throws IOException, ExecutionException, String... columnFamilies) throws IOException, ExecutionException,
InterruptedException; InterruptedException;
/** /**
* Invoke repair asynchronously. You can track repair progress by * Invoke repair asynchronously. You can track repair progress by
* subscribing JMX notification sent from this StorageServiceMBean. * subscribing JMX notification sent from this StorageServiceMBean.
* Notification format is: type: "repair" userObject: int array of length 2, * Notification format is: type: "repair" userObject: int array of length 2,
* [0]=command number, [1]=ordinal of AntiEntropyService.Status * [0]=command number, [1]=ordinal of ActiveRepairService.Status
* *
* @param keyspace
* Keyspace name to repair. Should not be null.
* @param options
* repair option.
* @return Repair command number, or 0 if nothing to repair * @return Repair command number, or 0 if nothing to repair
*/ */
public int repairAsync(String keyspace, Map<String, String> options);
@Deprecated
public int forceRepairAsync(String keyspace, boolean isSequential, public int forceRepairAsync(String keyspace, boolean isSequential,
Collection<String> dataCenters, Collection<String> hosts, Collection<String> dataCenters, Collection<String> hosts,
boolean primaryRange, boolean repairedAt, String... columnFamilies) boolean primaryRange, boolean repairedAt, String... columnFamilies)
throws IOException; throws IOException;
@Deprecated /**
public int forceRepairAsync(String keyspace, * Invoke repair asynchronously. You can track repair progress by
RepairParallelism parallelismDegree, * subscribing JMX notification sent from this StorageServiceMBean.
* Notification format is: type: "repair" userObject: int array of length 2,
* [0]=command number, [1]=ordinal of ActiveRepairService.Status
*
* @param parallelismDegree
* 0: sequential, 1: parallel, 2: DC parallel
* @return Repair command number, or 0 if nothing to repair
*/
public int forceRepairAsync(String keyspace, int parallelismDegree,
Collection<String> dataCenters, Collection<String> hosts, Collection<String> dataCenters, Collection<String> hosts,
boolean primaryRange, boolean fullRepair, String... columnFamilies); boolean primaryRange, boolean fullRepair, String... columnFamilies);
@Deprecated /**
* Same as forceRepairAsync, but handles a specified range
*/
public int forceRepairRangeAsync(String beginToken, String endToken, public int forceRepairRangeAsync(String beginToken, String endToken,
String keyspaceName, boolean isSequential, String keyspaceName, boolean isSequential,
Collection<String> dataCenters, Collection<String> hosts, Collection<String> dataCenters, Collection<String> hosts,
boolean repairedAt, String... columnFamilies) throws IOException; boolean repairedAt, String... columnFamilies) throws IOException;
@Deprecated /**
* Same as forceRepairAsync, but handles a specified range
*
* @param parallelismDegree
* 0: sequential, 1: parallel, 2: DC parallel
*/
public int forceRepairRangeAsync(String beginToken, String endToken, public int forceRepairRangeAsync(String beginToken, String endToken,
String keyspaceName, RepairParallelism parallelismDegree, String keyspaceName, int parallelismDegree,
Collection<String> dataCenters, Collection<String> hosts, Collection<String> dataCenters, Collection<String> hosts,
boolean fullRepair, String... columnFamilies); boolean fullRepair, String... columnFamilies);
@Deprecated /**
* Invoke repair asynchronously. You can track repair progress by
* subscribing JMX notification sent from this StorageServiceMBean.
* Notification format is: type: "repair" userObject: int array of length 2,
* [0]=command number, [1]=ordinal of ActiveRepairService.Status
*
* @return Repair command number, or 0 if nothing to repair
*/
public int forceRepairAsync(String keyspace, boolean isSequential, public int forceRepairAsync(String keyspace, boolean isSequential,
boolean isLocal, boolean primaryRange, boolean fullRepair, boolean isLocal, boolean primaryRange, boolean fullRepair,
String... columnFamilies); String... columnFamilies);
@Deprecated /**
* Same as forceRepairAsync, but handles a specified range
*/
public int forceRepairRangeAsync(String beginToken, String endToken, public int forceRepairRangeAsync(String beginToken, String endToken,
String keyspaceName, boolean isSequential, boolean isLocal, String keyspaceName, boolean isSequential, boolean isLocal,
boolean repairedAt, String... columnFamilies); boolean repairedAt, String... columnFamilies);
@ -424,8 +460,8 @@ public interface StorageServiceMBean extends NotificationEmitter {
* makes node unavailable for writes, flushes memtables and replays * makes node unavailable for writes, flushes memtables and replays
* commitlog. * commitlog.
*/ */
public void drain() throws IOException, InterruptedException, public void drain()
ExecutionException; throws IOException, InterruptedException, ExecutionException;
/** /**
* Truncates (deletes) the given columnFamily from the provided keyspace. * Truncates (deletes) the given columnFamily from the provided keyspace.
@ -460,8 +496,6 @@ public interface StorageServiceMBean extends NotificationEmitter {
public List<String> getKeyspaces(); public List<String> getKeyspaces();
public List<String> getNonSystemKeyspaces();
/** /**
* Change endpointsnitch class and dynamic-ness (and dynamic attributes) at * Change endpointsnitch class and dynamic-ness (and dynamic attributes) at
* runtime * runtime
@ -600,7 +634,7 @@ public interface StorageServiceMBean extends NotificationEmitter {
/** /**
* Returns the configured tracing probability. * Returns the configured tracing probability.
*/ */
public double getTraceProbability(); public double getTracingProbability();
void disableAutoCompaction(String ks, String... columnFamilies) void disableAutoCompaction(String ks, String... columnFamilies)
throws IOException; throws IOException;
@ -628,12 +662,8 @@ public interface StorageServiceMBean extends NotificationEmitter {
/** Sets the threshold for abandoning queries with many tombstones */ /** Sets the threshold for abandoning queries with many tombstones */
public void setTombstoneFailureThreshold(int tombstoneDebugThreshold); public void setTombstoneFailureThreshold(int tombstoneDebugThreshold);
/** Returns the threshold for rejecting queries due to a large batch size */ /**
public int getBatchSizeFailureThreshold(); * Sets the hinted handoff throttle in kb per second, per delivery thread.
*/
/** Sets the threshold for rejecting queries due to a large batch size */
public void setBatchSizeFailureThreshold(int batchSizeDebugThreshold);
/** Sets the hinted handoff throttle in kb per second, per delivery thread. */
public void setHintedHandoffThrottleInKB(int throttleInKB); public void setHintedHandoffThrottleInKB(int throttleInKB);
} }