[
https://issues.apache.org/jira/browse/CASSANDRA-20213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17913487#comment-17913487
]
Caleb Rackliffe commented on CASSANDRA-20213:
---------------------------------------------
One way to implement this might be to have {{IndexStatusManager}} transform the
{{QueryPlan}} either to remove indexes or {{null}} it out altogether. We'd
ideally only like the coordinator to have to worry about checking the replica
index statuses in one place. Once that is done, replicas would just fulfill the
coordinator's request rather than possibly degrading to non-index filtering
locally.
> ALLOW FILTERING queries rejected while index is being built
> -----------------------------------------------------------
>
> Key: CASSANDRA-20213
> URL: https://issues.apache.org/jira/browse/CASSANDRA-20213
> Project: Apache Cassandra
> Issue Type: Bug
> Components: Feature/SAI
> Reporter: Ekaterina Dimitrova
> Priority: Normal
> Fix For: 5.0.x, 5.x
>
>
> Below test was added to AllowFilteringTest on cassandra-5.0 branch:
> {code:java}
> private Injections.Barrier blockIndexBuild =
> Injections.newBarrier("block_index_build", 2, false)
>
> .add(InvokePointBuilder.newInvokePoint().onClass(StorageAttachedIndex.class)
>
> .onMethod("startInitialBuild"))
>
>
> .build();
> @Test
> public void testAllowFilteringDuringIndexBuild() throws Throwable
> {
> createTable("CREATE TABLE %s (k int PRIMARY KEY, v int)");
> Injections.inject(blockIndexBuild);
> execute("SELECT * FROM %s WHERE v=0 ALLOW FILTERING");
> String idx = createIndexAsync(String.format("CREATE CUSTOM INDEX ON
> %%s(v) USING '%s'", StorageAttachedIndex.class.getName()));
> assertThatThrownBy(() -> execute("SELECT * FROM %s WHERE v=0"))
> .hasMessage("The secondary index '" + idx + "' is not yet available")
> .isInstanceOf(IndexNotAvailableException.class);
> execute("SELECT * FROM %s WHERE v=0 ALLOW FILTERING"); //this should work
> while building
> blockIndexBuild.countDown();
> blockIndexBuild.disable();
> waitForIndexQueryable(idx);
> execute("SELECT * FROM %s WHERE v=0");
> execute("SELECT * FROM %s WHERE v=0 ALLOW FILTERING");
> }
> {code}
> It fails as follows:
> {code:java}
> org.apache.cassandra.index.IndexNotAvailableException: The secondary index
> 'table_testallowfilteringduringindexbuild_00_v_idx' is not yet available
> at
> org.apache.cassandra.index.SecondaryIndexManager.checkQueryability(SecondaryIndexManager.java:318)
> at
> org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:437)
> at
> org.apache.cassandra.db.AbstractReadQuery.executeInternal(AbstractReadQuery.java:65)
> at
> org.apache.cassandra.db.ReadCommand.executeInternal(ReadCommand.java:89)
> at
> org.apache.cassandra.cql3.statements.SelectStatement.executeInternal(SelectStatement.java:604)
> at
> org.apache.cassandra.cql3.statements.SelectStatement.executeLocally(SelectStatement.java:576)
> at
> org.apache.cassandra.cql3.statements.SelectStatement.executeLocally(SelectStatement.java:108)
> at
> org.apache.cassandra.cql3.QueryProcessor.executeInternal(QueryProcessor.java:452)
> at
> org.apache.cassandra.cql3.CQLTester.executeFormattedQuery(CQLTester.java:1633)
> at org.apache.cassandra.index.sai.SAITester.execute(SAITester.java:614)
> at
> org.apache.cassandra.index.sai.cql.AllowFilteringTest.testAllowFilteringDuringIndexBuild(AllowFilteringTest.java:56)
> {code}
> This would break cases when people migrate from allow filtering to using an
> index. We should probably fix that by falling back to ALLOW FILTERING when
> index status is FULL_REBUILD_STARTED and DROPPED.
> CC [~maedhroz]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]