Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,19 @@ public enum CassandraRelevantProperties
/** Class used to discover/load the proper SAI index components file for a given sstable. */
CUSTOM_SAI_INDEX_COMPONENTS_DISCOVERY("cassandra.sai.custom_components_discovery_class"),

/**
* Whether to enable SAI per-table metrics for different kinds of query, such as filter-only queries, top-k-only
* queries, hybrid queries, single-partition queries, and multipartition queries. These metrics are always counters.
*/
SAI_QUERY_KIND_PER_TABLE_METRICS_ENABLED("cassandra.sai.metrics.query_kind.per_table.enabled", "true"),

/**
* Whether to enable SAI per-query metrics for different kinds of query, such as filter-only queries, top-k-only
* queries, hybrid queries, single-partition queries, and multipartition queries. These metrics are histograms and
* timers.
*/
SAI_QUERY_KIND_PER_QUERY_METRICS_ENABLED("cassandra.sai.metrics.query_kind.per_query.enabled", "false"),

/**
* If true, while creating or altering schema, NetworkTopologyStrategy won't check if the DC exists.
* This is to remain compatible with older workflows that first change the replication before adding the nodes.
Expand Down
6 changes: 6 additions & 0 deletions src/java/org/apache/cassandra/db/MultiRangeReadCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ public static MultiRangeReadCommand create(List<ReadCallback<?, ?>> subrangeHand
command.indexQueryPlan());
}

@Override
public boolean isSinglePartition()
{
return dataRanges.size() == 1 && dataRanges.get(0).isSinglePartition();
}

/**
* @return all token ranges to be queried
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ public DataRange dataRange()
return dataRange;
}

@Override
public boolean isSinglePartition()
{
return dataRange.isSinglePartition();
}

public ClusteringIndexFilter clusteringIndexFilter(DecoratedKey key)
{
return dataRange.clusteringIndexFilter(key);
Expand Down
13 changes: 13 additions & 0 deletions src/java/org/apache/cassandra/db/ReadCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,25 @@ public Index.QueryPlan indexQueryPlan()
return indexQueryPlan;
}

/**
* @return {@code true} if this command uses index-based filtering, {@code false} otherwise
*/
public boolean usesIndexFiltering()
{
return indexQueryPlan != null && indexQueryPlan.usesIndexFiltering();
}

@Override
public boolean isTopK()
{
return indexQueryPlan != null && indexQueryPlan.isTopK();
}

/**
* @return {@code true} if this command only queries a single partition, {@code false} otherwise.
*/
public abstract boolean isSinglePartition();

@VisibleForTesting
public Index.Searcher indexSearcher()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ public SinglePartitionReadCommand forPaging(Clustering<?> lastReturned, DataLimi
lastReturned == null ? clusteringIndexFilter() : clusteringIndexFilter.forPaging(metadata().comparator, lastReturned, false));
}

@Override
public boolean isSinglePartition()
{
return true;
}

public PartitionIterator execute(ConsistencyLevel consistency, QueryState queryState, long queryStartNanoTime) throws RequestExecutionException
{
if (clusteringIndexFilter.isEmpty(metadata().comparator))
Expand Down
10 changes: 9 additions & 1 deletion src/java/org/apache/cassandra/index/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ default IndexBuildingSupport getRecoveryTaskSupport()
{
return getBuildTaskSupport();
}

/**
* Returns the type of operations supported by the index in case its building has failed and it's needing recovery.
*
Expand Down Expand Up @@ -1101,6 +1101,14 @@ default boolean isTopK()
{
return false;
}

/**
* @return {@code true} if this plan uses index-based filtering, {@code false} otherwise
*/
default boolean usesIndexFiltering()
{
return true;
}
}

/*
Expand Down
Loading