Class StorageAttachedIndexGroup

    • Method Detail

      • getIndexes

        public java.util.Set<Index> getIndexes()
        Description copied from interface: Index.Group
        Returns the indexes that are members of this group.
        Specified by:
        getIndexes in interface Index.Group
        Returns:
        the indexes that are members of this group
      • addIndex

        public void addIndex​(Index index)
        Description copied from interface: Index.Group
        Adds the specified Index as a member of this group.
        Specified by:
        addIndex in interface Index.Group
        Parameters:
        index - the index to be added
      • removeIndex

        public void removeIndex​(Index index)
        Description copied from interface: Index.Group
        Removes the specified Index from the members of this group.
        Specified by:
        removeIndex in interface Index.Group
        Parameters:
        index - the index to be removed
      • invalidate

        public void invalidate()
        Description copied from interface: Index.Group
        Called when the table associated with this group has been invalidated or all indexes in the group are removed. Implementations should dispose of any resources tied to the lifecycle of the Index.Group.
        Specified by:
        invalidate in interface Index.Group
      • containsIndex

        public boolean containsIndex​(Index index)
        Description copied from interface: Index.Group
        Returns if this group contains the specified Index.
        Specified by:
        containsIndex in interface Index.Group
        Parameters:
        index - the index to be removed
        Returns:
        true if this group contains index, false otherwise
      • isSingleton

        public boolean isSingleton()
        Description copied from interface: Index.Group
        Returns whether this group can only ever contain a single index.
        Specified by:
        isSingleton in interface Index.Group
        Returns:
        true if this group only contains a single index, false otherwise
      • indexerFor

        public Index.Indexer indexerFor​(java.util.function.Predicate<Index> indexSelector,
                                        DecoratedKey key,
                                        RegularAndStaticColumns columns,
                                        long nowInSec,
                                        WriteContext ctx,
                                        IndexTransaction.Type transactionType,
                                        Memtable memtable)
        Description copied from interface: Index.Group
        Creates an new Indexer object for updates to a given partition.
        Specified by:
        indexerFor in interface Index.Group
        Parameters:
        indexSelector - a predicate selecting the targeted members
        key - key of the partition being modified
        columns - the regular and static columns the created indexer will have to deal with. This can be empty as an update might only contain partition, range and row deletions, but the indexer is guaranteed to not get any cells for a column that is not part of columns.
        nowInSec - current time of the update operation
        ctx - WriteContext spanning the update operation
        transactionType - indicates what kind of update is being performed on the base data i.e. a write time insert/update/delete or the result of compaction
        memtable - the Memtable to which the updates are being applied or null if the source of the updates is an existing SSTable
        Returns:
        the newly created indexer or null if the index is not interested by the update (this could be because the index doesn't care about that particular partition, doesn't care about that type of transaction, ...).
      • getFlushObserver

        public SSTableFlushObserver getFlushObserver​(Descriptor descriptor,
                                                     LifecycleNewTracker tracker,
                                                     TableMetadata tableMetadata)
        Description copied from interface: Index.Group
        Get flush observer to observe partition/cell events generated by flushing SSTable (memtable flush or compaction).
        Specified by:
        getFlushObserver in interface Index.Group
        Parameters:
        descriptor - The descriptor of the sstable observer is requested for.
        tracker - The LifecycleNewTracker associated with the SSTable being written
        tableMetadata - The immutable metadata of the table at the moment the SSTable is flushed
        Returns:
        SSTable flush observer.
      • handles

        public boolean handles​(IndexTransaction.Type type)
        Specified by:
        handles in interface Index.Group
        Parameters:
        type - index transaction type
        Returns:
        true if index will be able to handle given index transaction type
      • getComponents

        public java.util.Set<Component> getComponents()
        Description copied from interface: Index.Group
        Returns the SSTable-attached Components created by this index group.
        Specified by:
        getComponents in interface Index.Group
        Returns:
        the SSTable components created by this group
      • validateSSTableAttachedIndexes

        public boolean validateSSTableAttachedIndexes​(java.util.Collection<SSTableReader> sstables,
                                                      boolean throwOnIncomplete,
                                                      boolean validateChecksum)
        Description copied from interface: Index.Group
        Validates all indexes in the group against the specified SSTables.
        Specified by:
        validateSSTableAttachedIndexes in interface Index.Group
        Parameters:
        sstables - SSTables for which indexes in the group should be built
        throwOnIncomplete - whether to throw an error if any index in the group is incomplete
        validateChecksum - whether checksum will be tested as part of the validation
        Returns:
        true if all indexes in the group are complete and valid false if any index is incomplete and throwOnIncomplete is false
      • openIndexFiles

        public int openIndexFiles()
        open index files by checking number of SSTableContext and SSTableIndex, so transient open files during validation and files that are still open for in-flight requests will not be tracked.
        Returns:
        total number of open files for all StorageAttachedIndexes.
      • diskUsage

        public long diskUsage()
        Returns:
        total disk usage (in bytes) of all per-sstable index files
      • totalIndexBuildsInProgress

        public int totalIndexBuildsInProgress()
        Returns:
        count of indexes building
      • totalQueryableIndexCount

        public int totalQueryableIndexCount()
        Returns:
        count of queryable indexes
      • totalIndexCount

        public int totalIndexCount()
        Returns:
        count of indexes
      • totalDiskUsage

        public long totalDiskUsage()
        Returns:
        total disk usage of all per-sstable index files and per-column index files
      • unsafeReload

        public void unsafeReload()
        simulate index loading on restart with index file validation
      • reset

        public void reset()
        Simulate the index going through a restart of node