[jira] [Commented] (CASSANDRA-18939) Creating a SASI index after creating an SAI index breaks secondary index queries

2024-01-04 Thread Stefan Miklosovic (Jira)


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

Stefan Miklosovic commented on CASSANDRA-18939:
---

Noting out of ordinary, I created CASSANDRA-19250 that fails all the time in 
trunk.

> Creating a SASI index after creating an SAI index breaks secondary index 
> queries
> 
>
> Key: CASSANDRA-18939
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18939
> Project: Cassandra
>  Issue Type: Bug
>  Components: Feature/2i Index
>Reporter: Jon Haddad
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0-rc, 5.x
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> In the 5.0 branch, HEAD is e45c1092f91edd63591f562b2120ea6a5fd3edd5, I was 
> able to break secondary indexes by doing the following:
> {code}
> cqlsh -e "create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};"
> cqlsh -e "create table test.blah (id int primary key, val text);"
> cqlsh -e "create INDEX on test.blah (val) using 'sai';"
> bin/nodetool flush
> ❯ cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
>  id | val
> +-
> (0 rows)
> cqlsh -e "create custom INDEX on test.blah (val) using 
> 'org.apache.cassandra.index.sasi.SASIIndex';"
> Warnings :
> SASI indexes are experimental and are not recommended for production use.
> cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
> :1:ReadFailure: Error from server: code=1300 [Replica(s) failed to 
> execute read] message="Operation failed - received 0 responses and 1 
> failures: UNKNOWN from localhost/127.0.0.1:7000" info={'consistency': 'ONE', 
> 'required_responses': 1, 'received_responses': 0, 'failures': 1, 
> 'error_code_map': {'127.0.0.1': '0x'}}
> {code}
> Server throws an exception:
> {code}
> ERROR [ReadStage-2] 2023-10-18 12:09:42,391 JVMStabilityInspector.java:70 - 
> Exception in thread Thread[ReadStage-2,10,SharedPool]
> java.lang.RuntimeException: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2585)
>   at 
> org.apache.cassandra.concurrent.ExecutionFailure$2.run(ExecutionFailure.java:163)
>   at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
>   at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>   at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.index.sasi.plan.QueryController.getIndex(QueryController.java:96)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation.analyzeGroup(Operation.java:282)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:433)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.analyze(SASIIndexSearcher.java:65)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.search(SASIIndexSearcher.java:77)
>   at 
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:425)
>   at 
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2184)
>   at org.apache.cassandra.service
> {code}
> Dropping the SASI index restores correct behavior.



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

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



[jira] [Commented] (CASSANDRA-18939) Creating a SASI index after creating an SAI index breaks secondary index queries

2024-01-04 Thread Caleb Rackliffe (Jira)


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

Caleb Rackliffe commented on CASSANDRA-18939:
-

[~adelapena] Right…I think the only reason we allow them simultaneously is if 
we’re replacing a SASI index and the SAI index just hasn’t completed its 
initial build.

> Creating a SASI index after creating an SAI index breaks secondary index 
> queries
> 
>
> Key: CASSANDRA-18939
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18939
> Project: Cassandra
>  Issue Type: Bug
>  Components: Feature/2i Index
>Reporter: Jon Haddad
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0-rc, 5.x
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> In the 5.0 branch, HEAD is e45c1092f91edd63591f562b2120ea6a5fd3edd5, I was 
> able to break secondary indexes by doing the following:
> {code}
> cqlsh -e "create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};"
> cqlsh -e "create table test.blah (id int primary key, val text);"
> cqlsh -e "create INDEX on test.blah (val) using 'sai';"
> bin/nodetool flush
> ❯ cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
>  id | val
> +-
> (0 rows)
> cqlsh -e "create custom INDEX on test.blah (val) using 
> 'org.apache.cassandra.index.sasi.SASIIndex';"
> Warnings :
> SASI indexes are experimental and are not recommended for production use.
> cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
> :1:ReadFailure: Error from server: code=1300 [Replica(s) failed to 
> execute read] message="Operation failed - received 0 responses and 1 
> failures: UNKNOWN from localhost/127.0.0.1:7000" info={'consistency': 'ONE', 
> 'required_responses': 1, 'received_responses': 0, 'failures': 1, 
> 'error_code_map': {'127.0.0.1': '0x'}}
> {code}
> Server throws an exception:
> {code}
> ERROR [ReadStage-2] 2023-10-18 12:09:42,391 JVMStabilityInspector.java:70 - 
> Exception in thread Thread[ReadStage-2,10,SharedPool]
> java.lang.RuntimeException: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2585)
>   at 
> org.apache.cassandra.concurrent.ExecutionFailure$2.run(ExecutionFailure.java:163)
>   at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
>   at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>   at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.index.sasi.plan.QueryController.getIndex(QueryController.java:96)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation.analyzeGroup(Operation.java:282)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:433)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.analyze(SASIIndexSearcher.java:65)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.search(SASIIndexSearcher.java:77)
>   at 
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:425)
>   at 
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2184)
>   at org.apache.cassandra.service
> {code}
> Dropping the SASI index restores correct behavior.



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

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



[jira] [Commented] (CASSANDRA-18939) Creating a SASI index after creating an SAI index breaks secondary index queries

2024-01-04 Thread Stefan Miklosovic (Jira)


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

Stefan Miklosovic commented on CASSANDRA-18939:
---

[5.0 
j17|https://app.circleci.com/pipelines/github/instaclustr/cassandra/3704/workflows/38928f0f-7b9f-44ac-9cf5-e779451a69a9]
[5.0 
j11|https://app.circleci.com/pipelines/github/instaclustr/cassandra/3704/workflows/dd6a5155-3e34-4187-b2bb-7cb705e68662]
[trunk|j17 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/3706/workflows/1f593737-47b9-4d44-b634-da1c0aac1c8d]
[trunk|j11 
https://app.circleci.com/pipelines/github/instaclustr/cassandra/3706/workflows/8f0d41cb-792a-4475-ba3a-1f660e77fdb8]

> Creating a SASI index after creating an SAI index breaks secondary index 
> queries
> 
>
> Key: CASSANDRA-18939
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18939
> Project: Cassandra
>  Issue Type: Bug
>  Components: Feature/2i Index
>Reporter: Jon Haddad
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0-rc, 5.x
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> In the 5.0 branch, HEAD is e45c1092f91edd63591f562b2120ea6a5fd3edd5, I was 
> able to break secondary indexes by doing the following:
> {code}
> cqlsh -e "create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};"
> cqlsh -e "create table test.blah (id int primary key, val text);"
> cqlsh -e "create INDEX on test.blah (val) using 'sai';"
> bin/nodetool flush
> ❯ cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
>  id | val
> +-
> (0 rows)
> cqlsh -e "create custom INDEX on test.blah (val) using 
> 'org.apache.cassandra.index.sasi.SASIIndex';"
> Warnings :
> SASI indexes are experimental and are not recommended for production use.
> cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
> :1:ReadFailure: Error from server: code=1300 [Replica(s) failed to 
> execute read] message="Operation failed - received 0 responses and 1 
> failures: UNKNOWN from localhost/127.0.0.1:7000" info={'consistency': 'ONE', 
> 'required_responses': 1, 'received_responses': 0, 'failures': 1, 
> 'error_code_map': {'127.0.0.1': '0x'}}
> {code}
> Server throws an exception:
> {code}
> ERROR [ReadStage-2] 2023-10-18 12:09:42,391 JVMStabilityInspector.java:70 - 
> Exception in thread Thread[ReadStage-2,10,SharedPool]
> java.lang.RuntimeException: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2585)
>   at 
> org.apache.cassandra.concurrent.ExecutionFailure$2.run(ExecutionFailure.java:163)
>   at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
>   at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>   at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.index.sasi.plan.QueryController.getIndex(QueryController.java:96)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation.analyzeGroup(Operation.java:282)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:433)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.analyze(SASIIndexSearcher.java:65)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.search(SASIIndexSearcher.java:77)
>   at 
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:425)
>   at 
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2184)
>   at org.apache.cassandra.service
> {code}
> Dropping the SASI index restores correct behavior.



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

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



[jira] [Commented] (CASSANDRA-18939) Creating a SASI index after creating an SAI index breaks secondary index queries

2024-01-04 Thread Jira


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

Andres de la Peña commented on CASSANDRA-18939:
---

The last changes look to me. Do we have CI results for them?

As for the SASI/SAI index selection, I think it makes sense to prioritize SAI 
over SASI. It be done by making {{SASIIndex#getEstimatedResultRows()}} return 
{{Long.MIN_VALUE + 1}}, although we might just check the index class or have a 
separate method giving the priority of the implementation in case of having an 
identical number of estimated rows, which might be a bit less hacky. In any 
case, I think that should be done in a separate ticket since it's not related 
to the specific bug that we're fixing here.

I also wondered whether we allow multiple index implementations on the same 
column, even when all implementations should return the same results for the 
same expression. I think the main reason is allowing transitioning from one 
index implementation to another. Is that right? Another more convoluted use 
case might be having separate columns with different index implementations, and 
then other columns that might be queried combined with either of those 
single-indexed columns.


> Creating a SASI index after creating an SAI index breaks secondary index 
> queries
> 
>
> Key: CASSANDRA-18939
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18939
> Project: Cassandra
>  Issue Type: Bug
>  Components: Feature/2i Index
>Reporter: Jon Haddad
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0-rc, 5.x
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> In the 5.0 branch, HEAD is e45c1092f91edd63591f562b2120ea6a5fd3edd5, I was 
> able to break secondary indexes by doing the following:
> {code}
> cqlsh -e "create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};"
> cqlsh -e "create table test.blah (id int primary key, val text);"
> cqlsh -e "create INDEX on test.blah (val) using 'sai';"
> bin/nodetool flush
> ❯ cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
>  id | val
> +-
> (0 rows)
> cqlsh -e "create custom INDEX on test.blah (val) using 
> 'org.apache.cassandra.index.sasi.SASIIndex';"
> Warnings :
> SASI indexes are experimental and are not recommended for production use.
> cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
> :1:ReadFailure: Error from server: code=1300 [Replica(s) failed to 
> execute read] message="Operation failed - received 0 responses and 1 
> failures: UNKNOWN from localhost/127.0.0.1:7000" info={'consistency': 'ONE', 
> 'required_responses': 1, 'received_responses': 0, 'failures': 1, 
> 'error_code_map': {'127.0.0.1': '0x'}}
> {code}
> Server throws an exception:
> {code}
> ERROR [ReadStage-2] 2023-10-18 12:09:42,391 JVMStabilityInspector.java:70 - 
> Exception in thread Thread[ReadStage-2,10,SharedPool]
> java.lang.RuntimeException: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2585)
>   at 
> org.apache.cassandra.concurrent.ExecutionFailure$2.run(ExecutionFailure.java:163)
>   at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
>   at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>   at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.index.sasi.plan.QueryController.getIndex(QueryController.java:96)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation.analyzeGroup(Operation.java:282)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:433)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.analyze(SASIIndexSearcher.java:65)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.search(SASIIndexSearcher.java:77)
>   at 
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:425)
>   at 
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2184)
>   at 

[jira] [Commented] (CASSANDRA-18939) Creating a SASI index after creating an SAI index breaks secondary index queries

2024-01-03 Thread Caleb Rackliffe (Jira)


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

Caleb Rackliffe commented on CASSANDRA-18939:
-

+1 on both PRs

However...there is one other thing this issue highlights, which is that we can 
select a SASI index over SAI arbitrarily. This goes back to the way we just 
hard-code a value in {{SASIIndex#getEstimatedResultRows()}} to make sure it's 
always selected over legacy 2i. [~pkolaczk][~adelapena] might have an opinion 
here as well, but I think we should, at minimum, have {{SASIIndex}} return 
{{return Long.MIN_VALUE + 1;}} to make sure SAI's priority is higher when both 
indexes exist on the same column.

> Creating a SASI index after creating an SAI index breaks secondary index 
> queries
> 
>
> Key: CASSANDRA-18939
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18939
> Project: Cassandra
>  Issue Type: Bug
>  Components: Feature/2i Index
>Reporter: Jon Haddad
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0-rc, 5.x
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> In the 5.0 branch, HEAD is e45c1092f91edd63591f562b2120ea6a5fd3edd5, I was 
> able to break secondary indexes by doing the following:
> {code}
> cqlsh -e "create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};"
> cqlsh -e "create table test.blah (id int primary key, val text);"
> cqlsh -e "create INDEX on test.blah (val) using 'sai';"
> bin/nodetool flush
> ❯ cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
>  id | val
> +-
> (0 rows)
> cqlsh -e "create custom INDEX on test.blah (val) using 
> 'org.apache.cassandra.index.sasi.SASIIndex';"
> Warnings :
> SASI indexes are experimental and are not recommended for production use.
> cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
> :1:ReadFailure: Error from server: code=1300 [Replica(s) failed to 
> execute read] message="Operation failed - received 0 responses and 1 
> failures: UNKNOWN from localhost/127.0.0.1:7000" info={'consistency': 'ONE', 
> 'required_responses': 1, 'received_responses': 0, 'failures': 1, 
> 'error_code_map': {'127.0.0.1': '0x'}}
> {code}
> Server throws an exception:
> {code}
> ERROR [ReadStage-2] 2023-10-18 12:09:42,391 JVMStabilityInspector.java:70 - 
> Exception in thread Thread[ReadStage-2,10,SharedPool]
> java.lang.RuntimeException: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2585)
>   at 
> org.apache.cassandra.concurrent.ExecutionFailure$2.run(ExecutionFailure.java:163)
>   at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
>   at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>   at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.index.sasi.plan.QueryController.getIndex(QueryController.java:96)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation.analyzeGroup(Operation.java:282)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:433)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.analyze(SASIIndexSearcher.java:65)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.search(SASIIndexSearcher.java:77)
>   at 
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:425)
>   at 
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2184)
>   at org.apache.cassandra.service
> {code}
> Dropping the SASI index restores correct behavior.



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

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



[jira] [Commented] (CASSANDRA-18939) Creating a SASI index after creating an SAI index breaks secondary index queries

2024-01-02 Thread Stefan Miklosovic (Jira)


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

Stefan Miklosovic commented on CASSANDRA-18939:
---

[~adelapena] I rewrote the thing, pushed the changes into 5.0 PR

> Creating a SASI index after creating an SAI index breaks secondary index 
> queries
> 
>
> Key: CASSANDRA-18939
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18939
> Project: Cassandra
>  Issue Type: Bug
>  Components: Feature/2i Index
>Reporter: Jon Haddad
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0-rc, 5.x
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> In the 5.0 branch, HEAD is e45c1092f91edd63591f562b2120ea6a5fd3edd5, I was 
> able to break secondary indexes by doing the following:
> {code}
> cqlsh -e "create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};"
> cqlsh -e "create table test.blah (id int primary key, val text);"
> cqlsh -e "create INDEX on test.blah (val) using 'sai';"
> bin/nodetool flush
> ❯ cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
>  id | val
> +-
> (0 rows)
> cqlsh -e "create custom INDEX on test.blah (val) using 
> 'org.apache.cassandra.index.sasi.SASIIndex';"
> Warnings :
> SASI indexes are experimental and are not recommended for production use.
> cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
> :1:ReadFailure: Error from server: code=1300 [Replica(s) failed to 
> execute read] message="Operation failed - received 0 responses and 1 
> failures: UNKNOWN from localhost/127.0.0.1:7000" info={'consistency': 'ONE', 
> 'required_responses': 1, 'received_responses': 0, 'failures': 1, 
> 'error_code_map': {'127.0.0.1': '0x'}}
> {code}
> Server throws an exception:
> {code}
> ERROR [ReadStage-2] 2023-10-18 12:09:42,391 JVMStabilityInspector.java:70 - 
> Exception in thread Thread[ReadStage-2,10,SharedPool]
> java.lang.RuntimeException: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2585)
>   at 
> org.apache.cassandra.concurrent.ExecutionFailure$2.run(ExecutionFailure.java:163)
>   at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
>   at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>   at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.index.sasi.plan.QueryController.getIndex(QueryController.java:96)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation.analyzeGroup(Operation.java:282)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:433)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.analyze(SASIIndexSearcher.java:65)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.search(SASIIndexSearcher.java:77)
>   at 
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:425)
>   at 
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2184)
>   at org.apache.cassandra.service
> {code}
> Dropping the SASI index restores correct behavior.



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

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



[jira] [Commented] (CASSANDRA-18939) Creating a SASI index after creating an SAI index breaks secondary index queries

2024-01-02 Thread Jira


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

Andres de la Peña commented on CASSANDRA-18939:
---

The fix looks good to me. That version on {{getBestIndexFor}} might have a 
better name, such as {{{}getIndexesFor{}}}. After all, it's not returning the 
best/first index for the expression, but the set of all the indexes for the 
specified expression and class. Alternatively, it could keep the current name 
and return the first index matching the arguments, like the other version of 
{{{}getBestIndexFor{}}}.

> Creating a SASI index after creating an SAI index breaks secondary index 
> queries
> 
>
> Key: CASSANDRA-18939
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18939
> Project: Cassandra
>  Issue Type: Bug
>  Components: Feature/2i Index
>Reporter: Jon Haddad
>Assignee: Stefan Miklosovic
>Priority: Normal
> Fix For: 5.0-rc, 5.x
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> In the 5.0 branch, HEAD is e45c1092f91edd63591f562b2120ea6a5fd3edd5, I was 
> able to break secondary indexes by doing the following:
> {code}
> cqlsh -e "create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};"
> cqlsh -e "create table test.blah (id int primary key, val text);"
> cqlsh -e "create INDEX on test.blah (val) using 'sai';"
> bin/nodetool flush
> ❯ cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
>  id | val
> +-
> (0 rows)
> cqlsh -e "create custom INDEX on test.blah (val) using 
> 'org.apache.cassandra.index.sasi.SASIIndex';"
> Warnings :
> SASI indexes are experimental and are not recommended for production use.
> cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
> :1:ReadFailure: Error from server: code=1300 [Replica(s) failed to 
> execute read] message="Operation failed - received 0 responses and 1 
> failures: UNKNOWN from localhost/127.0.0.1:7000" info={'consistency': 'ONE', 
> 'required_responses': 1, 'received_responses': 0, 'failures': 1, 
> 'error_code_map': {'127.0.0.1': '0x'}}
> {code}
> Server throws an exception:
> {code}
> ERROR [ReadStage-2] 2023-10-18 12:09:42,391 JVMStabilityInspector.java:70 - 
> Exception in thread Thread[ReadStage-2,10,SharedPool]
> java.lang.RuntimeException: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2585)
>   at 
> org.apache.cassandra.concurrent.ExecutionFailure$2.run(ExecutionFailure.java:163)
>   at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
>   at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>   at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.index.sasi.plan.QueryController.getIndex(QueryController.java:96)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation.analyzeGroup(Operation.java:282)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:433)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.analyze(SASIIndexSearcher.java:65)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.search(SASIIndexSearcher.java:77)
>   at 
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:425)
>   at 
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2184)
>   at org.apache.cassandra.service
> {code}
> Dropping the SASI index restores correct behavior.



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

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



[jira] [Commented] (CASSANDRA-18939) Creating a SASI index after creating an SAI index breaks secondary index queries

2023-10-18 Thread Caleb Rackliffe (Jira)


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

Caleb Rackliffe commented on CASSANDRA-18939:
-

In {{QueryController#getIndex()}}, SASI should be using the version of 
{{getBestIndexFor()}} that takes an index type filter, like SAI does.

ex. from SAI's {{QueryController#getContext()}}

{noformat}
Set indexes = 
cfs.indexManager.getBestIndexFor(expression, StorageAttachedIndex.class);
{noformat}

> Creating a SASI index after creating an SAI index breaks secondary index 
> queries
> 
>
> Key: CASSANDRA-18939
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18939
> Project: Cassandra
>  Issue Type: Bug
>  Components: Feature/2i Index
>Reporter: Jon Haddad
>Priority: Normal
> Fix For: 5.0.x, 5.x
>
>
> In the 5.0 branch, HEAD is e45c1092f91edd63591f562b2120ea6a5fd3edd5, I was 
> able to break secondary indexes by doing the following:
> {code}
> cqlsh -e "create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};"
> cqlsh -e "create table test.blah (id int primary key, val text);"
> cqlsh -e "create INDEX on test.blah (val) using 'sai';"
> bin/nodetool flush
> ❯ cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
>  id | val
> +-
> (0 rows)
> cqlsh -e "create custom INDEX on test.blah (val) using 
> 'org.apache.cassandra.index.sasi.SASIIndex';"
> Warnings :
> SASI indexes are experimental and are not recommended for production use.
> cqlsh -e "SELECT * from test.blah WHERE val = 'something';"
> :1:ReadFailure: Error from server: code=1300 [Replica(s) failed to 
> execute read] message="Operation failed - received 0 responses and 1 
> failures: UNKNOWN from localhost/127.0.0.1:7000" info={'consistency': 'ONE', 
> 'required_responses': 1, 'received_responses': 0, 'failures': 1, 
> 'error_code_map': {'127.0.0.1': '0x'}}
> {code}
> Server throws an exception:
> {code}
> ERROR [ReadStage-2] 2023-10-18 12:09:42,391 JVMStabilityInspector.java:70 - 
> Exception in thread Thread[ReadStage-2,10,SharedPool]
> java.lang.RuntimeException: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2585)
>   at 
> org.apache.cassandra.concurrent.ExecutionFailure$2.run(ExecutionFailure.java:163)
>   at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:143)
>   at 
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>   at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassCastException: class 
> org.apache.cassandra.index.sai.StorageAttachedIndex cannot be cast to class 
> org.apache.cassandra.index.sasi.SASIIndex 
> (org.apache.cassandra.index.sai.StorageAttachedIndex and 
> org.apache.cassandra.index.sasi.SASIIndex are in unnamed module of loader 
> 'app')
>   at 
> org.apache.cassandra.index.sasi.plan.QueryController.getIndex(QueryController.java:96)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation.analyzeGroup(Operation.java:282)
>   at 
> org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:433)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.analyze(SASIIndexSearcher.java:65)
>   at 
> org.apache.cassandra.index.sasi.plan.SASIIndexSearcher.search(SASIIndexSearcher.java:77)
>   at 
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:425)
>   at 
> org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:2184)
>   at org.apache.cassandra.service
> {code}
> Dropping the SASI index restores correct behavior.



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

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