Search in sources :

Example 11 with IndexMetadata

use of org.apache.cassandra.schema.IndexMetadata in project cassandra by apache.

the class SecondaryIndexManager method reload.

/**
     * Drops and adds new indexes associated with the underlying CF
     */
public void reload() {
    // figure out what needs to be added and dropped.
    Indexes tableIndexes = baseCfs.metadata().indexes;
    indexes.keySet().stream().filter(indexName -> !tableIndexes.has(indexName)).forEach(this::removeIndex);
    // some may not have been created here yet, only added to schema
    for (IndexMetadata tableIndex : tableIndexes) addIndex(tableIndex);
}
Also used : java.util(java.util) Iterables(com.google.common.collect.Iterables) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) JMXEnabledThreadPoolExecutor(org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor) CompactionManager(org.apache.cassandra.db.compaction.CompactionManager) ColumnMetadata(org.apache.cassandra.schema.ColumnMetadata) SSTableSet(org.apache.cassandra.db.lifecycle.SSTableSet) LoggerFactory(org.slf4j.LoggerFactory) org.apache.cassandra.db(org.apache.cassandra.db) Constructor(java.lang.reflect.Constructor) Function(java.util.function.Function) StringUtils(org.apache.commons.lang3.StringUtils) SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) Indexes(org.apache.cassandra.schema.Indexes) org.apache.cassandra.db.rows(org.apache.cassandra.db.rows) OpOrder(org.apache.cassandra.utils.concurrent.OpOrder) Strings(com.google.common.base.Strings) org.apache.cassandra.index.transactions(org.apache.cassandra.index.transactions) IndexTarget(org.apache.cassandra.cql3.statements.IndexTarget) ProtocolVersion(org.apache.cassandra.transport.ProtocolVersion) Refs(org.apache.cassandra.utils.concurrent.Refs) DatabaseDescriptor(org.apache.cassandra.config.DatabaseDescriptor) InvalidRequestException(org.apache.cassandra.exceptions.InvalidRequestException) org.apache.cassandra.db.partitions(org.apache.cassandra.db.partitions) Longs(com.google.common.primitives.Longs) ImmutableSet(com.google.common.collect.ImmutableSet) Logger(org.slf4j.Logger) RowFilter(org.apache.cassandra.db.filter.RowFilter) FBUtilities(org.apache.cassandra.utils.FBUtilities) IndexMetadata(org.apache.cassandra.schema.IndexMetadata) java.util.concurrent(java.util.concurrent) Tracing(org.apache.cassandra.tracing.Tracing) Collectors(java.util.stream.Collectors) Maps(com.google.common.collect.Maps) Sets(com.google.common.collect.Sets) Futures(com.google.common.util.concurrent.Futures) NamedThreadFactory(org.apache.cassandra.concurrent.NamedThreadFactory) CassandraIndex(org.apache.cassandra.index.internal.CassandraIndex) Stream(java.util.stream.Stream) SinglePartitionPager(org.apache.cassandra.service.pager.SinglePartitionPager) StageManager(org.apache.cassandra.concurrent.StageManager) Joiner(com.google.common.base.Joiner) View(org.apache.cassandra.db.lifecycle.View) Indexes(org.apache.cassandra.schema.Indexes) IndexMetadata(org.apache.cassandra.schema.IndexMetadata)

Aggregations

IndexMetadata (org.apache.cassandra.schema.IndexMetadata)11 TableMetadata (org.apache.cassandra.schema.TableMetadata)6 IndexTarget (org.apache.cassandra.cql3.statements.IndexTarget)5 ColumnMetadata (org.apache.cassandra.schema.ColumnMetadata)5 Test (org.junit.Test)4 java.util (java.util)3 Indexes (org.apache.cassandra.schema.Indexes)3 Iterables (com.google.common.collect.Iterables)2 ByteBuffer (java.nio.ByteBuffer)2 Future (java.util.concurrent.Future)2 Collectors (java.util.stream.Collectors)2 DatabaseDescriptor (org.apache.cassandra.config.DatabaseDescriptor)2 CompactionManager (org.apache.cassandra.db.compaction.CompactionManager)2 org.apache.cassandra.db.partitions (org.apache.cassandra.db.partitions)2 org.apache.cassandra.db.rows (org.apache.cassandra.db.rows)2 InvalidRequestException (org.apache.cassandra.exceptions.InvalidRequestException)2 Index (org.apache.cassandra.index.Index)2 StubIndex (org.apache.cassandra.index.StubIndex)2 MigrationManager (org.apache.cassandra.schema.MigrationManager)2 Joiner (com.google.common.base.Joiner)1