maedhroz commented on code in PR #2420: URL: https://github.com/apache/cassandra/pull/2420#discussion_r1235723689
########## test/distributed/org/apache/cassandra/distributed/test/sai/IndexStreamingTest.java: ########## @@ -0,0 +1,134 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cassandra.distributed.test.sai; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.Collections; + +import org.junit.Test; + +import org.apache.cassandra.distributed.Cluster; +import org.apache.cassandra.distributed.api.Feature; +import org.apache.cassandra.distributed.api.IInvokableInstance; +import org.apache.cassandra.distributed.api.Row; +import org.apache.cassandra.distributed.api.SimpleQueryResult; +import org.apache.cassandra.distributed.test.TestBaseImpl; +import org.apache.cassandra.distributed.util.QueryResultUtil; +import org.assertj.core.api.Assertions; + +import static org.assertj.core.api.Assertions.assertThat; + +public class IndexStreamingTest extends TestBaseImpl +{ + private static final ByteBuffer BLOB = ByteBuffer.wrap(new byte[1 << 16]); + // zero copy streaming sends all components, so the events will include non-Data files as well + private static final int NUM_COMPONENTS = 17; + + @Test + public void zeroCopy() throws IOException + { + test(true); + } + + @Test + public void notZeroCopy() throws IOException + { + test(false); + } + + private void test(boolean zeroCopyStreaming) throws IOException + { + try (Cluster cluster = init(Cluster.build(2) + .withConfig(c -> c.with(Feature.values()) + .set("stream_entire_sstables", zeroCopyStreaming).set("streaming_slow_events_log_timeout", "0s")) + .start())) + { + // streaming sends events every 65k, so need to make sure that the files are larger than this to hit + // all cases of the vtable + cluster.schemaChange(withKeyspace( + "CREATE TABLE %s.test (pk int PRIMARY KEY, v text, b blob) WITH compression = { 'enabled' : false };" + )); + cluster.schemaChange(withKeyspace( + "CREATE CUSTOM INDEX ON %s.test(v) USING 'StorageAttachedIndex';" Review Comment: Once numerics support merges, I guess we'll want to parameterize this test further to use those. The number of expected index components might change as well. CC @mike-tr-adamson I'm not sure if that means we should merge this first and adjust inside a rebased CASSANDRA-18067 or the other way around. -- 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]

