Skip to content

Commit

Permalink
Merge branch 'cassandra-5.0' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
smiklosovic committed Feb 16, 2024
2 parents 3483fc0 + 2aa2b59 commit 3c76ae2
Show file tree
Hide file tree
Showing 27 changed files with 213 additions and 100 deletions.
2 changes: 1 addition & 1 deletion NEWS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ Upgrading
internode_socket_receive_buffer_size_in_bytes. To support upgrades pre-4.0, we add backward compatibility and
currently both old and new names should work. Cassandra 4.0.0 and Cassandra 4.0.1 work ONLY with the new names
(They weren't updated in cassandra.yaml though).
- DESCRIBE|DESC was moved to server side in Cassandra 4.0. As a consequence DESRIBE|DESC will not work in cqlsh 6.0.0
- DESCRIBE|DESC was moved to server side in Cassandra 4.0. As a consequence DESCRIBE|DESC will not work in cqlsh 6.0.0
being connected to earlier major Cassandra versions where DESCRIBE does not exist server side.
- cqlsh shell startup script now prefers 'python3' before 'python' when identifying a runtime.
- As part of the Internode Messaging improvement work in CASSANDRA-15066, matching response verbs for every request
Expand Down
4 changes: 2 additions & 2 deletions doc/cql3/CQL.textile
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ __Syntax:__
bc(syntax)..
<grant-permission-stmt> ::= GRANT ( ALL ( PERMISSIONS )? | <permission> ( PERMISSION )? (, PERMISSION)* ) ON <resource> TO <identifier>

<permission> ::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESRIBE | EXECUTE | UNMASK | SELECT_MASKED
<permission> ::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESCRIBE | EXECUTE | UNMASK | SELECT_MASKED

<resource> ::= ALL KEYSPACES
| KEYSPACE <identifier>
Expand Down Expand Up @@ -1683,7 +1683,7 @@ __Syntax:__
bc(syntax)..
<revoke-permission-stmt> ::= REVOKE ( ALL ( PERMISSIONS )? | <permission> ( PERMISSION )? (, PERMISSION)* ) ON <resource> FROM <identifier>

<permission> ::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESRIBE | EXECUTE | UNMASK | SELECT_MASKED
<permission> ::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESCRIBE | EXECUTE | UNMASK | SELECT_MASKED

<resource> ::= ALL KEYSPACES
| KEYSPACE <identifier>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE CUSTOM INDEX IF NOT EXISTS ann_index
ON cycling.comments_vs(comment_vector) USING 'StorageAttachedIndex';
CREATE INDEX IF NOT EXISTS ann_index
ON cycling.comments_vs(comment_vector) USING 'sai';
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE CUSTOM INDEX IF NOT EXISTS ann_index
ON vsearch.products(item_vector) USING 'StorageAttachedIndex';
CREATE INDEX IF NOT EXISTS ann_index ON vsearch.products(item_vector)
USING 'sai';
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ DROP INDEX IF EXISTS cycling.country_sai_idx;
DROP INDEX IF EXISTS cycling.registration_sai_idx;

// tag::createQuickStartIndices[]
CREATE CUSTOM INDEX lastname_sai_idx ON cycling.cyclist_semi_pro (lastname)
USING 'StorageAttachedIndex'
CREATE INDEX lastname_sai_idx ON cycling.cyclist_semi_pro (lastname)
USING 'sai'
WITH OPTIONS = {'case_sensitive': 'false', 'normalize': 'true', 'ascii': 'true'};

CREATE CUSTOM INDEX age_sai_idx ON cycling.cyclist_semi_pro (age)
USING 'StorageAttachedIndex';
CREATE INDEX age_sai_idx ON cycling.cyclist_semi_pro (age)
USING 'sai';

CREATE CUSTOM INDEX country_sai_idx ON cycling.cyclist_semi_pro (country)
USING 'StorageAttachedIndex'
CREATE INDEX country_sai_idx ON cycling.cyclist_semi_pro (country)
USING 'sai'
WITH OPTIONS = {'case_sensitive': 'false', 'normalize': 'true', 'ascii': 'true'};

CREATE CUSTOM INDEX registration_sai_idx ON cycling.cyclist_semi_pro (registration)
USING 'StorageAttachedIndex';
CREATE INDEX registration_sai_idx ON cycling.cyclist_semi_pro (registration)
USING 'sai';
// end::createQuickStartIndices[]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE CUSTOM INDEX commenter_cs_idx ON cycling.comments_vs (commenter)
USING 'StorageAttachedIndex'
CREATE INDEX commenter_cs_idx ON cycling.comments_vs (commenter)
USING 'sai'
WITH OPTIONS = {'case_sensitive': 'true', 'normalize': 'true', 'ascii': 'true'};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CREATE CUSTOM INDEX race_name_idx
CREATE INDEX race_name_idx
ON cycling.rank_by_year_and_name (race_name)
USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX race_year_idx
USING 'sai';
CREATE INDEX race_year_idx
ON cycling.rank_by_year_and_name (race_year)
USING 'StorageAttachedIndex';
USING 'sai';
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE CUSTOM INDEX events_idx
CREATE INDEX events_idx
ON cycling.upcoming_calendar (events)
USING 'StorageAttachedIndex';
USING 'sai';
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE CUSTOM INDEX teams_idx
CREATE INDEX teams_idx
ON cycling.cyclist_career_teams (teams)
USING 'StorageAttachedIndex';
USING 'sai';
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
CREATE CUSTOM INDEX commenter_idx
CREATE INDEX commenter_idx
ON cycling.comments_vs (commenter)
USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX created_at_idx
USING 'sai';
CREATE INDEX created_at_idx
ON cycling.comments_vs (created_at)
USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX ann_index
USING 'sai';
CREATE INDEX ann_index
ON cycling.comments_vs (comment_vector)
USING 'StorageAttachedIndex';
USING 'sai';

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE CUSTOM INDEX sim_comments_idx
CREATE INDEX sim_comments_idx
ON cycling.comments_vs (comment_vector)
USING 'StorageAttachedIndex'
USING 'sai'
WITH OPTIONS = { 'similarity_function': 'DOT_PRODUCT'};
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE CUSTOM INDEX commenter_idx
CREATE INDEX commenter_idx
ON cycling.comments_vs (commenter)
USING 'StorageAttachedIndex';
USING 'sai';
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE CUSTOM INDEX races_idx
CREATE INDEX races_idx
ON cycling.cyclist_races (races)
USING 'StorageAttachedIndex';
USING 'sai';
4 changes: 2 additions & 2 deletions doc/modules/cassandra/examples/CQL/sai/sai-error.cql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CREATE CUSTOM INDEX ON demo2.person_id_name_primarykey (id)
USING 'StorageAttachedIndex';
CREATE INDEX ON demo2.person_id_name_primarykey (id)
USING 'sai';
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ CREATE TABLE cycling.cyclist_semi_pro (
AND nodesync = {'enabled': 'true', 'incremental': 'true'}
AND read_repair = 'BLOCKING'
AND speculative_retry = '99PERCENTILE';
CREATE CUSTOM INDEX registration_sai_idx ON cycling.cyclist_semi_pro (registration) USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX country_sai_idx ON cycling.cyclist_semi_pro (country) USING 'StorageAttachedIndex' WITH OPTIONS = {'normalize': 'true', 'case_sensitive': 'false', 'ascii': 'true'};
CREATE CUSTOM INDEX age_sai_idx ON cycling.cyclist_semi_pro (age) USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX lastname_sai_idx ON cycling.cyclist_semi_pro (lastname) USING 'StorageAttachedIndex' WITH OPTIONS = {'normalize': 'true', 'case_sensitive': 'false', 'ascii': 'true'};
CREATE INDEX registration_sai_idx ON cycling.cyclist_semi_pro (registration) USING 'sai';
CREATE INDEX country_sai_idx ON cycling.cyclist_semi_pro (country) USING 'sai' WITH OPTIONS = {'normalize': 'true', 'case_sensitive': 'false', 'ascii': 'true'};
CREATE INDEX age_sai_idx ON cycling.cyclist_semi_pro (age) USING 'sai';
CREATE INDEX lastname_sai_idx ON cycling.cyclist_semi_pro (lastname) USING 'sai' WITH OPTIONS = {'normalize': 'true', 'case_sensitive': 'false', 'ascii': 'true'};
// end::cyclistSemiProDescribeResults[]
Original file line number Diff line number Diff line change
Expand Up @@ -2519,7 +2519,7 @@ _Syntax:_
bc(syntax).. +
::= GRANT ( ALL ( PERMISSIONS )? | ( PERMISSION )? ) ON TO

::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESRIBE | UNMASK | SELECT_MASKED
::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESCRIBE | UNMASK | SELECT_MASKED
EXECUTE

::= ALL KEYSPACES +
Expand Down Expand Up @@ -2591,7 +2591,7 @@ _Syntax:_
bc(syntax).. +
::= REVOKE ( ALL ( PERMISSIONS )? | ( PERMISSION )? ) ON FROM

::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESRIBE | UNMASK | SELECT_MASKED
::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESCRIBE | UNMASK | SELECT_MASKED
EXECUTE

::= ALL KEYSPACES +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ See the xref:cassandra:developing/cql/indexing/sai/sai-overview.adoc[SAI section

// tag::syntax[]
----
CREATE CUSTOM INDEX [ IF NOT EXISTS ] [ <index_name> ]
CREATE [CUSTOM] INDEX [ IF NOT EXISTS ] [ <index_name> ]
ON [ <keyspace_name>.]<table_name> (<column_name>)
| [ (KEYS(<map_name>)) ]
| [ (VALUES(<map_name>)) ]
| [ (ENTRIES(<map_name>)) ]
USING 'StorageAttachedIndex'
USING 'sai'
[ WITH OPTIONS = { <option_map> } ] ;
----
// end::syntax[]
Expand Down Expand Up @@ -156,9 +156,9 @@ Creating multiple SAI indexes with different map types *on the same column* requ

[source,language-cql]
----
CREATE CUSTOM INDEX ON audit (KEYS(text_map)) USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX ON audit (VALUES(text_map)) USING 'StorageAttachedIndex';
CREATE CUSTOM INDEX ON audit (ENTRIES(text_map)) USING 'StorageAttachedIndex';
CREATE INDEX ON audit (KEYS(text_map)) USING 'sai';
CREATE INDEX ON audit (VALUES(text_map)) USING 'sai';
CREATE INDEX ON audit (ENTRIES(text_map)) USING 'sai';
----

Insert some data:
Expand Down Expand Up @@ -321,7 +321,7 @@ Create an SAI index using the collection's `years` column.

[source,language-cql]
----
CREATE CUSTOM INDEX ON calendar(years) USING 'StorageAttachedIndex';
CREATE INDEX ON calendar(years) USING 'sai';
----

Insert some random `int` list data for `years`, just for demo purposes.
Expand Down Expand Up @@ -381,7 +381,7 @@ Create an SAI index using the collection's `years` column -- this time for the `

[source,language-cql]
----
CREATE CUSTOM INDEX ON calendar2(years) USING 'StorageAttachedIndex';
CREATE INDEX ON calendar2(years) USING 'sai';
----

Insert some random `int` set data for `years`, again just for demo purposes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To create a simple SAI index:
include::cassandra:example$CQL/sai/cyclist_semi_pro_sai_indices.cql[tag=createQuickStartIndices]
----

For most SAI indexes, the column name is defined in the `CREATE CUSTOM INDEX` statement that also uses `USING 'StorageAttachedIndex'`.
For most SAI indexes, the column name is defined in the `CREATE INDEX` statement that also uses `USING 'sai'`.
The SAI index options are defined in the `WITH OPTIONS` clause.
The `case_sensitive` option is set to `false` to allow case-insensitive searches.
The `normalize` option is set to `true` to allow searches to be normalized for Unicode characters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ SAI combines:

include::cassandra:partial$sai/support-databases.adoc[]

After creating your database, a keyspace, and one or more tables, use `+CREATE CUSTOM INDEX ...
USING 'StorageAttachedIndex'+` to define one or more SAI indexes on the table.
After creating your database, a keyspace, and one or more tables, use `+CREATE INDEX ...
USING 'sai'+` to define one or more SAI indexes on the table.
For Cassandra databases, use `cqlsh`.
The same `+CREATE CUSTOM INDEX ...
USING 'StorageAttachedIndex'+` command is available for both.
The same `+CREATE INDEX ...
USING 'sai'+` command is available for both.
See xref:cassandra:getting-started/sai-quickstart.adoc[SAI quickstart].

== What configuration settings should I use with SAI?
Expand Down Expand Up @@ -89,8 +89,8 @@ The features, by design, are intentionally simple and easy to use.

At a high level, SAI indexes are:

* Created and dropped per column via CQL `+CREATE CUSTOM INDEX ...
USING 'StorageAttachedIndex'+` commands and `DROP INDEX` commands.
* Created and dropped per column via CQL `+CREATE INDEX ...
USING 'sai'+` commands and `DROP INDEX` commands.
Start in xref:cassandra:getting-started/sai-quickstart.adoc[SAI quickstart].

* Rebuilt and backed up via nodetool.
Expand Down Expand Up @@ -203,15 +203,15 @@ SELECT * FROM audit WHERE text_map CONTAINS KEY 'Giovani';
For query examples with `CONTAINS` clauses that take advantage of SAI collection maps, lists, and sets, be sure to see xref:developing/cql/indexing/sai/collections.adoc[SAI collection map examples with keys, values, and entries].
====

== On the `CREATE CUSTOM INDEX` command for SAI, what options are available?
== On the `CREATE INDEX` command for SAI, what options are available?

Use the `WITH OPTIONS` clause to indicate how SAI should handle case sensitivity and special characters in the index.
For example, given a string column `lastname`:

[source,language-cql]
----
CREATE CUSTOM INDEX lastname_sai_idx ON cycling.cyclist_semi_pro (lastname)
USING 'StorageAttachedIndex' WITH OPTIONS =
CREATE INDEX lastname_sai_idx ON cycling.cyclist_semi_pro (lastname)
USING 'sai' WITH OPTIONS =
{'case_sensitive': 'false', 'normalize': 'true', 'ascii': 'true'};
----

Expand Down
11 changes: 4 additions & 7 deletions doc/modules/cassandra/pages/managing/operating/repair.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,10 @@ Or even on specific tables:
nodetool repair [options] <keyspace_name> <table1> <table2>
----

The repair command only repairs token ranges on the node being repaired,
it doesn't repair the whole cluster. By default, repair will operate on
all token ranges replicated by the node you're running repair on, which
will cause duplicate work if you run it on every node. The `-pr` flag
will only repair the "primary" ranges on a node, so you can repair your
entire cluster by running `nodetool repair -pr` on each node in a single
datacenter.

The repair command repairs token ranges only on the node being repaired; it does not repair the whole cluster.
By default, repair operates on all token ranges replicated by the node on which repair is run, causing duplicate work when running it on every node. Avoid duplicate work by using the `-pr` flag to repair only the "primary" ranges on a node.
Do a full cluster repair by running the `nodetool repair -pr` command on each node in each datacenter in the cluster, until all of the nodes and datacenters are repaired.

The specific frequency of repair that's right for your cluster, of
course, depends on several factors. However, if you're just starting out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ You can create multiple secondary indexes on the same database table, with each
All column date types except the following are supported for SAI indexes:

* `counter`
* geospatial types: `PointType`, `LineStringType`, `PolygonType`
* non-frozen user-defined type (UDT)
.One exception
Expand All @@ -22,7 +21,7 @@ If you need to query based on one of those columns, an SAI index is a helpful op

Defining one or more SAI indexes based on any column in a database table (with the rules noted above) subsequently gives you the ability to run performant queries that use the indexed column to filter results.

See the xref:cassandra:developing/indexing/sai/sai-overview.adoc[SAI section].
See the xref:cassandra:developing/cql/indexing/sai/sai-overview.adoc[SAI section].

== Syntax

Expand Down Expand Up @@ -53,7 +52,7 @@ include::cassandra:partial$cql-syntax-legend.adoc[]

index_name::
Optional identifier for index.
If no name is specified, the default is used, `<table_name>_<column_name>_idx`.
If no name is specified, the default used is `<table_name>\_<column_name>\_idx`.
Enclose in quotes to use special characters or to preserve capitalization.

column_name::
Expand All @@ -63,7 +62,7 @@ SAI returns `InvalidRequestException` if you try to define an index on a column

map_name::
// LLP FIX
Used with xref:cassandra:developing/collections/collection-create.adoc[collections], identifier of the `map_name` specified in `CREATE TABLE` ...
Used with xref:cassandra:developing/cql/collections/collection-create.adoc[collections], identifier of the `map_name` specified in `CREATE TABLE` ...
`map(<map_name>)`.
The regular column syntax applies for collection types `list` and `set`.

Expand Down Expand Up @@ -119,14 +118,14 @@ include::cassandra:example$CQL/sai/cyclist_semi_pro_sai_indices.cql[tag=createQu
----

For sample queries that find data in `cycling.cyclist_semi_pro` via these sample SAI indexes, see xref:cassandra:getting-started/sai-quickstart.adoc#saiQuickStart__saiQuickStartSubmitQueries[Submit CQL queries].
Also refer xref:cassandra:developing/indexing/sai/sai-query.adoc[Examine SAI column index and query rules].
Also refer xref:cassandra:developing/cql/indexing/sai/sai-query.adoc[Querying with SAI].

[[saiCollectionsExamples]]
=== SAI collection map examples with keys, values, and entries

// LLP FIX
The following examples demonstrate using collection maps of multiple types (`keys`, `values`, `entries`) in SAI indexes.
For related information, see xref:cassandra:developing/collections/collection-create.adoc[Creating collections] and xref:cassandra:developing/collections/map.adoc[Using map type].
For related information, see xref:cassandra:developing/cql/collections/collection-create.adoc[Creating collections] and xref:cassandra:developing/cql/collections/map.adoc[Using map type].

Also refer to the SAI collection examples of type xref:#saiCreateCustomIndexCollectionsListAndSetExamples[list and set] in this topic.

Expand Down Expand Up @@ -293,9 +292,10 @@ Remember that in CQL queries using SAI indexes, the `CONTAINS` clauses are suppo
These examples demonstrate using collections with the `list` and `set` types in SAI indexes.
For related information, see:
// LLP FIX
* xref:cassandra:developing/collections/collection-create.adoc[Creating collections]
* xref:cassandra:developing/collections/list.adoc[Using list type]
* xref:cassandra:developing/collections/set.adoc[Using set type]

* xref:cassandra:developing/cql/collections/collection-create.adoc[Creating collections]
* xref:cassandra:developing/cql/collections/list.adoc[Using list type]
* xref:cassandra:developing/cql/collections/set.adoc[Using set type]

If you have not already, create the keyspace.

Expand Down

0 comments on commit 3c76ae2

Please sign in to comment.