Class StorageService

  • All Implemented Interfaces:
    javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, IEndpointStateChangeSubscriber, StorageServiceMBean

    public class StorageService
    extends javax.management.NotificationBroadcasterSupport
    implements IEndpointStateChangeSubscriber, StorageServiceMBean
    This abstraction contains the token/identifier of this node on the identifier space. This token gets gossiped around. This class will also maintain histograms of the load information of other nodes in the cluster.
    • Field Detail

      • RING_DELAY_MILLIS

        public static final int RING_DELAY_MILLIS
      • SCHEMA_DELAY_MILLIS

        public static final int SCHEMA_DELAY_MILLIS
      • skipNotificationListeners

        public volatile boolean skipNotificationListeners
      • useStrictConsistency

        public static final boolean useStrictConsistency
    • Constructor Detail

      • StorageService

        public StorageService()
    • Method Detail

      • getOutOfRangeOperationCounts

        public java.util.Map<java.lang.String,​long[]> getOutOfRangeOperationCounts()
        Description copied from interface: StorageServiceMBean
        Get the per-keyspace counts of operations that the node has received for tokens outside its owned ranges. Represented as a Map<String, long[]>, keys are keyspace names and the values are the counts for read, write and paxos ops respectivly. e.g. keyspace_name -> [reads, writes, paxos].
        Specified by:
        getOutOfRangeOperationCounts in interface StorageServiceMBean
      • incOutOfRangeOperationCount

        public void incOutOfRangeOperationCount()
      • isInShutdownHook

        @Deprecated(since="3.10")
        public boolean isInShutdownHook()
        Deprecated.
        See CASSANDRA-12509
      • isShutdown

        public boolean isShutdown()
      • setIsShutdownUnsafeForTests

        public void setIsShutdownUnsafeForTests​(boolean isShutdown)
        for in-jvm dtest use - forces isShutdown to be set to whatever passed in.
      • getLocalReplicas

        public RangesAtEndpoint getLocalReplicas​(java.lang.String keyspaceName)
      • getLocalRanges

        public java.util.List<Range<Token>> getLocalRanges​(java.lang.String ks)
      • getLocalAndPendingRanges

        public java.util.List<Range<Token>> getLocalAndPendingRanges​(java.lang.String ks)
      • getNormalizedLocalRanges

        public OwnedRanges getNormalizedLocalRanges​(java.lang.String keyspaceName)
      • getPrimaryRanges

        public java.util.Collection<Range<Token>> getPrimaryRanges​(java.lang.String keyspace)
      • getPrimaryRangesWithinDC

        public java.util.Collection<Range<Token>> getPrimaryRangesWithinDC​(java.lang.String keyspace)
      • isSurveyMode

        public boolean isSurveyMode()
      • hasJoined

        public boolean hasJoined()
      • setTokens

        public void setTokens​(java.util.Collection<Token> tokens)
        This method updates the local token on disk
      • setGossipTokens

        public void setGossipTokens​(java.util.Collection<Token> tokens)
      • stopTransports

        public void stopTransports()
      • stopClient

        public void stopClient()
      • isGossipActive

        public boolean isGossipActive()
      • isDaemonSetupCompleted

        public boolean isDaemonSetupCompleted()
      • completeInitialization

        public void completeInitialization()
      • populateTokenMetadata

        public void populateTokenMetadata()
      • isReplacing

        public boolean isReplacing()
      • removeShutdownHook

        public void removeShutdownHook()
        In the event of forceful termination we need to remove the shutdown hook to prevent hanging (OOM for instance)
      • isSeed

        public static boolean isSeed()
      • startSnapshotManager

        public void startSnapshotManager()
      • waitForSchema

        public void waitForSchema​(long schemaTimeoutMillis,
                                  long ringTimeoutMillis)
      • joinTokenRing

        public void joinTokenRing​(boolean finishJoiningRing,
                                  boolean shouldBootstrap,
                                  long schemaTimeoutMillis,
                                  long bootstrapTimeoutMillis,
                                  long ringTimeoutMillis)
                           throws ConfigurationException
        Throws:
        ConfigurationException
      • isReplacingSameAddress

        public static boolean isReplacingSameAddress()
      • gossipSnitchInfo

        public void gossipSnitchInfo()
      • joinRing

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

        public void finishJoiningRing​(boolean didBootstrap,
                                      java.util.Collection<Token> tokens)
      • doAuthSetup

        public void doAuthSetup​(boolean setUpSchema)
      • isAuthSetupComplete

        public boolean isAuthSetupComplete()
      • authSetupCalled

        public boolean authSetupCalled()
      • setUpDistributedSystemKeyspaces

        public void setUpDistributedSystemKeyspaces()
      • rebuild

        public void rebuild​(java.lang.String sourceDc)
        Description copied from interface: StorageServiceMBean
        Initiate a process of streaming data for which we are responsible from other nodes. It is similar to bootstrap except meant to be used on a node which is already in the cluster (typically containing no data) as an alternative to running repair.
        Specified by:
        rebuild in interface StorageServiceMBean
        Parameters:
        sourceDc - Name of DC from which to select sources for streaming or null to pick any node
      • rebuild

        public void rebuild​(java.lang.String sourceDc,
                            java.lang.String keyspace,
                            java.lang.String tokens,
                            java.lang.String specificSources)
        Description copied from interface: StorageServiceMBean
        Same as StorageServiceMBean.rebuild(String), but only for specified keyspace and ranges.
        Specified by:
        rebuild in interface StorageServiceMBean
        Parameters:
        sourceDc - Name of DC from which to select sources for streaming or null to pick any node
        keyspace - Name of the keyspace which to rebuild or null to rebuild all keyspaces.
        tokens - Range of tokens to rebuild or null to rebuild all token ranges. In the format of: "(start_token_1,end_token_1],(start_token_2,end_token_2],...(start_token_n,end_token_n]"
        specificSources - list of sources that can be used for rebuilding. Must be other nodes in the cluster. The format of the string is comma separated values.
      • rebuild

        public void rebuild​(java.lang.String sourceDc,
                            java.lang.String keyspace,
                            java.lang.String tokens,
                            java.lang.String specificSources,
                            boolean excludeLocalDatacenterNodes)
        Description copied from interface: StorageServiceMBean
        Same as StorageServiceMBean.rebuild(String), but only for specified keyspace and ranges. It excludes local data center nodes
        Specified by:
        rebuild in interface StorageServiceMBean
        Parameters:
        sourceDc - Name of DC from which to select sources for streaming or null to pick any node
        keyspace - Name of the keyspace which to rebuild or null to rebuild all keyspaces.
        tokens - Range of tokens to rebuild or null to rebuild all token ranges. In the format of: "(start_token_1,end_token_1],(start_token_2,end_token_2],...(start_token_n,end_token_n]"
        specificSources - list of sources that can be used for rebuilding. Mostly other nodes in the cluster.
        excludeLocalDatacenterNodes - Flag to indicate whether local data center nodes should be excluded as sources for streaming.
      • getStreamThroughputMebibytesPerSec

        public int getStreamThroughputMebibytesPerSec()
        Description copied from interface: StorageServiceMBean
        Below method returns stream_throughput_outbound rounded, for precise number, please, use getStreamThroughputMebibytesPerSecAsDouble
        Specified by:
        getStreamThroughputMebibytesPerSec in interface StorageServiceMBean
        Returns:
        stream_throughput_outbound in MiB
      • getStreamThroughputMbPerSec

        @Deprecated(since="4.1")
        public int getStreamThroughputMbPerSec()
        Deprecated.
        See CASSANDRA-15234
        Specified by:
        getStreamThroughputMbPerSec in interface StorageServiceMBean
        Returns:
        stream_throughput_outbound in MiB
      • getStreamThroughputMbitPerSec

        @Deprecated(since="4.1")
        public int getStreamThroughputMbitPerSec()
        Deprecated.
        See CASSANDRA-17225
        Specified by:
        getStreamThroughputMbitPerSec in interface StorageServiceMBean
        Returns:
        stream_throughput_outbound in megabits
      • getInterDCStreamThroughputMbPerSec

        @Deprecated(since="4.1")
        public int getInterDCStreamThroughputMbPerSec()
        Deprecated.
        See CASSANDRA-15234
        Specified by:
        getInterDCStreamThroughputMbPerSec in interface StorageServiceMBean
        Returns:
        inter_dc_stream_throughput_outbound in MiB
      • getInterDCStreamThroughputMbitPerSec

        @Deprecated(since="4.1")
        public int getInterDCStreamThroughputMbitPerSec()
        Deprecated.
        See CASSANDRA-17225
        Specified by:
        getInterDCStreamThroughputMbitPerSec in interface StorageServiceMBean
        Returns:
        inter_dc_stream_throughput_outbound in megabits
      • getInterDCStreamThroughputMebibytesPerSec

        public int getInterDCStreamThroughputMebibytesPerSec()
        Description copied from interface: StorageServiceMBean
        Below method returns Inter_dc_stream_throughput_outbound rounded, for precise number, please, use getInterDCStreamThroughputMebibytesPerSecAsDouble
        Specified by:
        getInterDCStreamThroughputMebibytesPerSec in interface StorageServiceMBean
        Returns:
        inter_dc_stream_throughput_outbound in MiB
      • getCompactionThroughputMbPerSec

        @Deprecated(since="4.1")
        public int getCompactionThroughputMbPerSec()
        Deprecated.
        See CASSANDRA-17225
        Specified by:
        getCompactionThroughputMbPerSec in interface StorageServiceMBean
        Returns:
        compaction_throughgput in MiB
      • setMovingModeUnsafe

        public void setMovingModeUnsafe()
      • setNormalModeUnsafe

        public void setNormalModeUnsafe()
        Only used in jvm dtest when not using GOSSIP. See org.apache.cassandra.distributed.impl.Instance#startup(org.apache.cassandra.distributed.api.ICluster)
      • prepareForBootstrap

        public java.util.Collection<InetAddressAndPort> prepareForBootstrap​(long schemaTimeoutMillis,
                                                                            long ringTimeoutMillis)
      • bootstrap

        public boolean bootstrap​(java.util.Collection<Token> tokens,
                                 long bootstrapTimeoutMillis)
        Bootstrap node by fetching data from other nodes. If node is bootstrapping as a new node, then this also announces bootstrapping to the cluster. This blocks until streaming is done.
        Parameters:
        tokens - bootstrapping tokens
        Returns:
        true if bootstrap succeeds.
      • startBootstrap

        public Future<StreamState> startBootstrap​(java.util.Collection<Token> tokens,
                                                  boolean replacing)
      • resumeBootstrap

        public boolean resumeBootstrap()
        Description copied from interface: StorageServiceMBean
        Resume bootstrap streaming when there is failed data streaming.
        Specified by:
        resumeBootstrap in interface StorageServiceMBean
        Returns:
        true if the node successfully starts resuming. (this does not mean bootstrap streaming was success.)
      • getConcurrency

        public java.util.Map<java.lang.String,​java.util.List<java.lang.Integer>> getConcurrency​(java.util.List<java.lang.String> stageNames)
        Specified by:
        getConcurrency in interface StorageServiceMBean
      • setConcurrency

        public void setConcurrency​(java.lang.String threadPoolName,
                                   int newCorePoolSize,
                                   int newMaximumPoolSize)
        Description copied from interface: StorageServiceMBean
        Sets the concurrency setting for processing stages
        Specified by:
        setConcurrency in interface StorageServiceMBean
      • isBootstrapMode

        public boolean isBootstrapMode()
        Description copied from interface: StorageServiceMBean
        Check if currently bootstrapping. Note this becomes false before SystemKeyspace.bootstrapComplete() is called, as setting bootstrap to complete is called only when the node joins the ring.
        Specified by:
        isBootstrapMode in interface StorageServiceMBean
        Returns:
        True prior to bootstrap streaming completing. False prior to start of bootstrap and post streaming.
      • getRangeToEndpointMap

        public java.util.Map<java.util.List<java.lang.String>,​java.util.List<java.lang.String>> getRangeToEndpointMap​(java.lang.String keyspace)
        Description copied from interface: StorageServiceMBean
        Retrieve a map of range to end points that describe the ring topology of a Cassandra cluster.
        Specified by:
        getRangeToEndpointMap in interface StorageServiceMBean
        Returns:
        mapping of ranges to end points
      • getRangeToEndpointWithPortMap

        public java.util.Map<java.util.List<java.lang.String>,​java.util.List<java.lang.String>> getRangeToEndpointWithPortMap​(java.lang.String keyspace)
        Specified by:
        getRangeToEndpointWithPortMap in interface StorageServiceMBean
      • getRangeToEndpointMap

        public java.util.Map<java.util.List<java.lang.String>,​java.util.List<java.lang.String>> getRangeToEndpointMap​(java.lang.String keyspace,
                                                                                                                            boolean withPort)
        for a keyspace, return the ranges and corresponding listen addresses.
        Parameters:
        keyspace -
        Returns:
        the endpoint map
      • getNativeaddress

        public java.lang.String getNativeaddress​(InetAddressAndPort endpoint,
                                                 boolean withPort)
        Return the native address associated with an endpoint as a string.
        Parameters:
        endpoint - The endpoint to get rpc address for
        Returns:
        the native address
      • getRangeToRpcaddressMap

        public java.util.Map<java.util.List<java.lang.String>,​java.util.List<java.lang.String>> getRangeToRpcaddressMap​(java.lang.String keyspace)
        Description copied from interface: StorageServiceMBean
        Retrieve a map of range to rpc addresses that describe the ring topology of a Cassandra cluster.
        Specified by:
        getRangeToRpcaddressMap in interface StorageServiceMBean
        Returns:
        mapping of ranges to rpc addresses
      • getRangeToNativeaddressWithPortMap

        public java.util.Map<java.util.List<java.lang.String>,​java.util.List<java.lang.String>> getRangeToNativeaddressWithPortMap​(java.lang.String keyspace)
        Specified by:
        getRangeToNativeaddressWithPortMap in interface StorageServiceMBean
      • getPendingRangeToEndpointMap

        public java.util.Map<java.util.List<java.lang.String>,​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
      • getPendingRangeToEndpointWithPortMap

        public java.util.Map<java.util.List<java.lang.String>,​java.util.List<java.lang.String>> getPendingRangeToEndpointWithPortMap​(java.lang.String keyspace)
        Specified by:
        getPendingRangeToEndpointWithPortMap in interface StorageServiceMBean
      • getRangeToAddressMap

        public EndpointsByRange getRangeToAddressMap​(java.lang.String keyspace)
      • getRangeToAddressMapInLocalDC

        public EndpointsByRange getRangeToAddressMapInLocalDC​(java.lang.String keyspace)
      • describeRingJMX

        public java.util.List<java.lang.String> describeRingJMX​(java.lang.String keyspace)
                                                         throws java.io.IOException
        Description copied from interface: StorageServiceMBean
        The same as describeRing(String) but converts TokenRange to the String for JMX compatibility
        Specified by:
        describeRingJMX in interface StorageServiceMBean
        Parameters:
        keyspace - The keyspace to fetch information about
        Returns:
        a List of TokenRange(s) converted to String for the given keyspace
        Throws:
        java.io.IOException
      • describeRingWithPortJMX

        public java.util.List<java.lang.String> describeRingWithPortJMX​(java.lang.String keyspace)
                                                                 throws java.io.IOException
        Specified by:
        describeRingWithPortJMX in interface StorageServiceMBean
        Throws:
        java.io.IOException
      • describeRing

        public java.util.List<TokenRange> describeRing​(java.lang.String keyspace)
                                                throws InvalidRequestException
        The TokenRange for a given keyspace.
        Parameters:
        keyspace - The keyspace to fetch information about
        Returns:
        a List of TokenRange(s) for the given keyspace
        Throws:
        InvalidRequestException - if there is no ring information available about keyspace
      • getTokenToEndpointMap

        public java.util.Map<java.lang.String,​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 in ascending order
      • getLocalHostUUID

        public java.util.UUID getLocalHostUUID()
      • getHostIdMap

        public java.util.Map<java.lang.String,​java.lang.String> getHostIdMap()
      • updateTopology

        public void updateTopology()
      • setRpcReady

        public void setRpcReady​(boolean value)
        Set the RPC status. Because when draining a node we need to set the RPC status to not ready, and drain is called by the shutdown hook, it may be that value is false and there is no local endpoint state. In this case it's OK to just do nothing. Therefore, we assert that the local endpoint state is not null only when value is true.
        Parameters:
        value - - true indicates that RPC is ready, false indicates the opposite.
      • isReplacingSameHostAddressAndHostId

        public boolean isReplacingSameHostAddressAndHostId​(java.util.UUID hostId)
      • addExpireTimeIfFound

        protected void addExpireTimeIfFound​(InetAddressAndPort endpoint,
                                            long expireTime)
      • extractExpireTime

        protected long extractExpireTime​(java.lang.String[] pieces)
      • 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
      • getLocalTokens

        public java.util.Collection<Token> getLocalTokens()
      • getEndpointForHostId

        @Nullable
        public InetAddressAndPort getEndpointForHostId​(java.util.UUID hostId)
      • getHostIdForEndpoint

        @Nullable
        public java.util.UUID getHostIdForEndpoint​(InetAddressAndPort address)
      • getTokens

        public java.util.List<java.lang.String> getTokens()
        Description copied from interface: StorageServiceMBean
        Fetch string representations of the tokens for this node.
        Specified by:
        getTokens in interface StorageServiceMBean
        Returns:
        a collection of tokens formatted as strings
      • getTokens

        public java.util.List<java.lang.String> getTokens​(java.lang.String endpoint)
                                                   throws java.net.UnknownHostException
        Description copied from interface: StorageServiceMBean
        Fetch string representations of the tokens for a specified node.
        Specified by:
        getTokens in interface StorageServiceMBean
        Parameters:
        endpoint - string representation of an node
        Returns:
        a collection of tokens formatted as strings
        Throws:
        java.net.UnknownHostException
      • 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.
      • getGitSHA

        public java.lang.String getGitSHA()
        Description copied from interface: StorageServiceMBean
        Fetch a string representation of the Cassandra git SHA.
        Specified by:
        getGitSHA in interface StorageServiceMBean
        Returns:
        A string representation of the Cassandra git SHA.
      • getSchemaVersion

        public java.lang.String getSchemaVersion()
        Description copied from interface: StorageServiceMBean
        Fetch a string representation of the current Schema version.
        Specified by:
        getSchemaVersion in interface StorageServiceMBean
        Returns:
        A string representation of the Schema version.
      • getKeyspaceReplicationInfo

        public java.lang.String getKeyspaceReplicationInfo​(java.lang.String keyspaceName)
        Description copied from interface: StorageServiceMBean
        Fetch the replication factor for a given keyspace.
        Specified by:
        getKeyspaceReplicationInfo in interface StorageServiceMBean
        Returns:
        An integer that represents replication factor for the given keyspace.
      • getLeavingNodes

        @Deprecated(since="4.0")
        public java.util.List<java.lang.String> getLeavingNodes()
        Deprecated.
        See CASSANDRA-7544
        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

        @Deprecated(since="4.0")
        public java.util.List<java.lang.String> getMovingNodes()
        Deprecated.
        See CASSANDRA-7544
        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

        @Deprecated(since="4.0")
        public java.util.List<java.lang.String> getJoiningNodes()
        Deprecated.
        See CASSANDRA-7544
        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

        @Deprecated(since="4.0")
        public java.util.List<java.lang.String> getLiveNodes()
        Deprecated.
        See CASSANDRA-7544
        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
      • getLiveRingMembers

        public java.util.Set<InetAddressAndPort> getLiveRingMembers​(boolean excludeDeadStates)
      • getUnreachableNodes

        @Deprecated(since="4.0")
        public java.util.List<java.lang.String> getUnreachableNodes()
        Deprecated.
        See CASSANDRA-7544
        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
      • getLocalSystemKeyspacesDataFileLocations

        public java.lang.String[] getLocalSystemKeyspacesDataFileLocations()
        Description copied from interface: StorageServiceMBean
        Returns the locations where the local system keyspaces data should be stored.
        Specified by:
        getLocalSystemKeyspacesDataFileLocations in interface StorageServiceMBean
        Returns:
        the locations where the local system keyspaces data should be stored
      • getNonLocalSystemKeyspacesDataFileLocations

        public java.lang.String[] getNonLocalSystemKeyspacesDataFileLocations()
        Description copied from interface: StorageServiceMBean
        Returns the locations where should be stored the non system keyspaces data.
        Specified by:
        getNonLocalSystemKeyspacesDataFileLocations in interface StorageServiceMBean
        Returns:
        the locations where should be stored the non system keyspaces data
      • forceKeyspaceCleanup

        public int forceKeyspaceCleanup​(java.lang.String keyspaceName,
                                        java.lang.String... tables)
                                 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:
        forceKeyspaceCleanup in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • forceKeyspaceCleanup

        public int forceKeyspaceCleanup​(int jobs,
                                        java.lang.String keyspaceName,
                                        java.lang.String... tableNames)
                                 throws java.io.IOException,
                                        java.util.concurrent.ExecutionException,
                                        java.lang.InterruptedException
        Specified by:
        forceKeyspaceCleanup in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • scrub

        public int scrub​(boolean disableSnapshot,
                         boolean skipCorrupted,
                         boolean checkData,
                         boolean reinsertOverflowedTTL,
                         int jobs,
                         java.lang.String keyspaceName,
                         java.lang.String... tableNames)
                  throws java.io.IOException,
                         java.util.concurrent.ExecutionException,
                         java.lang.InterruptedException
        Specified by:
        scrub in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • scrub

        public int scrub​(boolean disableSnapshot,
                         IScrubber.Options options,
                         int jobs,
                         java.lang.String keyspaceName,
                         java.lang.String... tableNames)
                  throws java.io.IOException,
                         java.util.concurrent.ExecutionException,
                         java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • verify

        @Deprecated(since="4.0")
        public int verify​(boolean extendedVerify,
                          java.lang.String keyspaceName,
                          java.lang.String... tableNames)
                   throws java.io.IOException,
                          java.util.concurrent.ExecutionException,
                          java.lang.InterruptedException
        Deprecated.
        See CASSANDRA-14201
        Description copied from interface: StorageServiceMBean
        Verify (checksums of) the given keyspace. If tableNames array is empty, all CFs are verified. The entire sstable will be read to ensure each cell validates if extendedVerify is true
        Specified by:
        verify in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • verify

        public int verify​(boolean extendedVerify,
                          boolean checkVersion,
                          boolean diskFailurePolicy,
                          boolean mutateRepairStatus,
                          boolean checkOwnsTokens,
                          boolean quick,
                          java.lang.String keyspaceName,
                          java.lang.String... tableNames)
                   throws java.io.IOException,
                          java.util.concurrent.ExecutionException,
                          java.lang.InterruptedException
        Specified by:
        verify in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • upgradeSSTables

        public int upgradeSSTables​(java.lang.String keyspaceName,
                                   boolean excludeCurrentVersion,
                                   java.lang.String... tableNames)
                            throws java.io.IOException,
                                   java.util.concurrent.ExecutionException,
                                   java.lang.InterruptedException
        Description copied from interface: StorageServiceMBean
        Rewrite all sstables to the latest version. Unlike scrub, it doesn't skip bad rows and do not snapshot sstables first.
        Specified by:
        upgradeSSTables in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • upgradeSSTables

        public int upgradeSSTables​(java.lang.String keyspaceName,
                                   boolean skipIfCurrentVersion,
                                   long skipIfNewerThanTimestamp,
                                   int jobs,
                                   java.lang.String... tableNames)
                            throws java.io.IOException,
                                   java.util.concurrent.ExecutionException,
                                   java.lang.InterruptedException
        Specified by:
        upgradeSSTables in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • recompressSSTables

        public int recompressSSTables​(java.lang.String keyspaceName,
                                      int jobs,
                                      java.lang.String... tableNames)
                               throws java.io.IOException,
                                      java.util.concurrent.ExecutionException,
                                      java.lang.InterruptedException
        Specified by:
        recompressSSTables in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • rewriteSSTables

        public int rewriteSSTables​(java.lang.String keyspaceName,
                                   boolean skipIfCurrentVersion,
                                   long skipIfNewerThanTimestamp,
                                   boolean skipIfCompressionMatches,
                                   int jobs,
                                   java.lang.String... tableNames)
                            throws java.io.IOException,
                                   java.util.concurrent.ExecutionException,
                                   java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • getPreparedStatements

        public java.util.List<Pair<java.lang.String,​java.lang.String>> getPreparedStatements()
      • dropPreparedStatements

        public void dropPreparedStatements​(boolean memoryOnly)
      • forceKeyspaceCompaction

        public void forceKeyspaceCompaction​(boolean splitOutput,
                                            java.lang.String keyspaceName,
                                            java.lang.String... tableNames)
                                     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:
        forceKeyspaceCompaction in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • relocateSSTables

        public int relocateSSTables​(java.lang.String keyspaceName,
                                    java.lang.String... tableNames)
                             throws java.io.IOException,
                                    java.util.concurrent.ExecutionException,
                                    java.lang.InterruptedException
        Specified by:
        relocateSSTables in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • relocateSSTables

        public int relocateSSTables​(int jobs,
                                    java.lang.String keyspaceName,
                                    java.lang.String... tableNames)
                             throws java.io.IOException,
                                    java.util.concurrent.ExecutionException,
                                    java.lang.InterruptedException
        Specified by:
        relocateSSTables in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • garbageCollect

        public int garbageCollect​(java.lang.String tombstoneOptionString,
                                  int jobs,
                                  java.lang.String keyspaceName,
                                  java.lang.String... tableNames)
                           throws java.io.IOException,
                                  java.util.concurrent.ExecutionException,
                                  java.lang.InterruptedException
        Description copied from interface: StorageServiceMBean
        Rewrites all sstables from the given tables to remove deleted data. The tombstone option defines the granularity of the procedure: ROW removes deleted partitions and rows, CELL also removes overwritten or deleted cells.
        Specified by:
        garbageCollect in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • takeSnapshot

        public void takeSnapshot​(java.lang.String tag,
                                 java.util.Map<java.lang.String,​java.lang.String> options,
                                 java.lang.String... entities)
                          throws java.io.IOException
        Takes the snapshot of a multiple column family from different keyspaces. 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
        options - Map of options (skipFlush is the only supported option for now)
        entities - list of keyspaces / tables in the form of empty | ks1 ks2 ... | ks1.cf1,ks2.cf2,...
        Throws:
        java.io.IOException
      • takeTableSnapshot

        public void takeTableSnapshot​(java.lang.String keyspaceName,
                                      java.lang.String tableName,
                                      java.lang.String tag)
                               throws java.io.IOException
        Takes the snapshot of a specific table. A snapshot name must be specified.
        Specified by:
        takeTableSnapshot in interface StorageServiceMBean
        Parameters:
        keyspaceName - the keyspace which holds the specified table
        tableName - the table to snapshot
        tag - the tag given to the snapshot; may not be null or empty
        Throws:
        java.io.IOException
      • forceKeyspaceCompactionForTokenRange

        public void forceKeyspaceCompactionForTokenRange​(java.lang.String keyspaceName,
                                                         java.lang.String startToken,
                                                         java.lang.String endToken,
                                                         java.lang.String... tableNames)
                                                  throws java.io.IOException,
                                                         java.util.concurrent.ExecutionException,
                                                         java.lang.InterruptedException
        Description copied from interface: StorageServiceMBean
        Forces major compaction of specified token range in a single keyspace.
        Specified by:
        forceKeyspaceCompactionForTokenRange in interface StorageServiceMBean
        Parameters:
        keyspaceName - the name of the keyspace to be compacted
        startToken - the token at which the compaction range starts (inclusive)
        endToken - the token at which compaction range ends (inclusive)
        tableNames - the names of the tables to be compacted
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • forceKeyspaceCompactionForPartitionKey

        public void forceKeyspaceCompactionForPartitionKey​(java.lang.String keyspaceName,
                                                           java.lang.String partitionKey,
                                                           java.lang.String... tableNames)
                                                    throws java.io.IOException,
                                                           java.util.concurrent.ExecutionException,
                                                           java.lang.InterruptedException
        Description copied from interface: StorageServiceMBean
        Forces major compactions for the range represented by the partition key
        Specified by:
        forceKeyspaceCompactionForPartitionKey in interface StorageServiceMBean
        Throws:
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • forceCompactionKeysIgnoringGcGrace

        public void forceCompactionKeysIgnoringGcGrace​(java.lang.String keyspaceName,
                                                       java.lang.String tableName,
                                                       java.lang.String... partitionKeysIgnoreGcGrace)
                                                throws java.io.IOException,
                                                       java.util.concurrent.ExecutionException,
                                                       java.lang.InterruptedException
        Forces compaction for a list of partition keys in a table The method will ignore the gc_grace_seconds for the partitionKeysIgnoreGcGrace during the comapction, in order to purge the tombstones and free up space quicker.
        Specified by:
        forceCompactionKeysIgnoringGcGrace in interface StorageServiceMBean
        Parameters:
        keyspaceName - keyspace name
        tableName - table name
        partitionKeysIgnoreGcGrace - partition keys ignoring the gc_grace_seconds
        Throws:
        java.io.IOException - on any I/O operation error
        java.util.concurrent.ExecutionException - when attempting to retrieve the result of a task that aborted by throwing an exception
        java.lang.InterruptedException - when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity
      • takeSnapshot

        public void takeSnapshot​(java.lang.String tag,
                                 java.lang.String... keyspaceNames)
                          throws java.io.IOException
        Takes the snapshot for the given keyspaces. 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
        keyspaceNames - the names of the keyspaces to snapshot; empty means "all."
        Throws:
        java.io.IOException
      • takeMultipleTableSnapshot

        public void takeMultipleTableSnapshot​(java.lang.String tag,
                                              java.lang.String... tableList)
                                       throws java.io.IOException
        Takes the snapshot of a multiple column family from different keyspaces. A snapshot name must be specified.
        Specified by:
        takeMultipleTableSnapshot in interface StorageServiceMBean
        Parameters:
        tag - the tag given to the snapshot; may not be null or empty
        tableList - list of tables from different keyspace in the form of ks1.cf1 ks2.cf2
        Throws:
        java.io.IOException
      • clearSnapshot

        public void clearSnapshot​(java.lang.String tag,
                                  java.lang.String... keyspaceNames)
        Remove the snapshot with the given name from the given keyspaces. If no tag is specified we will remove all snapshots.
        Specified by:
        clearSnapshot in interface StorageServiceMBean
        Parameters:
        tag - name of snapshot to clear, if null or empty string, all snapshots of given keyspace will be cleared
        keyspaceNames - name of keyspaces to clear snapshots for
      • clearSnapshot

        public void clearSnapshot​(java.util.Map<java.lang.String,​java.lang.Object> options,
                                  java.lang.String tag,
                                  java.lang.String... keyspaceNames)
        Description copied from interface: StorageServiceMBean
        Remove the snapshot with the given name from the given keyspaces. If no tag is specified we will remove all snapshots.
        Specified by:
        clearSnapshot in interface StorageServiceMBean
        Parameters:
        options - map of options for cleanup operation, consult nodetool's ClearSnapshot
        tag - name of snapshot to clear, if null or empty string, all snapshots of given keyspace will be cleared
        keyspaceNames - name of keyspaces to clear snapshots for
      • getSnapshotDetails

        public java.util.Map<java.lang.String,​javax.management.openmbean.TabularData> getSnapshotDetails​(java.util.Map<java.lang.String,​java.lang.String> options)
        Description copied from interface: StorageServiceMBean
        Get the details of all the snapshots
        Specified by:
        getSnapshotDetails in interface StorageServiceMBean
        Parameters:
        options - map of options used for filtering of snapshots
        Returns:
        A map of snapshotName to all its details in Tabular form.
      • getSnapshotDetails

        @Deprecated(since="4.1")
        public java.util.Map<java.lang.String,​javax.management.openmbean.TabularData> getSnapshotDetails()
        Deprecated.
        See CASSANDRA-16789
        Description copied from interface: StorageServiceMBean
        Get the details of all the snapshot
        Specified by:
        getSnapshotDetails in interface StorageServiceMBean
        Returns:
        A map of snapshotName to all its details in Tabular form.
      • trueSnapshotsSize

        public long trueSnapshotsSize()
        Description copied from interface: StorageServiceMBean
        Get the true size taken by all snapshots across all keyspaces.
        Specified by:
        trueSnapshotsSize in interface StorageServiceMBean
        Returns:
        True size taken by all the snapshots.
      • setSnapshotLinksPerSecond

        public void setSnapshotLinksPerSecond​(long throttle)
        Description copied from interface: StorageServiceMBean
        Set the current hardlink-per-second throttle for snapshots A setting of zero indicates no throttling
        Specified by:
        setSnapshotLinksPerSecond in interface StorageServiceMBean
      • getSnapshotLinksPerSecond

        public long getSnapshotLinksPerSecond()
        Description copied from interface: StorageServiceMBean
        Get the current hardlink-per-second throttle for snapshots A setting of zero indicates no throttling.
        Specified by:
        getSnapshotLinksPerSecond in interface StorageServiceMBean
        Returns:
        snapshot links-per-second throttle
      • refreshSizeEstimates

        public void refreshSizeEstimates()
                                  throws java.util.concurrent.ExecutionException
        Description copied from interface: StorageServiceMBean
        Forces refresh of values stored in system.size_estimates of all column families.
        Specified by:
        refreshSizeEstimates in interface StorageServiceMBean
        Throws:
        java.util.concurrent.ExecutionException
      • getValidColumnFamilies

        public java.lang.Iterable<ColumnFamilyStore> getValidColumnFamilies​(boolean allowIndexes,
                                                                            boolean autoAddIndexes,
                                                                            java.lang.String keyspaceName,
                                                                            java.lang.String... cfNames)
        Parameters:
        allowIndexes - Allow index CF names to be passed in
        autoAddIndexes - Automatically add secondary indexes if a CF has them
        keyspaceName - keyspace
        cfNames - CFs
        Throws:
        java.lang.IllegalArgumentException - when given CF name does not exist
      • forceKeyspaceFlush

        public void forceKeyspaceFlush​(java.lang.String keyspaceName,
                                       java.lang.String... tableNames)
                                throws java.io.IOException
        Flush all memtables for a keyspace and column families.
        Specified by:
        forceKeyspaceFlush in interface StorageServiceMBean
        Parameters:
        keyspaceName -
        tableNames -
        Throws:
        java.io.IOException
      • forceKeyspaceFlush

        public void forceKeyspaceFlush​(java.lang.String keyspaceName,
                                       ColumnFamilyStore.FlushReason reason)
                                throws java.io.IOException
        Flush all memtables for a keyspace and column families.
        Parameters:
        keyspaceName -
        Throws:
        java.io.IOException
      • repairAsync

        public int repairAsync​(java.lang.String keyspace,
                               java.util.Map<java.lang.String,​java.lang.String> repairSpec)
        Description copied from interface: StorageServiceMBean
        Invoke repair asynchronously. You can track repair progress by subscribing JMX notification sent from this StorageServiceMBean. Notification format is: type: "repair" userObject: int array of length 2, [0]=command number, [1]=ordinal of ActiveRepairService.Status
        Specified by:
        repairAsync in interface StorageServiceMBean
        Parameters:
        keyspace - Keyspace name to repair. Should not be null.
        repairSpec - repair option.
        Returns:
        Repair command number, or 0 if nothing to repair
      • repair

        public Pair<java.lang.Integer,​Future<?>> repair​(java.lang.String keyspace,
                                                              java.util.Map<java.lang.String,​java.lang.String> repairSpec,
                                                              java.util.List<ProgressListener> listeners)
      • startRepairPaxosForTopologyChange

        public Future<?> startRepairPaxosForTopologyChange​(java.lang.String reason)
      • autoRepairPaxos

        public Future<?> autoRepairPaxos​(TableId tableId)
      • getParentRepairStatus

        @Nullable
        public java.util.List<java.lang.String> getParentRepairStatus​(int cmd)
        Description copied from interface: StorageServiceMBean
        Get the status of a given parent repair session.
        Specified by:
        getParentRepairStatus in interface StorageServiceMBean
        Parameters:
        cmd - the int reference returned when issuing the repair
        Returns:
        status of parent repair from enum ActiveRepairService.ParentRepairStatus followed by final message or messages of the session
      • getPrimaryRangeForEndpointWithinDC

        public java.util.Collection<Range<Token>> getPrimaryRangeForEndpointWithinDC​(java.lang.String keyspace,
                                                                                     InetAddressAndPort referenceEndpoint)
        Get the "primary ranges" within local DC for the specified keyspace and endpoint.
        Parameters:
        keyspace - Keyspace name to check primary ranges
        referenceEndpoint - endpoint we are interested in.
        Returns:
        primary ranges within local DC for the specified endpoint.
        See Also:
        getPrimaryRangesForEndpoint(String, InetAddressAndPort)
      • getLocalPrimaryRange

        public java.util.Collection<Range<Token>> getLocalPrimaryRange()
      • getLocalPrimaryRangeForEndpoint

        public java.util.Collection<Range<Token>> getLocalPrimaryRangeForEndpoint​(InetAddressAndPort referenceEndpoint)
      • getAllRanges

        public java.util.List<Range<Token>> 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

        @Deprecated(since="4.0")
        public java.util.List<java.net.InetAddress> getNaturalEndpoints​(java.lang.String keyspaceName,
                                                                        java.lang.String cf,
                                                                        java.lang.String key)
        Deprecated.
        See CASSANDRA-7544
        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:
        keyspaceName - keyspace name also known as keyspace
        cf - Column family name
        key - key for which we need to find the endpoint
        Returns:
        the endpoint responsible for this key
      • getNaturalEndpointsWithPort

        public java.util.List<java.lang.String> getNaturalEndpointsWithPort​(java.lang.String keyspaceName,
                                                                            java.lang.String cf,
                                                                            java.lang.String key)
        Specified by:
        getNaturalEndpointsWithPort in interface StorageServiceMBean
      • getNaturalEndpoints

        @Deprecated(since="4.0")
        public java.util.List<java.net.InetAddress> getNaturalEndpoints​(java.lang.String keyspaceName,
                                                                        java.nio.ByteBuffer key)
        Deprecated.
        See CASSANDRA-7544
        Specified by:
        getNaturalEndpoints in interface StorageServiceMBean
      • getNaturalEndpointsWithPort

        public java.util.List<java.lang.String> getNaturalEndpointsWithPort​(java.lang.String keyspaceName,
                                                                            java.nio.ByteBuffer key)
        Specified by:
        getNaturalEndpointsWithPort in interface StorageServiceMBean
      • getNaturalReplicasForToken

        public EndpointsForToken getNaturalReplicasForToken​(java.lang.String keyspaceName,
                                                            java.lang.String cf,
                                                            java.lang.String key)
      • getNaturalReplicasForToken

        public EndpointsForToken getNaturalReplicasForToken​(java.lang.String keyspaceName,
                                                            java.nio.ByteBuffer key)
      • getKeyFromPartition

        public DecoratedKey getKeyFromPartition​(java.lang.String keyspaceName,
                                                java.lang.String table,
                                                java.lang.String partitionKey)
      • getToken

        public java.lang.String getToken​(java.lang.String keyspaceName,
                                         java.lang.String table,
                                         java.lang.String key)
        Specified by:
        getToken in interface StorageServiceMBean
      • isEndpointValidForWrite

        public boolean isEndpointValidForWrite​(java.lang.String keyspace,
                                               Token token)
      • setLoggingLevel

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

        If both classQualifer and level are empty/null, it will reload the configuration to reset.
        If classQualifer is not empty but level is empty/null, it will set the level to null for the defined classQualifer
        If level cannot be parsed, then the level will be defaulted to DEBUG

        The logback configuration should have < jmxConfigurator /> set
        Specified by:
        setLoggingLevel in interface StorageServiceMBean
        Parameters:
        classQualifier - The logger's classQualifer
        rawLevel - The log level
        Throws:
        java.lang.Exception
        See Also:
        Level.toLevel(String)
      • getLoggingLevels

        public java.util.Map<java.lang.String,​java.lang.String> getLoggingLevels()
        Description copied from interface: StorageServiceMBean
        get the runtime logging levels
        Specified by:
        getLoggingLevels in interface StorageServiceMBean
        Returns:
        the runtime logging levels for all the configured loggers
      • getSplits

        public java.util.List<Pair<Range<Token>,​java.lang.Long>> getSplits​(java.lang.String keyspaceName,
                                                                                 java.lang.String cfName,
                                                                                 Range<Token> range,
                                                                                 int keysPerSplit)
        Returns:
        list of Token ranges (_not_ keys!) together with estimated key count, breaking up the data this node is responsible for into pieces of roughly keysPerSplit
      • decommission

        public void decommission​(boolean force)
                          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
        Parameters:
        force - Decommission even if this will reduce N to be less than RF.
        Throws:
        java.lang.InterruptedException
      • prepareUnbootstrapStreaming

        public java.util.function.Supplier<Future<StreamState>> prepareUnbootstrapStreaming()
      • move

        public void move​(java.lang.String newToken)
                  throws java.io.IOException
        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
      • 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. removeNode() 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
      • removeNode

        public void removeNode​(java.lang.String hostIdString)
        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 removeNode 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:
        removeNode in interface StorageServiceMBean
        Parameters:
        hostIdString - Host ID for the node
      • isMoving

        public boolean isMoving()
      • isJoining

        public boolean isJoining()
      • isNormal

        public boolean isNormal()
      • isDecommissioned

        public boolean isDecommissioned()
      • isDecommissionFailed

        public boolean isDecommissionFailed()
        Description copied from interface: StorageServiceMBean
        Returns whether a node has failed to decommission. The fact that this method returns false does not mean that there was an attempt to decommission this node which was successful.
        Specified by:
        isDecommissionFailed in interface StorageServiceMBean
        Returns:
        true if decommission of this node has failed, false otherwise
      • isDecommissioning

        public boolean isDecommissioning()
        Description copied from interface: StorageServiceMBean
        Returns whether a node is being decommissioned or not.
        Specified by:
        isDecommissioning in interface StorageServiceMBean
        Returns:
        true if this node is decommissioning, false otherwise
      • isBootstrapFailed

        public boolean isBootstrapFailed()
        Description copied from interface: StorageServiceMBean
        Returns whether a node has failed to bootstrap. The fact that this method returns false does not mean that there was an attempt to bootstrap this node which was successful.
        Specified by:
        isBootstrapFailed in interface StorageServiceMBean
        Returns:
        true if bootstrap of this node has failed, false otherwise
      • 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
      • drain

        protected void drain​(boolean isFinalShutdown)
                      throws java.io.IOException,
                             java.lang.InterruptedException,
                             java.util.concurrent.ExecutionException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • disableAutoCompaction

        public void disableAutoCompaction()
      • addPreShutdownHook

        public boolean addPreShutdownHook​(java.lang.Runnable hook)
        Add a runnable which will be called before shut down or drain. This is useful for other applications running in the same JVM which may want to shut down first rather than time out attempting to use Cassandra calls which will no longer work.
        Parameters:
        hook - the code to run
        Returns:
        true on success, false if Cassandra is already shutting down, in which case the runnable has NOT been added.
      • removePreShutdownHook

        public boolean removePreShutdownHook​(java.lang.Runnable hook)
        Remove a preshutdown hook
      • addPostShutdownHook

        public boolean addPostShutdownHook​(java.lang.Runnable hook)
        Add a runnable which will be called after shutdown or drain. This is useful for other applications running in the same JVM that Cassandra needs to work and should shut down later.
        Parameters:
        hook - the code to run
        Returns:
        true on success, false if Cassandra is already shutting down, in which case the runnable has NOT been added.
      • removePostShutdownHook

        public boolean removePostShutdownHook​(java.lang.Runnable hook)
        Remove a postshutdownhook
      • truncate

        public void truncate​(java.lang.String keyspace,
                             java.lang.String table)
                      throws java.util.concurrent.TimeoutException,
                             java.io.IOException
        Description copied from interface: StorageServiceMBean
        Truncates (deletes) the given table from the provided keyspace. Calling truncate results in actual deletion of all data in the cluster under the given table 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
        table - The column family to delete data from.
        Throws:
        java.util.concurrent.TimeoutException
        java.io.IOException
      • getOwnership

        public java.util.Map<java.net.InetAddress,​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
      • effectiveOwnership

        public java.util.LinkedHashMap<java.net.InetAddress,​java.lang.Float> effectiveOwnership​(java.lang.String keyspace)
                                                                                               throws java.lang.IllegalStateException
        Description copied from interface: StorageServiceMBean
        Effective ownership is % of the data each node owns given the keyspace we calculate the percentage using replication factor. If Keyspace == null, this method will try to verify if all the keyspaces in the cluster have the same replication strategies and if yes then we will use the first else a empty Map is returned.
        Specified by:
        effectiveOwnership in interface StorageServiceMBean
        Throws:
        java.lang.IllegalStateException
      • effectiveOwnershipWithPort

        public java.util.LinkedHashMap<java.lang.String,​java.lang.Float> effectiveOwnershipWithPort​(java.lang.String keyspace)
                                                                                                   throws java.lang.IllegalStateException
        Specified by:
        effectiveOwnershipWithPort in interface StorageServiceMBean
        Throws:
        java.lang.IllegalStateException
      • getViewBuildStatuses

        public java.util.Map<java.lang.String,​java.lang.String> getViewBuildStatuses​(java.lang.String keyspace,
                                                                                           java.lang.String view,
                                                                                           boolean withPort)
      • getViewBuildStatuses

        public java.util.Map<java.lang.String,​java.lang.String> getViewBuildStatuses​(java.lang.String keyspace,
                                                                                           java.lang.String view)
        Specified by:
        getViewBuildStatuses in interface StorageServiceMBean
      • getViewBuildStatusesWithPort

        public java.util.Map<java.lang.String,​java.lang.String> getViewBuildStatusesWithPort​(java.lang.String keyspace,
                                                                                                   java.lang.String view)
        Specified by:
        getViewBuildStatusesWithPort 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 java.lang.ClassNotFoundException
        Description copied from interface: StorageServiceMBean
        Change endpointsnitch class and dynamic-ness (and dynamic attributes) at runtime. This method is used to change the snitch implementation and/or dynamic snitch parameters. If epSnitchClassName is specified, it will configure a new snitch instance and make it a 'dynamic snitch' if dynamic is specified and true. The parameters dynamicUpdateInterval, dynamicResetInterval and dynamicBadnessThreshold can be specified individually to update the parameters of the dynamic snitch during 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 - only valid, if epSnitchClassName is specified
        dynamicUpdateInterval - integer, in ms (defaults to the value configured in cassandra.yaml, which defaults to 100)
        dynamicResetInterval - integer, in ms (defaults to the value configured in cassandra.yaml, which defaults to 600,000)
        dynamicBadnessThreshold - double, (defaults to the value configured in cassandra.yaml, which defaults to 0.0)
        Throws:
        java.lang.ClassNotFoundException
      • bulkLoadAsync

        public java.lang.String bulkLoadAsync​(java.lang.String directory)
        Description copied from interface: StorageServiceMBean
        Starts a bulk load asynchronously and returns the String representation of the planID for the new streaming session.
        Specified by:
        bulkLoadAsync in interface StorageServiceMBean
      • loadNewSSTables

        @Deprecated(since="4.0")
        public void loadNewSSTables​(java.lang.String ksName,
                                    java.lang.String cfName)
        Deprecated.
        See CASSANDRA-14417
        Description copied from interface: StorageServiceMBean
        Load new SSTables to the given keyspace/table
        Specified by:
        loadNewSSTables in interface StorageServiceMBean
        Parameters:
        ksName - The parent keyspace name
        cfName - The ColumnFamily name where SSTables belong
        See Also:
        ColumnFamilyStoreMBean.loadNewSSTables()
      • sampleKeyRange

        public java.util.List<java.lang.String> sampleKeyRange()
        #Return a List of Tokens representing a sample of keys across all ColumnFamilyStores. Note: this should be left as an operation, not an attribute (methods starting with "get") to avoid sending potentially multiple MB of data when accessing this mbean by default. See CASSANDRA-4452.
        Specified by:
        sampleKeyRange in interface StorageServiceMBean
        Returns:
        set of Tokens as Strings
      • samplePartitions

        public java.util.Map<java.lang.String,​java.util.List<javax.management.openmbean.CompositeData>> samplePartitions​(int duration,
                                                                                                                               int capacity,
                                                                                                                               int count,
                                                                                                                               java.util.List<java.lang.String> samplers)
                                                                                                                        throws javax.management.openmbean.OpenDataException
        Specified by:
        samplePartitions in interface StorageServiceMBean
        Throws:
        javax.management.openmbean.OpenDataException
      • samplePartitions

        public java.util.Map<java.lang.String,​java.util.List<javax.management.openmbean.CompositeData>> samplePartitions​(java.lang.String keyspace,
                                                                                                                               int durationMillis,
                                                                                                                               int capacity,
                                                                                                                               int count,
                                                                                                                               java.util.List<java.lang.String> samplers)
                                                                                                                        throws javax.management.openmbean.OpenDataException
        Specified by:
        samplePartitions in interface StorageServiceMBean
        Throws:
        javax.management.openmbean.OpenDataException
      • startSamplingPartitions

        public boolean startSamplingPartitions​(java.lang.String ks,
                                               java.lang.String table,
                                               int duration,
                                               int interval,
                                               int capacity,
                                               int count,
                                               java.util.List<java.lang.String> samplers)
        Description copied from interface: StorageServiceMBean
        Start a scheduled sampling
        Specified by:
        startSamplingPartitions in interface StorageServiceMBean
        Parameters:
        ks - Keyspace. Nullable. If null, the scheduled sampling is on all keyspaces and tables
        table - Nullable. If null, the scheduled sampling is on all tables of the specified keyspace
        duration - Duration of each scheduled sampling job in milliseconds
        interval - Interval of each scheduled sampling job in milliseconds
        capacity - Capacity of the sampler, higher for more accuracy
        count - Number of the top samples to list
        samplers - a list of samplers to enable
        Returns:
        true if the scheduled sampling is started successfully. Otherwise return false
      • stopSamplingPartitions

        public boolean stopSamplingPartitions​(java.lang.String ks,
                                              java.lang.String table)
        Description copied from interface: StorageServiceMBean
        Stop a scheduled sampling
        Specified by:
        stopSamplingPartitions in interface StorageServiceMBean
        Parameters:
        ks - Keyspace. Nullable. If null, the scheduled sampling is on all keysapces and tables
        table - Nullable. If null, the scheduled sampling is on all tables of the specified keyspace
        Returns:
        true if the scheduled sampling is stopped. False is returned if the sampling task is not found
      • getSampleTasks

        public java.util.List<java.lang.String> getSampleTasks()
        Specified by:
        getSampleTasks in interface StorageServiceMBean
        Returns:
        a list of qualified table names that have active scheduled sampling tasks. The format of the name is `KEYSPACE.TABLE` The wild card symbol (*) indicates all keyspace/table. For example, "*.*" indicates all tables in all keyspaces. "foo.*" indicates all tables under keyspace 'foo'. "foo.bar" indicates the scheduled sampling is enabled for the table 'bar'
      • rebuildSecondaryIndex

        public void rebuildSecondaryIndex​(java.lang.String ksName,
                                          java.lang.String cfName,
                                          java.lang.String... idxNames)
        Description copied from interface: StorageServiceMBean
        rebuild the specified indexes
        Specified by:
        rebuildSecondaryIndex in interface StorageServiceMBean
      • setTraceProbability

        public void setTraceProbability​(double probability)
        Description copied from interface: StorageServiceMBean
        Enables/Disables tracing for the whole system.
        Specified by:
        setTraceProbability in interface StorageServiceMBean
        Parameters:
        probability - ]0,1[ will enable tracing on a partial number of requests with the provided probability. 0 will disable tracing and 1 will enable tracing for all requests (which mich severely cripple the system)
      • shouldTraceProbablistically

        public boolean shouldTraceProbablistically()
      • disableAutoCompaction

        public void disableAutoCompaction​(java.lang.String ks,
                                          java.lang.String... tables)
                                   throws java.io.IOException
        Specified by:
        disableAutoCompaction in interface StorageServiceMBean
        Throws:
        java.io.IOException
      • enableAutoCompaction

        public void enableAutoCompaction​(java.lang.String ks,
                                         java.lang.String... tables)
                                  throws java.io.IOException
        Specified by:
        enableAutoCompaction in interface StorageServiceMBean
        Throws:
        java.io.IOException
      • getAutoCompactionStatus

        public java.util.Map<java.lang.String,​java.lang.Boolean> getAutoCompactionStatus​(java.lang.String ks,
                                                                                               java.lang.String... tables)
                                                                                        throws java.io.IOException
        Specified by:
        getAutoCompactionStatus in interface StorageServiceMBean
        Throws:
        java.io.IOException
      • getColumnIndexSizeInKiB

        public int getColumnIndexSizeInKiB()
        Description copied from interface: StorageServiceMBean
        Returns the granularity of the collation index of rows within a partition. -1 stands for the SSTable format's default.
        Specified by:
        getColumnIndexSizeInKiB in interface StorageServiceMBean
      • setColumnIndexSizeInKiB

        public void setColumnIndexSizeInKiB​(int columnIndexSizeInKiB)
        Description copied from interface: StorageServiceMBean
        Sets the granularity of the collation index of rows within a partition. Use -1 to select the SSTable format's default.
        Specified by:
        setColumnIndexSizeInKiB in interface StorageServiceMBean
      • setColumnIndexSize

        @Deprecated(since="5.0")
        public void setColumnIndexSize​(int columnIndexSizeInKB)
        Deprecated.
        See CASSANDRA-17668
        Description copied from interface: StorageServiceMBean
        Sets the granularity of the collation index of rows within a partition
        Specified by:
        setColumnIndexSize in interface StorageServiceMBean
      • getColumnIndexCacheSize

        @Deprecated(since="5.0")
        public int getColumnIndexCacheSize()
        Deprecated.
        See CASSANDRA-17668
        Description copied from interface: StorageServiceMBean
        Returns the threshold for skipping the column index when caching partition info
        Specified by:
        getColumnIndexCacheSize in interface StorageServiceMBean
      • setColumnIndexCacheSize

        @Deprecated(since="5.0")
        public void setColumnIndexCacheSize​(int cacheSizeInKB)
        Deprecated.
        See CASSANDRA-17668
        Description copied from interface: StorageServiceMBean
        Sets the threshold for skipping the column index when caching partition info
        Specified by:
        setColumnIndexCacheSize in interface StorageServiceMBean
      • getBatchSizeWarnThreshold

        @Deprecated(since="5.0")
        public int getBatchSizeWarnThreshold()
        Deprecated.
        See CASSANDRA-17668
        Description copied from interface: StorageServiceMBean
        Returns the threshold for warning queries due to a large batch size
        Specified by:
        getBatchSizeWarnThreshold in interface StorageServiceMBean
      • setBatchSizeWarnThreshold

        @Deprecated(since="5.0")
        public void setBatchSizeWarnThreshold​(int threshold)
        Deprecated.
        See CASSANDRA-17668
        Description copied from interface: StorageServiceMBean
        Sets the threshold for warning queries due to a large batch size
        Specified by:
        setBatchSizeWarnThreshold in interface StorageServiceMBean
      • setRangeTombstoneListResizeGrowthFactor

        public void setRangeTombstoneListResizeGrowthFactor​(double growthFactor)
                                                     throws java.lang.IllegalStateException
        Description copied from interface: StorageServiceMBean
        Sets the resize factor to use when growing/resizing a RangeTombstoneList
        Specified by:
        setRangeTombstoneListResizeGrowthFactor in interface StorageServiceMBean
        Throws:
        java.lang.IllegalStateException
      • enableAuditLog

        @Deprecated(since="4.1")
        public void enableAuditLog​(java.lang.String loggerName,
                                   java.lang.String includedKeyspaces,
                                   java.lang.String excludedKeyspaces,
                                   java.lang.String includedCategories,
                                   java.lang.String excludedCategories,
                                   java.lang.String includedUsers,
                                   java.lang.String excludedUsers)
                            throws ConfigurationException,
                                   java.lang.IllegalStateException
        Deprecated.
        See CASSANDRA-16725
        Specified by:
        enableAuditLog in interface StorageServiceMBean
        Throws:
        ConfigurationException
        java.lang.IllegalStateException
      • enableAuditLog

        public void enableAuditLog​(java.lang.String loggerName,
                                   java.lang.String includedKeyspaces,
                                   java.lang.String excludedKeyspaces,
                                   java.lang.String includedCategories,
                                   java.lang.String excludedCategories,
                                   java.lang.String includedUsers,
                                   java.lang.String excludedUsers,
                                   java.lang.Integer maxArchiveRetries,
                                   java.lang.Boolean block,
                                   java.lang.String rollCycle,
                                   java.lang.Long maxLogSize,
                                   java.lang.Integer maxQueueWeight,
                                   java.lang.String archiveCommand)
                            throws java.lang.IllegalStateException
        Specified by:
        enableAuditLog in interface StorageServiceMBean
        Throws:
        java.lang.IllegalStateException
      • enableAuditLog

        @Deprecated(since="4.1")
        public void enableAuditLog​(java.lang.String loggerName,
                                   java.util.Map<java.lang.String,​java.lang.String> parameters,
                                   java.lang.String includedKeyspaces,
                                   java.lang.String excludedKeyspaces,
                                   java.lang.String includedCategories,
                                   java.lang.String excludedCategories,
                                   java.lang.String includedUsers,
                                   java.lang.String excludedUsers)
                            throws ConfigurationException,
                                   java.lang.IllegalStateException
        Deprecated.
        See CASSANDRA-16725
        Specified by:
        enableAuditLog in interface StorageServiceMBean
        Throws:
        ConfigurationException
        java.lang.IllegalStateException
      • enableAuditLog

        public void enableAuditLog​(java.lang.String loggerName,
                                   java.util.Map<java.lang.String,​java.lang.String> parameters,
                                   java.lang.String includedKeyspaces,
                                   java.lang.String excludedKeyspaces,
                                   java.lang.String includedCategories,
                                   java.lang.String excludedCategories,
                                   java.lang.String includedUsers,
                                   java.lang.String excludedUsers,
                                   java.lang.Integer maxArchiveRetries,
                                   java.lang.Boolean block,
                                   java.lang.String rollCycle,
                                   java.lang.Long maxLogSize,
                                   java.lang.Integer maxQueueWeight,
                                   java.lang.String archiveCommand)
                            throws java.lang.IllegalStateException
        Specified by:
        enableAuditLog in interface StorageServiceMBean
        Throws:
        java.lang.IllegalStateException
      • shutdownServer

        public void shutdownServer()
      • enableFullQueryLogger

        public void enableFullQueryLogger​(java.lang.String path,
                                          java.lang.String rollCycle,
                                          java.lang.Boolean blocking,
                                          int maxQueueWeight,
                                          long maxLogSize,
                                          java.lang.String archiveCommand,
                                          int maxArchiveRetries)
        Description copied from interface: StorageServiceMBean
        Start the fully query logger.
        Specified by:
        enableFullQueryLogger in interface StorageServiceMBean
        Parameters:
        path - Path where the full query log will be stored. If null cassandra.yaml value is used.
        rollCycle - How often to create a new file for query data (MINUTELY, DAILY, HOURLY)
        blocking - Whether threads submitting queries to the query log should block if they can't be drained to the filesystem or alternatively drops samples and log
        maxQueueWeight - How many bytes of query data to queue before blocking or dropping samples
        maxLogSize - How many bytes of log data to store before dropping segments. Might not be respected if a log file hasn't rolled so it can be deleted.
        archiveCommand - executable archiving the rolled log files,
        maxArchiveRetries - max number of times to retry a failing archive command
      • resetFullQueryLogger

        public void resetFullQueryLogger()
        Description copied from interface: StorageServiceMBean
        Disable the full query logger if it is enabled. Also delete any generated files in the last used full query log path as well as the one configure in cassandra.yaml
        Specified by:
        resetFullQueryLogger in interface StorageServiceMBean
      • getOutstandingSchemaVersions

        public java.util.Map<java.lang.String,​java.util.Set<java.net.InetAddress>> getOutstandingSchemaVersions()
        Description copied from interface: StorageServiceMBean
        Returns a map of schema version -> list of endpoints reporting that version that we need schema updates for
        Specified by:
        getOutstandingSchemaVersions in interface StorageServiceMBean
      • addSnapshot

        public void addSnapshot​(TableSnapshot snapshot)
      • getPaxosBallotLowBound

        public java.lang.String getPaxosBallotLowBound​(java.lang.String ksName,
                                                       java.lang.String tblName,
                                                       java.lang.String key)
        Specified by:
        getPaxosBallotLowBound in interface StorageServiceMBean
      • removeNotificationListener

        public void removeNotificationListener​(javax.management.NotificationListener listener)
                                        throws javax.management.ListenerNotFoundException
        Specified by:
        removeNotificationListener in interface javax.management.NotificationBroadcaster
        Overrides:
        removeNotificationListener in class javax.management.NotificationBroadcasterSupport
        Throws:
        javax.management.ListenerNotFoundException
      • removeNotificationListener

        public void removeNotificationListener​(javax.management.NotificationListener listener,
                                               javax.management.NotificationFilter filter,
                                               java.lang.Object handback)
                                        throws javax.management.ListenerNotFoundException
        Specified by:
        removeNotificationListener in interface javax.management.NotificationEmitter
        Overrides:
        removeNotificationListener in class javax.management.NotificationBroadcasterSupport
        Throws:
        javax.management.ListenerNotFoundException
      • addNotificationListener

        public void addNotificationListener​(javax.management.NotificationListener listener,
                                            javax.management.NotificationFilter filter,
                                            java.lang.Object handback)
                                     throws java.lang.IllegalArgumentException
        Specified by:
        addNotificationListener in interface javax.management.NotificationBroadcaster
        Overrides:
        addNotificationListener in class javax.management.NotificationBroadcasterSupport
        Throws:
        java.lang.IllegalArgumentException