You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Mike Adamson (Jira)" <ji...@apache.org> on 2023/11/17 16:24:00 UTC

[jira] [Commented] (CASSANDRA-18166) Improve the code model around IndexContext

    [ https://issues.apache.org/jira/browse/CASSANDRA-18166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17787291#comment-17787291 ] 

Mike Adamson commented on CASSANDRA-18166:
------------------------------------------

Here is the patch and CI runs for this ticket:
|[5.0|https://github.com/apache/cassandra/pull/2916]|[CI|https://app.circleci.com/pipelines/github/mike-tr-adamson/cassandra/381/workflows/18d97894-4ddf-4054-95ff-03f704cf6106]|
|[trunk|https://github.com/apache/cassandra/pull/2917]|[CI|https://app.circleci.com/pipelines/github/mike-tr-adamson/cassandra/383/workflows/169a2c85-1032-4ae4-96a5-4451b97c249b]|

The patch is large, but the majority of class changes are associated with the changes in a few core changes made to the context and identity classes associated with the index.

The main changes are that {{IndexContext}} has been removed and replaced with {{IndexTermType}} and {{IndexDefinition}}. 

A secondary change is that the {{Expression}} has been refactored as an interface with indexed and unindexed implementations. This change was brought about by CASSANDRA-18994 where we were failing to handle filter operators that were not supported by SAI. This includes a patch proposed by  [~adelapena] that rejects these unsupported expressions in the planning stage and pushes them back to the {{RowFilter}}.

{{IndexTermType}} was proposed in CASSANDRA-18590, but it made sense to implement it as part of this ticket. {{IndexTermType}} is a representation of an {{AbstractType}} as an indexable type. It manages the capabilities of the type and any special encoding and comparison for the type. It replaces the {{TypeUtil}} class.

{{IndexDefinition}} is a simple class that wraps the index name and holds the log message wrapper that was previously in {{IndexContext}}. This is useful in the testing of low-level classes (file handlers) that only need access to the index name.

The remaining capabilities of {{IndexContext}} have been moved to {{StorageAttachedIndex}}. These are the {{ViewManager}}, {{MemtableIndexManager}}, {{PrimaryKey.Factory}}, {{IndexWriterConfig}}, {{AbstractAnalyzer.AnalyzerFactory}}, {{ColumnQueryMetrics}} and {{IndexMetrics}}. Access to these elements is always at a point in the code where the {{StorageAttachedIndex}} is available, so having another context object makes no sense.

> Improve the code model around IndexContext
> ------------------------------------------
>
>                 Key: CASSANDRA-18166
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18166
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Feature/SAI
>            Reporter: Mike Adamson
>            Assignee: Mike Adamson
>            Priority: Normal
>              Labels: SAI
>             Fix For: 5.0-rc
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> We currently have a situation where we need to create an IndexContext that is for a non-indexed column and therefore is never going to be used for indexing or searching. This results in the IndexContext having to check for this at points in the code with assertions. The reason for this that, even when the column is non-indexed, we need to have information about the column for the purpose of post-filtering. 
> It would make sense to split out the column / index information needed for filtering from the indexing / searching requirements such that we could avoid unnecessary assertions in the code.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org