|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cassandra.service.StorageService
public class StorageService
| Nested Class Summary | |
|---|---|
class |
StorageService.Keyspaces
|
static class |
StorageService.Verb
|
| Field Summary | |
|---|---|
static StorageService |
instance
|
static int |
RING_DELAY
|
static RetryingScheduledThreadPoolExecutor |
scheduledTasks
This pool is used for periodic short time execution tasks. |
static RetryingScheduledThreadPoolExecutor |
tasks
This pool is used by tasks that can have long execution, (and usually are non periodic). |
VersionedValue.VersionedValueFactory |
valueFactory
|
static StorageService.Verb[] |
VERBS
|
static java.util.EnumMap<StorageService.Verb,Stage> |
verbStages
|
| Constructor Summary | |
|---|---|
StorageService()
|
|
| Method Summary | |
|---|---|
static void |
calculatePendingRanges(AbstractReplicationStrategy strategy,
java.lang.String table)
|
void |
clearSnapshot()
Remove all the existing snapshots. |
void |
confirmReplication(java.net.InetAddress node)
|
void |
decommission()
transfer this node's data to other machines and remove it from service. |
void |
deliverHints(java.net.InetAddress endpoint)
Deliver hints to the specified node when it has crashed and come back up/ marked as alive after a network partition |
void |
deliverHints(java.lang.String host)
force hint delivery to an endpoint |
void |
drain()
shuts node off to writes, empties memtables and the commit log. |
java.lang.String |
exportSchema()
Introduced in 0.7 to allow schema yaml to be exported. |
void |
finishBootstrapping()
|
void |
flushLargestMemtables()
Flushes the two largest memtables by ops and by throughput |
void |
forceRemoveCompletion()
Force a remove operation to complete. |
void |
forceTableCleanup(java.lang.String tableName,
java.lang.String... columnFamilies)
Trigger a cleanup of keys on a single keyspace |
void |
forceTableCompaction(java.lang.String tableName,
java.lang.String... columnFamilies)
Forces major compaction of a single keyspace |
void |
forceTableFlush(java.lang.String tableName,
java.lang.String... columnFamilies)
Flush all memtables for a table and column families. |
void |
forceTableRepair(java.lang.String tableName,
java.lang.String... columnFamilies)
Trigger proactive repair for a table and column families. |
java.util.List<Range> |
getAllRanges(java.util.List<Token> sortedTokens)
Get all ranges that span the ring given a set of tokens. |
Token |
getBootstrapToken()
return a token to which if a node bootstraps it will get about 1/2 of this node's range |
int |
getCurrentGenerationNumber()
Return the generation value for this node. |
java.lang.String |
getDrainProgress()
get the progress of a drain operation |
java.util.List<java.lang.String> |
getJoiningNodes()
Retrieve the list of nodes currently bootstrapping into the ring. |
java.util.List<java.lang.String> |
getKeyspaces()
|
java.util.List<java.lang.String> |
getLeavingNodes()
Retrieve the list of nodes currently leaving the ring. |
java.util.List<java.net.InetAddress> |
getLiveNaturalEndpoints(java.lang.String table,
java.nio.ByteBuffer key)
This method attempts to return N endpoints that are responsible for storing the specified key i.e for replication. |
java.util.List<java.net.InetAddress> |
getLiveNaturalEndpoints(java.lang.String table,
Token token)
|
java.util.List<java.lang.String> |
getLiveNodes()
Retrieve the list of live nodes in the cluster, where "liveness" is determined by the failure detector of the node being queried. |
double |
getLoad()
raw load value |
java.util.Map<java.lang.String,java.lang.String> |
getLoadMap()
Human-readable load value. |
java.lang.String |
getLoadString()
Human-readable load value |
Range |
getLocalPrimaryRange()
|
java.util.Collection<Range> |
getLocalRanges(java.lang.String table)
|
Token |
getLocalToken()
|
java.util.List<java.net.InetAddress> |
getNaturalEndpoints(java.lang.String table,
byte[] key)
This method returns the N endpoints that are responsible for storing the specified key i.e for replication. |
java.util.List<java.net.InetAddress> |
getNaturalEndpoints(java.lang.String table,
java.nio.ByteBuffer key)
This method returns the N endpoints that are responsible for storing the specified key i.e for replication. |
java.util.List<java.net.InetAddress> |
getNaturalEndpoints(java.lang.String table,
Token token)
This method returns the N endpoints that are responsible for storing the specified key i.e for replication. |
java.lang.String |
getOperationMode()
get the operational mode (leaving, joining, normal, decommissioned, client) |
java.util.Map<Token,java.lang.Float> |
getOwnership()
given a list of tokens (representing the nodes in the cluster), returns a mapping from "token -> %age of cluster owned by that token" |
static IPartitioner |
getPartitioner()
|
java.util.Map<Range,java.util.List<java.lang.String>> |
getPendingRangeToEndpointMap(java.lang.String keyspace)
Retrieve a map of pending ranges to endpoints that describe the ring topology |
Range |
getPrimaryRangeForEndpoint(java.net.InetAddress ep)
Get the primary range for the specified endpoint. |
java.util.Map<Range,java.util.List<java.net.InetAddress>> |
getRangeToAddressMap(java.lang.String keyspace)
|
java.util.Map<Range,java.util.List<java.lang.String>> |
getRangeToEndpointMap(java.lang.String keyspace)
for a keyspace, return the ranges and corresponding hosts for a given keyspace. |
java.lang.String |
getReleaseVersion()
Fetch a string representation of the Cassandra version. |
java.lang.String |
getRemovalStatus()
Get the status of a token removal. |
java.util.List<Token> |
getSplits(java.lang.String table,
java.lang.String cfName,
Range range,
int keysPerSplit)
|
java.net.InetAddress |
getSuccessor(java.net.InetAddress ep)
|
java.lang.String |
getToken()
Fetch a string representation of the token. |
TokenMetadata |
getTokenMetadata()
|
java.util.Map<Token,java.lang.String> |
getTokenToEndpointMap()
Retrieve a map of tokens to endpoints, including the bootstrapping ones. |
java.util.List<java.lang.String> |
getUnreachableNodes()
Retrieve the list of unreachable nodes in the cluster, as determined by this node's failure detector. |
java.lang.Iterable<ColumnFamilyStore> |
getValidColumnFamilies(java.lang.String tableName,
java.lang.String... cfNames)
|
void |
initClient()
|
void |
initServer()
|
void |
invalidateKeyCaches(java.lang.String tableName,
java.lang.String... columnFamilies)
|
void |
invalidateRowCaches(java.lang.String tableName,
java.lang.String... columnFamilies)
|
boolean |
isBootstrapMode()
|
boolean |
isClientMode()
|
boolean |
isInitialized()
|
boolean |
isJoined()
|
boolean |
isRPCServerRunning()
|
void |
joinRing()
|
void |
loadBalance()
This node will unload its data onto its neighbors, and bootstrap to share the range of the most-loaded node in the ring. |
void |
loadSchemaFromYAML()
load schema from yaml. |
void |
move(java.lang.String newToken)
|
void |
onAlive(java.net.InetAddress endpoint,
EndpointState state)
|
void |
onChange(java.net.InetAddress endpoint,
ApplicationState state,
VersionedValue value)
|
void |
onDead(java.net.InetAddress endpoint,
EndpointState state)
|
void |
onJoin(java.net.InetAddress endpoint,
EndpointState epState)
Use to inform interested parties about the change in the state for specified endpoint |
void |
onRemove(java.net.InetAddress endpoint)
|
void |
reduceCacheSizes()
|
void |
registerDaemon(CassandraDaemon daemon)
|
void |
removeToken(java.lang.String tokenString)
Remove a node that has died, attempting to restore the replica count. |
void |
requestGC()
|
void |
saveCaches()
save row and key caches |
void |
scrub(java.lang.String tableName,
java.lang.String... columnFamilies)
Scrub (deserialize + reserialize at the latest version, skipping bad rows if any) the given keyspace. |
void |
setLog4jLevel(java.lang.String classQualifier,
java.lang.String rawLevel)
set the logging level at runtime |
void |
setToken(Token token)
This method updates the local token on disk |
void |
startGossiping()
|
void |
startRPCServer()
|
void |
stopClient()
|
void |
stopGossiping()
|
void |
stopRPCServer()
|
void |
takeAllSnapshot(java.lang.String tag)
Takes a snapshot for every table. |
void |
takeSnapshot(java.lang.String tableName,
java.lang.String tag)
Takes the snapshot for a given table. |
void |
truncate(java.lang.String keyspace,
java.lang.String columnFamily)
Truncates (deletes) the given columnFamily from the provided keyspace. |
void |
updateSnitch(java.lang.String epSnitchClassName,
java.lang.Boolean dynamic,
java.lang.Integer dynamicUpdateInterval,
java.lang.Integer dynamicResetInterval,
java.lang.Double dynamicBadnessThreshold)
Change endpointsnitch class and dynamic-ness (and dynamic attributes) at runtime |
boolean |
useEfficientCrossDCWrites()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int RING_DELAY
public static final StorageService.Verb[] VERBS
public static final java.util.EnumMap<StorageService.Verb,Stage> verbStages
public static final RetryingScheduledThreadPoolExecutor scheduledTasks
public static final RetryingScheduledThreadPoolExecutor tasks
public VersionedValue.VersionedValueFactory valueFactory
public static final StorageService instance
| Constructor Detail |
|---|
public StorageService()
| Method Detail |
|---|
public static IPartitioner getPartitioner()
public java.util.Collection<Range> getLocalRanges(java.lang.String table)
public Range getLocalPrimaryRange()
public void finishBootstrapping()
public void setToken(Token token)
public void registerDaemon(CassandraDaemon daemon)
public void stopGossiping()
stopGossiping in interface StorageServiceMBeanpublic void startGossiping()
startGossiping in interface StorageServiceMBeanpublic void startRPCServer()
startRPCServer in interface StorageServiceMBeanpublic void stopRPCServer()
stopRPCServer in interface StorageServiceMBeanpublic boolean isRPCServerRunning()
isRPCServerRunning in interface StorageServiceMBeanpublic void stopClient()
public boolean isInitialized()
isInitialized in interface StorageServiceMBean
public void initClient()
throws java.io.IOException,
ConfigurationException
java.io.IOException
ConfigurationException
public void initServer()
throws java.io.IOException,
ConfigurationException
java.io.IOException
ConfigurationException
public void joinRing()
throws java.io.IOException,
ConfigurationException
joinRing in interface StorageServiceMBeanjava.io.IOException
ConfigurationExceptionpublic boolean isJoined()
isJoined in interface StorageServiceMBeanpublic boolean isBootstrapMode()
public TokenMetadata getTokenMetadata()
public java.util.Map<Range,java.util.List<java.lang.String>> getRangeToEndpointMap(java.lang.String keyspace)
getRangeToEndpointMap in interface StorageServiceMBeankeyspace -
public java.util.Map<Range,java.util.List<java.lang.String>> getPendingRangeToEndpointMap(java.lang.String keyspace)
StorageServiceMBean
getPendingRangeToEndpointMap in interface StorageServiceMBeankeyspace - the keyspace to get the pending range map for.
public java.util.Map<Range,java.util.List<java.net.InetAddress>> getRangeToAddressMap(java.lang.String keyspace)
public java.util.Map<Token,java.lang.String> getTokenToEndpointMap()
StorageServiceMBean
getTokenToEndpointMap in interface StorageServiceMBean
public void onChange(java.net.InetAddress endpoint,
ApplicationState state,
VersionedValue value)
onChange in interface IEndpointStateChangeSubscriber
public static void calculatePendingRanges(AbstractReplicationStrategy strategy,
java.lang.String table)
public void onJoin(java.net.InetAddress endpoint,
EndpointState epState)
IEndpointStateChangeSubscriber
onJoin in interface IEndpointStateChangeSubscriberendpoint - endpoint for which the state change occurred.epState - state that actually changed for the above endpoint.
public void onAlive(java.net.InetAddress endpoint,
EndpointState state)
onAlive in interface IEndpointStateChangeSubscriberpublic void onRemove(java.net.InetAddress endpoint)
onRemove in interface IEndpointStateChangeSubscriber
public void onDead(java.net.InetAddress endpoint,
EndpointState state)
onDead in interface IEndpointStateChangeSubscriberpublic double getLoad()
getLoad in interface StorageServiceMBeanpublic java.lang.String getLoadString()
StorageServiceMBean
getLoadString in interface StorageServiceMBeanpublic java.util.Map<java.lang.String,java.lang.String> getLoadMap()
StorageServiceMBean
getLoadMap in interface StorageServiceMBeanpublic final void deliverHints(java.net.InetAddress endpoint)
public final void deliverHints(java.lang.String host)
throws java.net.UnknownHostException
StorageServiceMBean
deliverHints in interface StorageServiceMBeanjava.net.UnknownHostExceptionpublic Token getLocalToken()
public java.lang.String getToken()
StorageServiceMBean
getToken in interface StorageServiceMBeanpublic java.lang.String getReleaseVersion()
StorageServiceMBean
getReleaseVersion in interface StorageServiceMBeanpublic java.util.List<java.lang.String> getLeavingNodes()
StorageServiceMBean
getLeavingNodes in interface StorageServiceMBeanpublic java.util.List<java.lang.String> getJoiningNodes()
StorageServiceMBean
getJoiningNodes in interface StorageServiceMBeanpublic java.util.List<java.lang.String> getLiveNodes()
StorageServiceMBean
getLiveNodes in interface StorageServiceMBeanpublic java.util.List<java.lang.String> getUnreachableNodes()
StorageServiceMBean
getUnreachableNodes in interface StorageServiceMBeanpublic int getCurrentGenerationNumber()
StorageServiceMBean
getCurrentGenerationNumber in interface StorageServiceMBean
public void forceTableCleanup(java.lang.String tableName,
java.lang.String... columnFamilies)
throws java.io.IOException,
java.util.concurrent.ExecutionException,
java.lang.InterruptedException
StorageServiceMBean
forceTableCleanup in interface StorageServiceMBeanjava.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void scrub(java.lang.String tableName,
java.lang.String... columnFamilies)
throws java.io.IOException,
java.util.concurrent.ExecutionException,
java.lang.InterruptedException
StorageServiceMBean
scrub in interface StorageServiceMBeanjava.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void forceTableCompaction(java.lang.String tableName,
java.lang.String... columnFamilies)
throws java.io.IOException,
java.util.concurrent.ExecutionException,
java.lang.InterruptedException
StorageServiceMBean
forceTableCompaction in interface StorageServiceMBeanjava.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void invalidateKeyCaches(java.lang.String tableName,
java.lang.String... columnFamilies)
throws java.io.IOException
invalidateKeyCaches in interface StorageServiceMBeanjava.io.IOException
public void invalidateRowCaches(java.lang.String tableName,
java.lang.String... columnFamilies)
throws java.io.IOException
invalidateRowCaches in interface StorageServiceMBeanjava.io.IOException
public void takeSnapshot(java.lang.String tableName,
java.lang.String tag)
throws java.io.IOException
takeSnapshot in interface StorageServiceMBeantableName - the name of the table.tag - the tag given to the snapshot (null is permissible)
java.io.IOException
public void takeAllSnapshot(java.lang.String tag)
throws java.io.IOException
takeAllSnapshot in interface StorageServiceMBeantag - the tag given to the snapshot (null is permissible)
java.io.IOException
public void clearSnapshot()
throws java.io.IOException
clearSnapshot in interface StorageServiceMBeanjava.io.IOException
public java.lang.Iterable<ColumnFamilyStore> getValidColumnFamilies(java.lang.String tableName,
java.lang.String... cfNames)
throws java.io.IOException
java.io.IOException
public void forceTableFlush(java.lang.String tableName,
java.lang.String... columnFamilies)
throws java.io.IOException,
java.util.concurrent.ExecutionException,
java.lang.InterruptedException
forceTableFlush in interface StorageServiceMBeantableName - columnFamilies -
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public void forceTableRepair(java.lang.String tableName,
java.lang.String... columnFamilies)
throws java.io.IOException
forceTableRepair in interface StorageServiceMBeantableName - columnFamilies -
java.io.IOExceptionpublic java.net.InetAddress getSuccessor(java.net.InetAddress ep)
public Range getPrimaryRangeForEndpoint(java.net.InetAddress ep)
ep - endpoint we are interested in.
public java.util.List<Range> getAllRanges(java.util.List<Token> sortedTokens)
public java.util.List<java.net.InetAddress> getNaturalEndpoints(java.lang.String table,
java.nio.ByteBuffer key)
key - - key for which we need to find the endpoint return value -
the endpoint responsible for this key
public java.util.List<java.net.InetAddress> getNaturalEndpoints(java.lang.String table,
byte[] key)
StorageServiceMBean
getNaturalEndpoints in interface StorageServiceMBeankey - - key for which we need to find the endpoint return value -
the endpoint responsible for this key
public java.util.List<java.net.InetAddress> getNaturalEndpoints(java.lang.String table,
Token token)
token - - token for which we need to find the endpoint return value -
the endpoint responsible for this token
public java.util.List<java.net.InetAddress> getLiveNaturalEndpoints(java.lang.String table,
java.nio.ByteBuffer key)
key - - key for which we need to find the endpoint return value -
the endpoint responsible for this key
public java.util.List<java.net.InetAddress> getLiveNaturalEndpoints(java.lang.String table,
Token token)
public void setLog4jLevel(java.lang.String classQualifier,
java.lang.String rawLevel)
StorageServiceMBean
setLog4jLevel in interface StorageServiceMBean
public java.util.List<Token> getSplits(java.lang.String table,
java.lang.String cfName,
Range range,
int keysPerSplit)
public Token getBootstrapToken()
public void decommission()
throws java.lang.InterruptedException
StorageServiceMBean
decommission in interface StorageServiceMBeanjava.lang.InterruptedException
public void move(java.lang.String newToken)
throws java.io.IOException,
java.lang.InterruptedException
move in interface StorageServiceMBeannewToken - token to move this node to.
This node will unload its data onto its neighbors, and bootstrap to the new token.
java.io.IOException
java.lang.InterruptedException
public void loadBalance()
throws java.io.IOException,
java.lang.InterruptedException
StorageServiceMBean
loadBalance in interface StorageServiceMBeanjava.io.IOException
java.lang.InterruptedExceptionpublic java.lang.String getRemovalStatus()
getRemovalStatus in interface StorageServiceMBeanpublic void forceRemoveCompletion()
forceRemoveCompletion in interface StorageServiceMBeanpublic void removeToken(java.lang.String tokenString)
removeToken in interface StorageServiceMBeantokenString - token for the nodepublic void confirmReplication(java.net.InetAddress node)
public boolean isClientMode()
public void requestGC()
public java.lang.String getOperationMode()
StorageServiceMBean
getOperationMode in interface StorageServiceMBeanpublic java.lang.String getDrainProgress()
StorageServiceMBean
getDrainProgress in interface StorageServiceMBean
public void drain()
throws java.io.IOException,
java.lang.InterruptedException,
java.util.concurrent.ExecutionException
drain in interface StorageServiceMBeanjava.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public void loadSchemaFromYAML()
throws ConfigurationException,
java.io.IOException
loadSchemaFromYAML in interface StorageServiceMBeanConfigurationException
java.io.IOException
public java.lang.String exportSchema()
throws java.io.IOException
StorageServiceMBean
exportSchema in interface StorageServiceMBeanjava.io.IOException
public void truncate(java.lang.String keyspace,
java.lang.String columnFamily)
throws UnavailableException,
java.util.concurrent.TimeoutException,
java.io.IOException
StorageServiceMBean
truncate in interface StorageServiceMBeankeyspace - The keyspace to delete fromcolumnFamily - The column family to delete data from.
UnavailableException - if some of the hosts in the ring are down.
java.util.concurrent.TimeoutException
java.io.IOException
public void saveCaches()
throws java.util.concurrent.ExecutionException,
java.lang.InterruptedException
StorageServiceMBean
saveCaches in interface StorageServiceMBeanjava.util.concurrent.ExecutionException
java.lang.InterruptedExceptionpublic java.util.Map<Token,java.lang.Float> getOwnership()
StorageServiceMBean
getOwnership in interface StorageServiceMBeanpublic java.util.List<java.lang.String> getKeyspaces()
getKeyspaces in interface StorageServiceMBean
public void updateSnitch(java.lang.String epSnitchClassName,
java.lang.Boolean dynamic,
java.lang.Integer dynamicUpdateInterval,
java.lang.Integer dynamicResetInterval,
java.lang.Double dynamicBadnessThreshold)
throws ConfigurationException
StorageServiceMBean
updateSnitch in interface StorageServiceMBeanepSnitchClassName - the canonical path name for a class implementing IEndpointSnitchdynamic - boolean that decides whether dynamicsnitch is used or notdynamicUpdateInterval - integer, in ms (default 100)dynamicResetInterval - integer, in ms (default 600,000)dynamicBadnessThreshold - double, (default 0.0)
ConfigurationException - classname not found on classpathpublic boolean useEfficientCrossDCWrites()
public void flushLargestMemtables()
public void reduceCacheSizes()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||