org.apache.cassandra.service
Class StorageService

java.lang.Object
  extended by org.apache.cassandra.service.StorageService
All Implemented Interfaces:
IEndpointStateChangeSubscriber, StorageServiceMBean

public class StorageService
extends java.lang.Object
implements IEndpointStateChangeSubscriber, StorageServiceMBean


Nested Class Summary
static class StorageService.Verb
           
 
Field Summary
static StorageService instance
           
static DebuggableScheduledThreadPoolExecutor optionalTasks
          tasks that do not need to be waited for on shutdown/drain
static int RING_DELAY
           
static DebuggableScheduledThreadPoolExecutor scheduledTasks
          This pool is used for periodic short (sub-second) tasks.
static DebuggableScheduledThreadPoolExecutor tasks
          This pool is used by tasks that can have longer execution times, 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
protected  void addExpireTimeIfFound(java.net.InetAddress endpoint, long expireTime)
           
 void bulkLoad(java.lang.String directory)
           
static void calculatePendingRanges(AbstractReplicationStrategy strategy, java.lang.String table)
           
 void clearSnapshot(java.lang.String tag, java.lang.String... tableNames)
          Remove the snapshot with the given name from the given tables.
 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.
protected  long extractExpireTime(java.lang.String[] pieces)
           
 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.
 AntiEntropyService.RepairFuture forceTableRepair(Range range, java.lang.String tableName, java.lang.String... columnFamilies)
           
 void forceTableRepair(java.lang.String tableName, java.lang.String... columnFamilies)
          Trigger proactive repair for a table and column families.
 void forceTableRepairPrimaryRange(java.lang.String tableName, java.lang.String... columnFamilies)
          Triggers proactive repair but only for the node primary range.
 java.lang.String[] getAllDataFileLocations()
          Get the list of all data file locations from conf
 java.lang.String[] getAllDataFileLocationsForTable(java.lang.String table)
          Get the list of data file locations for a given table
 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
 java.lang.String getCommitLogLocation()
          Get location of the commit log
 int getCompactionThroughputMbPerSec()
           
 int getCurrentGenerationNumber()
          Return the generation value for this node.
 java.lang.String getDrainProgress()
          get the progress of a drain operation
 int getExceptionCount()
           
 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.lang.String> getMovingNodes()
          Retrieve the list of nodes currently moving in the ring.
 java.util.List<java.net.InetAddress> getNaturalEndpoints(java.lang.String table, java.nio.ByteBuffer key)
           
 java.util.List<java.net.InetAddress> getNaturalEndpoints(java.lang.String table, java.lang.String cf, 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)
 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 listen addresses.
 java.util.Map<Range,java.util.List<java.lang.String>> getRangeToRpcaddressMap(java.lang.String keyspace)
          for a keyspace, return the ranges and corresponding RPC addresses 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.lang.String getRpcaddress(java.net.InetAddress endpoint)
          Return the rpc address associated with an endpoint as a string.
 java.lang.String getSavedCachesLocation()
          Get location of the saved caches dir
 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 initClient(int delay)
           
 void initServer()
           
 void initServer(int delay)
           
 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 loadNewSSTables(java.lang.String ksName, java.lang.String cfName)
          #Load new SSTables to the given keyspace/columnFamily
 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 onRestart(java.net.InetAddress endpoint, EndpointState state)
          Called whenever a node is restarted.
 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 removeToken(java.lang.String tokenString, int delay)
           
 void requestGC()
           
 void rescheduleFailedDeletions()
           
 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 setCompactionThroughputMbPerSec(int value)
           
 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 takeSnapshot(java.lang.String tag, java.lang.String... tableNames)
          Takes the snapshot for the given tables.
 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

RING_DELAY

public static final int RING_DELAY
See Also:
Constant Field Values

VERBS

public static final StorageService.Verb[] VERBS

verbStages

public static final java.util.EnumMap<StorageService.Verb,Stage> verbStages

scheduledTasks

public static final DebuggableScheduledThreadPoolExecutor scheduledTasks
This pool is used for periodic short (sub-second) tasks.


tasks

public static final DebuggableScheduledThreadPoolExecutor tasks
This pool is used by tasks that can have longer execution times, and usually are non periodic.


optionalTasks

public static final DebuggableScheduledThreadPoolExecutor optionalTasks
tasks that do not need to be waited for on shutdown/drain


valueFactory

public VersionedValue.VersionedValueFactory valueFactory

instance

public static final StorageService instance
Constructor Detail

StorageService

public StorageService()
Method Detail

getPartitioner

public static IPartitioner getPartitioner()

getLocalRanges

public java.util.Collection<Range> getLocalRanges(java.lang.String table)

getLocalPrimaryRange

public Range getLocalPrimaryRange()

finishBootstrapping

public void finishBootstrapping()

setToken

public void setToken(Token token)
This method updates the local token on disk


registerDaemon

public void registerDaemon(CassandraDaemon daemon)

stopGossiping

public void stopGossiping()
Specified by:
stopGossiping in interface StorageServiceMBean

startGossiping

public void startGossiping()
Specified by:
startGossiping in interface StorageServiceMBean

startRPCServer

public void startRPCServer()
Specified by:
startRPCServer in interface StorageServiceMBean

stopRPCServer

public void stopRPCServer()
Specified by:
stopRPCServer in interface StorageServiceMBean

isRPCServerRunning

public boolean isRPCServerRunning()
Specified by:
isRPCServerRunning in interface StorageServiceMBean

stopClient

public void stopClient()

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface StorageServiceMBean

initClient

public void initClient()
                throws java.io.IOException,
                       ConfigurationException
Throws:
java.io.IOException
ConfigurationException

initClient

public void initClient(int delay)
                throws java.io.IOException,
                       ConfigurationException
Throws:
java.io.IOException
ConfigurationException

initServer

public void initServer()
                throws java.io.IOException,
                       ConfigurationException
Throws:
java.io.IOException
ConfigurationException

initServer

public void initServer(int delay)
                throws java.io.IOException,
                       ConfigurationException
Throws:
java.io.IOException
ConfigurationException

joinRing

public void joinRing()
              throws java.io.IOException,
                     ConfigurationException
Specified by:
joinRing in interface StorageServiceMBean
Throws:
java.io.IOException
ConfigurationException

isJoined

public boolean isJoined()
Specified by:
isJoined in interface StorageServiceMBean

getCompactionThroughputMbPerSec

public int getCompactionThroughputMbPerSec()
Specified by:
getCompactionThroughputMbPerSec in interface StorageServiceMBean

setCompactionThroughputMbPerSec

public void setCompactionThroughputMbPerSec(int value)
Specified by:
setCompactionThroughputMbPerSec in interface StorageServiceMBean

isBootstrapMode

public boolean isBootstrapMode()

getTokenMetadata

public TokenMetadata getTokenMetadata()

getRangeToEndpointMap

public java.util.Map<Range,java.util.List<java.lang.String>> getRangeToEndpointMap(java.lang.String keyspace)
for a keyspace, return the ranges and corresponding listen addresses.

Specified by:
getRangeToEndpointMap in interface StorageServiceMBean
Parameters:
keyspace -
Returns:

getRpcaddress

public java.lang.String getRpcaddress(java.net.InetAddress endpoint)
Return the rpc address associated with an endpoint as a string.

Parameters:
endpoint - The endpoint to get rpc address for
Returns:

getRangeToRpcaddressMap

public java.util.Map<Range,java.util.List<java.lang.String>> getRangeToRpcaddressMap(java.lang.String keyspace)
for a keyspace, return the ranges and corresponding RPC addresses for a given keyspace.

Specified by:
getRangeToRpcaddressMap in interface StorageServiceMBean
Parameters:
keyspace -
Returns:

getPendingRangeToEndpointMap

public java.util.Map<Range,java.util.List<java.lang.String>> getPendingRangeToEndpointMap(java.lang.String keyspace)
Description copied from interface: StorageServiceMBean
Retrieve a map of pending ranges to endpoints that describe the ring topology

Specified by:
getPendingRangeToEndpointMap in interface StorageServiceMBean
Parameters:
keyspace - the keyspace to get the pending range map for.
Returns:
a map of pending ranges to endpoints

getRangeToAddressMap

public java.util.Map<Range,java.util.List<java.net.InetAddress>> getRangeToAddressMap(java.lang.String keyspace)

getTokenToEndpointMap

public java.util.Map<Token,java.lang.String> getTokenToEndpointMap()
Description copied from interface: StorageServiceMBean
Retrieve a map of tokens to endpoints, including the bootstrapping ones.

Specified by:
getTokenToEndpointMap in interface StorageServiceMBean
Returns:
a map of tokens to endpoints

onChange

public void onChange(java.net.InetAddress endpoint,
                     ApplicationState state,
                     VersionedValue value)
Specified by:
onChange in interface IEndpointStateChangeSubscriber

addExpireTimeIfFound

protected void addExpireTimeIfFound(java.net.InetAddress endpoint,
                                    long expireTime)

extractExpireTime

protected long extractExpireTime(java.lang.String[] pieces)

calculatePendingRanges

public static void calculatePendingRanges(AbstractReplicationStrategy strategy,
                                          java.lang.String table)

onJoin

public void onJoin(java.net.InetAddress endpoint,
                   EndpointState epState)
Description copied from interface: IEndpointStateChangeSubscriber
Use to inform interested parties about the change in the state for specified endpoint

Specified by:
onJoin in interface IEndpointStateChangeSubscriber
Parameters:
endpoint - endpoint for which the state change occurred.
epState - state that actually changed for the above endpoint.

onAlive

public void onAlive(java.net.InetAddress endpoint,
                    EndpointState state)
Specified by:
onAlive in interface IEndpointStateChangeSubscriber

onRemove

public void onRemove(java.net.InetAddress endpoint)
Specified by:
onRemove in interface IEndpointStateChangeSubscriber

onDead

public void onDead(java.net.InetAddress endpoint,
                   EndpointState state)
Specified by:
onDead in interface IEndpointStateChangeSubscriber

onRestart

public void onRestart(java.net.InetAddress endpoint,
                      EndpointState state)
Description copied from interface: IEndpointStateChangeSubscriber
Called whenever a node is restarted. Note that there is no guarantee when that happens that the node was previously marked down. It will have only if state.isAlive() == false as state is from before the restarted node is marked up.

Specified by:
onRestart in interface IEndpointStateChangeSubscriber

getLoad

public double getLoad()
raw load value

Specified by:
getLoad in interface StorageServiceMBean

getLoadString

public java.lang.String getLoadString()
Description copied from interface: StorageServiceMBean
Human-readable load value

Specified by:
getLoadString in interface StorageServiceMBean

getLoadMap

public java.util.Map<java.lang.String,java.lang.String> getLoadMap()
Description copied from interface: StorageServiceMBean
Human-readable load value. Keys are IP addresses.

Specified by:
getLoadMap in interface StorageServiceMBean

deliverHints

public final 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


deliverHints

public final void deliverHints(java.lang.String host)
                        throws java.net.UnknownHostException
Description copied from interface: StorageServiceMBean
force hint delivery to an endpoint

Specified by:
deliverHints in interface StorageServiceMBean
Throws:
java.net.UnknownHostException

getLocalToken

public Token getLocalToken()

getToken

public java.lang.String getToken()
Description copied from interface: StorageServiceMBean
Fetch a string representation of the token.

Specified by:
getToken in interface StorageServiceMBean
Returns:
a string token

getReleaseVersion

public java.lang.String getReleaseVersion()
Description copied from interface: StorageServiceMBean
Fetch a string representation of the Cassandra version.

Specified by:
getReleaseVersion in interface StorageServiceMBean
Returns:
A string representation of the Cassandra version.

getLeavingNodes

public java.util.List<java.lang.String> getLeavingNodes()
Description copied from interface: StorageServiceMBean
Retrieve the list of nodes currently leaving the ring.

Specified by:
getLeavingNodes in interface StorageServiceMBean
Returns:
set of IP addresses, as Strings

getMovingNodes

public java.util.List<java.lang.String> getMovingNodes()
Description copied from interface: StorageServiceMBean
Retrieve the list of nodes currently moving in the ring.

Specified by:
getMovingNodes in interface StorageServiceMBean
Returns:
set of IP addresses, as Strings

getJoiningNodes

public java.util.List<java.lang.String> getJoiningNodes()
Description copied from interface: StorageServiceMBean
Retrieve the list of nodes currently bootstrapping into the ring.

Specified by:
getJoiningNodes in interface StorageServiceMBean
Returns:
set of IP addresses, as Strings

getLiveNodes

public java.util.List<java.lang.String> getLiveNodes()
Description copied from interface: StorageServiceMBean
Retrieve the list of live nodes in the cluster, where "liveness" is determined by the failure detector of the node being queried.

Specified by:
getLiveNodes in interface StorageServiceMBean
Returns:
set of IP addresses, as Strings

getUnreachableNodes

public java.util.List<java.lang.String> getUnreachableNodes()
Description copied from interface: StorageServiceMBean
Retrieve the list of unreachable nodes in the cluster, as determined by this node's failure detector.

Specified by:
getUnreachableNodes in interface StorageServiceMBean
Returns:
set of IP addresses, as Strings

getAllDataFileLocations

public java.lang.String[] getAllDataFileLocations()
Description copied from interface: StorageServiceMBean
Get the list of all data file locations from conf

Specified by:
getAllDataFileLocations in interface StorageServiceMBean
Returns:
String array of all locations

getAllDataFileLocationsForTable

public java.lang.String[] getAllDataFileLocationsForTable(java.lang.String table)
Description copied from interface: StorageServiceMBean
Get the list of data file locations for a given table

Specified by:
getAllDataFileLocationsForTable in interface StorageServiceMBean
Parameters:
table - the table to get locations for.
Returns:
String array of all locations

getCommitLogLocation

public java.lang.String getCommitLogLocation()
Description copied from interface: StorageServiceMBean
Get location of the commit log

Specified by:
getCommitLogLocation in interface StorageServiceMBean
Returns:
a string path

getSavedCachesLocation

public java.lang.String getSavedCachesLocation()
Description copied from interface: StorageServiceMBean
Get location of the saved caches dir

Specified by:
getSavedCachesLocation in interface StorageServiceMBean
Returns:
a string path

getCurrentGenerationNumber

public int getCurrentGenerationNumber()
Description copied from interface: StorageServiceMBean
Return the generation value for this node.

Specified by:
getCurrentGenerationNumber in interface StorageServiceMBean
Returns:
generation number

forceTableCleanup

public void forceTableCleanup(java.lang.String tableName,
                              java.lang.String... columnFamilies)
                       throws java.io.IOException,
                              java.util.concurrent.ExecutionException,
                              java.lang.InterruptedException
Description copied from interface: StorageServiceMBean
Trigger a cleanup of keys on a single keyspace

Specified by:
forceTableCleanup in interface StorageServiceMBean
Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

scrub

public void scrub(java.lang.String tableName,
                  java.lang.String... columnFamilies)
           throws java.io.IOException,
                  java.util.concurrent.ExecutionException,
                  java.lang.InterruptedException
Description copied from interface: StorageServiceMBean
Scrub (deserialize + reserialize at the latest version, skipping bad rows if any) the given keyspace. If columnFamilies array is empty, all CFs are scrubbed. Scrubbed CFs will be snapshotted first.

Specified by:
scrub in interface StorageServiceMBean
Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

forceTableCompaction

public void forceTableCompaction(java.lang.String tableName,
                                 java.lang.String... columnFamilies)
                          throws java.io.IOException,
                                 java.util.concurrent.ExecutionException,
                                 java.lang.InterruptedException
Description copied from interface: StorageServiceMBean
Forces major compaction of a single keyspace

Specified by:
forceTableCompaction in interface StorageServiceMBean
Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

invalidateKeyCaches

public void invalidateKeyCaches(java.lang.String tableName,
                                java.lang.String... columnFamilies)
                         throws java.io.IOException
Specified by:
invalidateKeyCaches in interface StorageServiceMBean
Throws:
java.io.IOException

invalidateRowCaches

public void invalidateRowCaches(java.lang.String tableName,
                                java.lang.String... columnFamilies)
                         throws java.io.IOException
Specified by:
invalidateRowCaches in interface StorageServiceMBean
Throws:
java.io.IOException

takeSnapshot

public void takeSnapshot(java.lang.String tag,
                         java.lang.String... tableNames)
                  throws java.io.IOException
Takes the snapshot for the given tables. A snapshot name must be specified.

Specified by:
takeSnapshot in interface StorageServiceMBean
Parameters:
tag - the tag given to the snapshot; may not be null or empty
tableNames - the name of the tables to snapshot; empty means "all."
Throws:
java.io.IOException

clearSnapshot

public void clearSnapshot(java.lang.String tag,
                          java.lang.String... tableNames)
                   throws java.io.IOException
Remove the snapshot with the given name from the given tables. If no tag is specified we will remove all snapshots.

Specified by:
clearSnapshot in interface StorageServiceMBean
Throws:
java.io.IOException

getValidColumnFamilies

public java.lang.Iterable<ColumnFamilyStore> getValidColumnFamilies(java.lang.String tableName,
                                                                    java.lang.String... cfNames)
                                                             throws java.io.IOException
Throws:
java.io.IOException

forceTableFlush

public void forceTableFlush(java.lang.String tableName,
                            java.lang.String... columnFamilies)
                     throws java.io.IOException,
                            java.util.concurrent.ExecutionException,
                            java.lang.InterruptedException
Flush all memtables for a table and column families.

Specified by:
forceTableFlush in interface StorageServiceMBean
Parameters:
tableName -
columnFamilies -
Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

forceTableRepair

public void forceTableRepair(java.lang.String tableName,
                             java.lang.String... columnFamilies)
                      throws java.io.IOException
Trigger proactive repair for a table and column families.

Specified by:
forceTableRepair in interface StorageServiceMBean
Parameters:
tableName -
columnFamilies -
Throws:
java.io.IOException

forceTableRepairPrimaryRange

public void forceTableRepairPrimaryRange(java.lang.String tableName,
                                         java.lang.String... columnFamilies)
                                  throws java.io.IOException
Description copied from interface: StorageServiceMBean
Triggers proactive repair but only for the node primary range.

Specified by:
forceTableRepairPrimaryRange in interface StorageServiceMBean
Throws:
java.io.IOException

forceTableRepair

public AntiEntropyService.RepairFuture forceTableRepair(Range range,
                                                        java.lang.String tableName,
                                                        java.lang.String... columnFamilies)
                                                 throws java.io.IOException
Throws:
java.io.IOException

getSuccessor

public java.net.InetAddress getSuccessor(java.net.InetAddress ep)

getPrimaryRangeForEndpoint

public Range getPrimaryRangeForEndpoint(java.net.InetAddress ep)
Get the primary range for the specified endpoint.

Parameters:
ep - endpoint we are interested in.
Returns:
range for the specified endpoint.

getAllRanges

public java.util.List<Range> getAllRanges(java.util.List<Token> sortedTokens)
Get all ranges that span the ring given a set of tokens. All ranges are in sorted order of ranges.

Returns:
ranges in sorted order

getNaturalEndpoints

public java.util.List<java.net.InetAddress> getNaturalEndpoints(java.lang.String table,
                                                                java.lang.String cf,
                                                                java.lang.String key)
This method returns the N endpoints that are responsible for storing the specified key i.e for replication.

Specified by:
getNaturalEndpoints in interface StorageServiceMBean
Parameters:
table - keyspace name also known as table
cf - Column family name
key - - key for which we need to find the endpoint return value - the endpoint responsible for this key

getNaturalEndpoints

public java.util.List<java.net.InetAddress> getNaturalEndpoints(java.lang.String table,
                                                                java.nio.ByteBuffer key)
Specified by:
getNaturalEndpoints in interface StorageServiceMBean

getNaturalEndpoints

public 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.

Parameters:
token - - token for which we need to find the endpoint return value - the endpoint responsible for this token

getLiveNaturalEndpoints

public 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.

Parameters:
key - - key for which we need to find the endpoint return value - the endpoint responsible for this key

getLiveNaturalEndpoints

public java.util.List<java.net.InetAddress> getLiveNaturalEndpoints(java.lang.String table,
                                                                    Token token)

setLog4jLevel

public void setLog4jLevel(java.lang.String classQualifier,
                          java.lang.String rawLevel)
Description copied from interface: StorageServiceMBean
set the logging level at runtime

Specified by:
setLog4jLevel in interface StorageServiceMBean

getSplits

public java.util.List<Token> getSplits(java.lang.String table,
                                       java.lang.String cfName,
                                       Range range,
                                       int keysPerSplit)
Returns:
list of Tokens (_not_ keys!) breaking up the data this node is responsible for into pieces of roughly keysPerSplit

getBootstrapToken

public Token getBootstrapToken()
return a token to which if a node bootstraps it will get about 1/2 of this node's range


decommission

public void decommission()
                  throws java.lang.InterruptedException
Description copied from interface: StorageServiceMBean
transfer this node's data to other machines and remove it from service.

Specified by:
decommission in interface StorageServiceMBean
Throws:
java.lang.InterruptedException

move

public void move(java.lang.String newToken)
          throws java.io.IOException,
                 java.lang.InterruptedException,
                 ConfigurationException
Specified by:
move in interface StorageServiceMBean
Parameters:
newToken - token to move this node to. This node will unload its data onto its neighbors, and bootstrap to the new token.
Throws:
java.io.IOException
java.lang.InterruptedException
ConfigurationException

getRemovalStatus

public java.lang.String getRemovalStatus()
Get the status of a token removal.

Specified by:
getRemovalStatus in interface StorageServiceMBean

forceRemoveCompletion

public void forceRemoveCompletion()
Force a remove operation to complete. This may be necessary if a remove operation blocks forever due to node/stream failure. removeToken() must be called first, this is a last resort measure. No further attempt will be made to restore replicas.

Specified by:
forceRemoveCompletion in interface StorageServiceMBean

removeToken

public void removeToken(java.lang.String tokenString)
Remove a node that has died, attempting to restore the replica count. If the node is alive, decommission should be attempted. If decommission fails, then removeToken should be called. If we fail while trying to restore the replica count, finally forceRemoveCompleteion should be called to forcibly remove the node without regard to replica count.

Specified by:
removeToken in interface StorageServiceMBean
Parameters:
tokenString - token for the node

removeToken

public void removeToken(java.lang.String tokenString,
                        int delay)

confirmReplication

public void confirmReplication(java.net.InetAddress node)

isClientMode

public boolean isClientMode()

requestGC

public void requestGC()

getOperationMode

public java.lang.String getOperationMode()
Description copied from interface: StorageServiceMBean
get the operational mode (leaving, joining, normal, decommissioned, client)

Specified by:
getOperationMode in interface StorageServiceMBean

getDrainProgress

public java.lang.String getDrainProgress()
Description copied from interface: StorageServiceMBean
get the progress of a drain operation

Specified by:
getDrainProgress in interface StorageServiceMBean

drain

public void drain()
           throws java.io.IOException,
                  java.lang.InterruptedException,
                  java.util.concurrent.ExecutionException
shuts node off to writes, empties memtables and the commit log.

Specified by:
drain in interface StorageServiceMBean
Throws:
java.io.IOException
java.lang.InterruptedException
java.util.concurrent.ExecutionException

truncate

public void truncate(java.lang.String keyspace,
                     java.lang.String columnFamily)
              throws org.apache.cassandra.thrift.UnavailableException,
                     java.util.concurrent.TimeoutException,
                     java.io.IOException
Description copied from interface: StorageServiceMBean
Truncates (deletes) the given columnFamily from the provided keyspace. Calling truncate results in actual deletion of all data in the cluster under the given columnFamily and it will fail unless all hosts are up. All data in the given column family will be deleted, but its definition will not be affected.

Specified by:
truncate in interface StorageServiceMBean
Parameters:
keyspace - The keyspace to delete from
columnFamily - The column family to delete data from.
Throws:
org.apache.cassandra.thrift.UnavailableException - if some of the hosts in the ring are down.
java.util.concurrent.TimeoutException
java.io.IOException

saveCaches

public void saveCaches()
                throws java.util.concurrent.ExecutionException,
                       java.lang.InterruptedException
Description copied from interface: StorageServiceMBean
save row and key caches

Specified by:
saveCaches in interface StorageServiceMBean
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

getOwnership

public java.util.Map<Token,java.lang.Float> getOwnership()
Description copied from interface: StorageServiceMBean
given a list of tokens (representing the nodes in the cluster), returns a mapping from "token -> %age of cluster owned by that token"

Specified by:
getOwnership in interface StorageServiceMBean

getKeyspaces

public java.util.List<java.lang.String> getKeyspaces()
Specified by:
getKeyspaces in interface StorageServiceMBean

updateSnitch

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
Description copied from interface: StorageServiceMBean
Change endpointsnitch class and dynamic-ness (and dynamic attributes) at runtime

Specified by:
updateSnitch in interface StorageServiceMBean
Parameters:
epSnitchClassName - the canonical path name for a class implementing IEndpointSnitch
dynamic - boolean that decides whether dynamicsnitch is used or not
dynamicUpdateInterval - integer, in ms (default 100)
dynamicResetInterval - integer, in ms (default 600,000)
dynamicBadnessThreshold - double, (default 0.0)
Throws:
ConfigurationException - classname not found on classpath

useEfficientCrossDCWrites

public boolean useEfficientCrossDCWrites()

flushLargestMemtables

public void flushLargestMemtables()
Flushes the two largest memtables by ops and by throughput


reduceCacheSizes

public void reduceCacheSizes()

bulkLoad

public void bulkLoad(java.lang.String directory)
Specified by:
bulkLoad in interface StorageServiceMBean

getExceptionCount

public int getExceptionCount()
Specified by:
getExceptionCount in interface StorageServiceMBean

rescheduleFailedDeletions

public void rescheduleFailedDeletions()
Specified by:
rescheduleFailedDeletions in interface StorageServiceMBean

loadNewSSTables

public void loadNewSSTables(java.lang.String ksName,
                            java.lang.String cfName)
#Load new SSTables to the given keyspace/columnFamily

Specified by:
loadNewSSTables in interface StorageServiceMBean
Parameters:
ksName - The parent keyspace name
cfName - The ColumnFamily name where SSTables belong


Copyright © 2011 The Apache Software Foundation