maedhroz commented on code in PR #3955: URL: https://github.com/apache/cassandra/pull/3955#discussion_r1989916017
########## test/unit/org/apache/cassandra/index/sai/cql/AllowFilteringTest.java: ########## @@ -391,4 +395,30 @@ private void test(String query, boolean requiresAllowFiltering) throws Throwable assertNotNull(execute(query + " ALLOW FILTERING")); } + private final 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); + 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 as it is building") + .isInstanceOf(IndexBuildInProgressException.class); + + assertThatThrownBy(() -> execute("SELECT * FROM %s WHERE v=0 ALLOW FILTERING")) + .hasMessage("The secondary index '" + idx + "' is not yet available as it is building") + .isInstanceOf(IndexBuildInProgressException.class); + + blockIndexBuild.countDown(); + blockIndexBuild.disable(); + waitForIndexQueryable(idx); + execute("SELECT * FROM %s WHERE v=0"); + execute("SELECT * FROM %s WHERE v=0 ALLOW FILTERING"); Review Comment: The point of having AF here even when it's not required is to illustrate that even w/ AF, we'll fail during the initial index build? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org