ekaterinadimitrova2 commented on code in PR #3955:
URL: https://github.com/apache/cassandra/pull/3955#discussion_r1990066281


##########
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:
   Yes, that nothing changed in behavior until the other ticket with ALLOW 
FILTERING used during building is solved



-- 
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

Reply via email to