|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.service.StorageService
public final class StorageService
Field Summary | |
---|---|
static java.lang.String |
binaryVerbHandler_
|
static java.lang.String |
bootstrapTokenVerbHandler_
|
static java.lang.String |
dataFileVerbHandler_
|
static char |
Delimiter
|
static java.lang.String |
LEFT_NORMALLY
|
static java.lang.String |
MOVE_STATE
|
static java.lang.String |
mutationVerbHandler_
|
static java.lang.String |
rangeSliceVerbHandler_
|
static java.lang.String |
rangeVerbHandler_
|
static java.lang.String |
readRepairVerbHandler_
|
static java.lang.String |
readVerbHandler_
|
static java.lang.String |
REMOVE_TOKEN
|
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 java.lang.String |
streamFinishedVerbHandler_
|
static java.lang.String |
streamInitiateDoneVerbHandler_
|
static java.lang.String |
streamInitiateVerbHandler_
|
static java.lang.String |
streamRequestVerbHandler_
|
Constructor Summary | |
---|---|
StorageService()
|
Method Summary | |
---|---|
void |
addBootstrapSource(java.net.InetAddress s,
java.lang.String table)
|
static void |
calculatePendingRanges(TokenMetadata tm,
AbstractReplicationStrategy strategy)
|
void |
clearSnapshot()
Remove all the existing snapshots. |
java.util.Map<Range,java.util.List<java.net.InetAddress>> |
constructRangeToEndPointMap(java.util.List<Range> ranges)
Construct the range to endpoint mapping based on the true view of the world. |
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 |
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. |
java.net.InetAddress |
findSuitableEndPoint(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 |
forceTableCompaction()
Forces major compaction (all sstable files compacted) |
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. |
int |
getCurrentGenerationNumber()
Return the generation value for this node. |
IEndPointSnitch |
getEndPointSnitch()
|
java.util.Map<java.net.InetAddress,java.net.InetAddress> |
getHintedEndpointMap(java.lang.String key,
java.util.List<java.net.InetAddress> naturalEndpoints)
This method returns the N endpoints that are responsible for storing the specified key i.e for replication. |
java.util.List<java.net.InetAddress> |
getLiveNaturalEndpoints(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(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()
|
Token |
getLocalToken()
|
java.util.List<java.net.InetAddress> |
getNaturalEndpoints(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(Token token)
This method returns the N endpoints that are responsible for storing the specified key i.e for replication. |
static IPartitioner |
getPartitioner()
|
java.net.InetAddress |
getPrimary(java.lang.String key)
This method returns the endpoint that is responsible for storing the specified key. |
java.net.InetAddress |
getPrimary(Token token)
|
Range |
getPrimaryRangeForEndPoint(java.net.InetAddress ep)
Get the primary range for the specified endpoint. |
java.util.Map<Range,java.util.List<java.lang.String>> |
getRangeToEndPointMap()
Retrieve a map of range to end points that describe the ring topology of a Cassandra cluster. |
AbstractReplicationStrategy |
getReplicationStrategy()
|
static AbstractReplicationStrategy |
getReplicationStrategy(TokenMetadata tokenMetadata,
IPartitioner partitioner)
|
java.util.List<java.lang.String> |
getSplits(int splits)
|
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,
int consistency_level)
|
void |
initClient()
|
void |
initServer()
|
static StorageService |
instance()
|
boolean |
isBootstrapMode()
|
boolean |
isClientMode()
|
boolean |
isPrimary(java.lang.String key)
This method determines whether the local endpoint is the primary for the given key. |
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 |
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 |
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 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 java.lang.String LEFT_NORMALLY
public static final java.lang.String mutationVerbHandler_
public static final java.lang.String binaryVerbHandler_
public static final java.lang.String readRepairVerbHandler_
public static final java.lang.String readVerbHandler_
public static final java.lang.String streamInitiateVerbHandler_
public static final java.lang.String streamInitiateDoneVerbHandler_
public static final java.lang.String streamFinishedVerbHandler_
public static final java.lang.String dataFileVerbHandler_
public static final java.lang.String streamRequestVerbHandler_
public static final java.lang.String rangeVerbHandler_
public static final java.lang.String rangeSliceVerbHandler_
public static final java.lang.String bootstrapTokenVerbHandler_
Constructor Detail |
---|
public StorageService()
Method Detail |
---|
public static IPartitioner getPartitioner()
public java.util.Collection<Range> getLocalRanges()
public Range getLocalPrimaryRange()
public static StorageService instance()
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 static AbstractReplicationStrategy getReplicationStrategy(TokenMetadata tokenMetadata, IPartitioner partitioner)
public void stopClient()
public void initClient() throws java.io.IOException
java.io.IOException
public void initServer() throws java.io.IOException
java.io.IOException
public boolean isBootstrapMode()
public TokenMetadata getTokenMetadata()
public IEndPointSnitch getEndPointSnitch()
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()
StorageServiceMBean
getRangeToEndPointMap
in interface StorageServiceMBean
public java.util.Map<Range,java.util.List<java.net.InetAddress>> constructRangeToEndPointMap(java.util.List<Range> ranges)
ranges
-
public void onChange(java.net.InetAddress endpoint, java.lang.String apStateName, ApplicationState apState)
onChange
in interface IEndPointStateChangeSubscriber
public static void calculatePendingRanges(TokenMetadata tm, AbstractReplicationStrategy strategy)
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 onDead(java.net.InetAddress endpoint, EndPointState state)
onDead
in interface IEndPointStateChangeSubscriber
public double getLoad()
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 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 forceTableCompaction() 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.net.InetAddress getPrimary(java.lang.String key)
key
- - key for which we need to find the endpoint
public java.net.InetAddress getPrimary(Token token)
public boolean isPrimary(java.lang.String key)
key
-
public java.util.List<java.net.InetAddress> getNaturalEndpoints(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> getNaturalEndpoints(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 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(Token token)
public java.util.Map<java.net.InetAddress,java.net.InetAddress> getHintedEndpointMap(java.lang.String key, java.util.List<java.net.InetAddress> naturalEndpoints)
key
- - key for which we need to find the endpoint return value -
the endpoint responsible for this keypublic java.net.InetAddress findSuitableEndPoint(java.lang.String key) throws java.io.IOException, UnavailableException
java.io.IOException
UnavailableException
public void setLog4jLevel(java.lang.String classQualifier, java.lang.String rawLevel)
StorageServiceMBean
setLog4jLevel
in interface StorageServiceMBean
public java.util.List<java.lang.String> getSplits(int splits)
splits:
- number of ranges to break into. Minimum 2.
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, int consistency_level)
public AbstractReplicationStrategy getReplicationStrategy()
public boolean isClientMode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |