maedhroz commented on code in PR #3955:
URL: https://github.com/apache/cassandra/pull/3955#discussion_r1989918816
##########
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")
Review Comment:
I wonder if we could make a little constant out of the message
string/pattern in `IndexBuildInProgressException`? That way we could reuse it
here (and in some other tests?) to build error messages without worrying if
we'll change them later (assuming they still take just the index name).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]