Class IndexStatusManager

java.lang.Object
org.apache.cassandra.index.IndexStatusManager

public class IndexStatusManager extends Object
Handles the status of an index across the ring, updating the status per index and endpoint in a per-endpoint map.

Peer status changes are recieved via the StorageService IEndpointStateChangeSubscriber.

Local status changes are propagated to the Gossiper using an async executor.

  • Field Details

  • Method Details

    • filterForQuery

      public <E extends Endpoints<E>> E filterForQuery(E liveEndpoints, Keyspace keyspace, Index.QueryPlan indexQueryPlan, ConsistencyLevel level)
      Remove endpoints whose indexes are not queryable for the specified Index.QueryPlan.
      Parameters:
      liveEndpoints - current live endpoints where non-queryable endpoints will be removed
      keyspace - to be queried
      indexQueryPlan - index query plan used in the read command
      level - consistency level of read command
    • receivePeerIndexStatus

      public void receivePeerIndexStatus(InetAddressAndPort endpoint, VersionedValue versionedValue)
      Recieve a new index status map from a peer. This will include the status for all the indexes on the peer.
      Parameters:
      endpoint - the InetAddressAndPort the index status map is coming from
      versionedValue - the VersionedValue containing the index status map
    • propagateLocalIndexStatus

      public void propagateLocalIndexStatus(String keyspace, String index, Index.Status status)
      Propagate a new index status to the ring. The new index status is added to the current index status map and the whole map is sent to the ring as a VersionedValue.
      Parameters:
      keyspace - the keyspace name for the index
      index - the index name
      status - the new Index.Status
    • toSerializedFormat

      public static String toSerializedFormat(Map<String,Index.Status> indexStatusMap)
      Serializes as a JSON string the status of the indexes in the provided map.

      For example, the map...

       {
           ks1.cf1_idx1=FULL_REBUILD_STARTED,
           ks1.cf1_idx2=FULL_REBUILD_STARTED,
           system.PaxosUncommittedIndex=BUILD_SUCCEEDED
       }
       
      ...will be converted to the string...
       {
           "system": {"PaxosUncommittedIndex": 3},
           "ks1": {"cf1_idx1": 1, "cf1_idx2": 1}
       }
       
    • getIndexStatus

      public Index.Status getIndexStatus(InetAddressAndPort peer, String keyspace, String index)