|
||||||||||
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 | |
---|---|
static class |
StorageService.Verb
|
Field Summary | |
---|---|
static char |
Delimiter
|
static StorageService |
instance
|
static java.lang.String |
MOVE_STATE
|
static java.lang.String |
REMOVE_TOKEN
|
static int |
RING_DELAY
|
static java.lang.String |
STATE_BOOTSTRAPPING
|
static java.lang.String |
STATE_LEAVING
|
static java.lang.String |
STATE_LEFT
|
static java.lang.String |
STATE_NORMAL
|
static StorageService.Verb[] |
VERBS
|
Constructor Summary | |
---|---|
StorageService()
|
Method Summary | |
---|---|
void |
addBootstrapSource(java.net.InetAddress s,
java.lang.String table)
|
static void |
calculatePendingRanges(AbstractReplicationStrategy strategy,
java.lang.String table)
|
void |
clearSnapshot()
Remove all the existing snapshots. |
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 |
doConsistencyCheck(Row row,
java.util.List<java.net.InetAddress> endpoints,
ReadCommand command)
This method performs the requisite operations to make sure that the N replicas are in sync. |
void |
drain()
shuts node off to writes, empties memtables and the commit log. |
java.net.InetAddress |
findSuitableEndPoint(java.lang.String table,
java.lang.String key)
This function finds the closest live endpoint that contains a given key. |
void |
forceTableCleanup()
Trigger a cleanup of keys on all tables. |
void |
forceTableCleanup(java.lang.String tableName)
Trigger a cleanup of keys on a single keyspace |
void |
forceTableCompaction()
Forces major compaction (all sstable files compacted) |
void |
forceTableCompaction(java.lang.String tableName)
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.util.List<java.net.InetAddress> |
getLiveNaturalEndpoints(java.lang.String table,
java.lang.String 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.Set<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,
java.lang.String 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) |
static IPartitioner |
getPartitioner()
|
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. |
AbstractReplicationStrategy |
getReplicationStrategy(java.lang.String table)
|
static AbstractReplicationStrategy |
getReplicationStrategy(TokenMetadata tokenMetadata,
java.lang.String table)
|
java.util.List<Token> |
getSplits(Range range,
int keysPerSplit)
|
java.util.Map<java.lang.String,java.lang.String> |
getStringEndpointMap()
|
java.net.InetAddress |
getSuccessor(java.net.InetAddress ep)
|
java.lang.String |
getToken()
Fetch a string representation of the token. |
TokenMetadata |
getTokenMetadata()
|
java.util.Set<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... columnFamilies)
|
WriteResponseHandler |
getWriteResponseHandler(int blockFor,
ConsistencyLevel consistency_level,
java.lang.String table)
|
void |
initClient()
|
void |
initServer()
|
boolean |
isBootstrapMode()
|
boolean |
isClientMode()
|
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 |
move(java.lang.String newToken)
|
void |
onAlive(java.net.InetAddress endpoint,
EndPointState state)
|
void |
onChange(java.net.InetAddress endpoint,
java.lang.String apStateName,
ApplicationState apState)
|
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 |
removeBootstrapSource(java.net.InetAddress s,
java.lang.String table)
|
void |
removeToken(java.lang.String tokenString)
removeToken removes token (and all data associated with enpoint that had it) from the ring |
void |
requestGC()
|
void |
saveCaches()
save row and key caches |
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 |
stopClient()
|
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. |
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 java.lang.String MOVE_STATE
public static final char Delimiter
public static final java.lang.String STATE_BOOTSTRAPPING
public static final java.lang.String STATE_NORMAL
public static final java.lang.String STATE_LEAVING
public static final java.lang.String STATE_LEFT
public static final java.lang.String REMOVE_TOKEN
public static final StorageService.Verb[] VERBS
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 addBootstrapSource(java.net.InetAddress s, java.lang.String table)
public void removeBootstrapSource(java.net.InetAddress s, java.lang.String table)
public void setToken(Token token)
public AbstractReplicationStrategy getReplicationStrategy(java.lang.String table)
public static AbstractReplicationStrategy getReplicationStrategy(TokenMetadata tokenMetadata, java.lang.String table)
public void stopClient()
public void initClient() throws java.io.IOException
java.io.IOException
public void initServer() throws java.io.IOException, ConfigurationException
java.io.IOException
ConfigurationException
public boolean isBootstrapMode()
public TokenMetadata getTokenMetadata()
public void doConsistencyCheck(Row row, java.util.List<java.net.InetAddress> endpoints, ReadCommand command)
public java.util.Map<Range,java.util.List<java.lang.String>> getRangeToEndPointMap(java.lang.String keyspace)
getRangeToEndPointMap
in interface StorageServiceMBean
keyspace
-
public java.util.Map<Range,java.util.List<java.net.InetAddress>> getRangeToAddressMap(java.lang.String keyspace)
public void onChange(java.net.InetAddress endpoint, java.lang.String apStateName, ApplicationState apState)
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 IEndPointStateChangeSubscriber
endpoint
- 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 IEndPointStateChangeSubscriber
public void onRemove(java.net.InetAddress endpoint)
onRemove
in interface IEndPointStateChangeSubscriber
public void onDead(java.net.InetAddress endpoint, EndPointState state)
onDead
in interface IEndPointStateChangeSubscriber
public double getLoad()
getLoad
in interface StorageServiceMBean
public java.lang.String getLoadString()
StorageServiceMBean
getLoadString
in interface StorageServiceMBean
public java.util.Map<java.lang.String,java.lang.String> getLoadMap()
StorageServiceMBean
getLoadMap
in interface StorageServiceMBean
public final void deliverHints(java.net.InetAddress endpoint)
public final void deliverHints(java.lang.String host) throws java.net.UnknownHostException
StorageServiceMBean
deliverHints
in interface StorageServiceMBean
java.net.UnknownHostException
public Token getLocalToken()
public java.lang.String getToken()
StorageServiceMBean
getToken
in interface StorageServiceMBean
public java.util.Set<java.lang.String> getLiveNodes()
StorageServiceMBean
getLiveNodes
in interface StorageServiceMBean
public java.util.Set<java.lang.String> getUnreachableNodes()
StorageServiceMBean
getUnreachableNodes
in interface StorageServiceMBean
public int getCurrentGenerationNumber()
StorageServiceMBean
getCurrentGenerationNumber
in interface StorageServiceMBean
public void forceTableCleanup() throws java.io.IOException
StorageServiceMBean
forceTableCleanup
in interface StorageServiceMBean
java.io.IOException
public void forceTableCleanup(java.lang.String tableName) throws java.io.IOException
StorageServiceMBean
forceTableCleanup
in interface StorageServiceMBean
java.io.IOException
public void forceTableCompaction() throws java.io.IOException
StorageServiceMBean
forceTableCompaction
in interface StorageServiceMBean
java.io.IOException
public void forceTableCompaction(java.lang.String tableName) throws java.io.IOException
StorageServiceMBean
forceTableCompaction
in interface StorageServiceMBean
java.io.IOException
public void takeSnapshot(java.lang.String tableName, java.lang.String tag) throws java.io.IOException
takeSnapshot
in interface StorageServiceMBean
tableName
- 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 StorageServiceMBean
tag
- the tag given to the snapshot (null is permissible)
java.io.IOException
public void clearSnapshot() throws java.io.IOException
clearSnapshot
in interface StorageServiceMBean
java.io.IOException
public java.lang.Iterable<ColumnFamilyStore> getValidColumnFamilies(java.lang.String tableName, java.lang.String... columnFamilies) throws java.io.IOException
java.io.IOException
public void forceTableFlush(java.lang.String tableName, java.lang.String... columnFamilies) throws java.io.IOException
forceTableFlush
in interface StorageServiceMBean
tableName
- columnFamilies
-
java.io.IOException
public void forceTableRepair(java.lang.String tableName, java.lang.String... columnFamilies) throws java.io.IOException
forceTableRepair
in interface StorageServiceMBean
tableName
- columnFamilies
-
java.io.IOException
public 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.lang.String key)
getNaturalEndpoints
in interface StorageServiceMBean
key
- - key for which we need to find the endpoint return value -
the endpoint responsible for this keytable
- - key for which we need to find the endpoint return value -
the endpoint responsible for this keypublic 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 tokenpublic java.util.List<java.net.InetAddress> getLiveNaturalEndpoints(java.lang.String table, java.lang.String key)
key
- - key for which we need to find the endpoint return value -
the endpoint responsible for this keypublic java.util.List<java.net.InetAddress> getLiveNaturalEndpoints(java.lang.String table, Token token)
public java.net.InetAddress findSuitableEndPoint(java.lang.String table, java.lang.String key) throws java.io.IOException, UnavailableException
java.io.IOException
UnavailableException
public java.util.Map<java.lang.String,java.lang.String> getStringEndpointMap()
public void setLog4jLevel(java.lang.String classQualifier, java.lang.String rawLevel)
StorageServiceMBean
setLog4jLevel
in interface StorageServiceMBean
public java.util.List<Token> getSplits(Range range, int keysPerSplit)
public Token getBootstrapToken()
public void decommission() throws java.lang.InterruptedException
StorageServiceMBean
decommission
in interface StorageServiceMBean
java.lang.InterruptedException
public void move(java.lang.String newToken) throws java.io.IOException, java.lang.InterruptedException
move
in interface StorageServiceMBean
newToken
- 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 StorageServiceMBean
java.io.IOException
java.lang.InterruptedException
public void removeToken(java.lang.String tokenString)
StorageServiceMBean
removeToken
in interface StorageServiceMBean
public WriteResponseHandler getWriteResponseHandler(int blockFor, ConsistencyLevel consistency_level, java.lang.String table)
public boolean isClientMode()
public void requestGC()
public java.lang.String getOperationMode()
StorageServiceMBean
getOperationMode
in interface StorageServiceMBean
public void drain() throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
drain
in interface StorageServiceMBean
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public void saveCaches() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
StorageServiceMBean
saveCaches
in interface StorageServiceMBean
java.util.concurrent.ExecutionException
java.lang.InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |