adelapena commented on code in PR #2935: URL: https://github.com/apache/cassandra/pull/2935#discussion_r1452509101
########## test/distributed/org/apache/cassandra/distributed/test/sai/PartialUpdateHandlingTest.java: ########## @@ -0,0 +1,541 @@ +/* + * 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.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import com.google.common.collect.Lists; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import org.apache.cassandra.cql3.statements.StatementType; +import org.apache.cassandra.distributed.Cluster; +import org.apache.cassandra.distributed.api.ConsistencyLevel; +import org.apache.cassandra.distributed.test.TestBaseImpl; +import org.apache.cassandra.index.Index; +import org.apache.cassandra.index.IndexStatusManager; +import org.apache.cassandra.index.sai.plan.Expression; +import org.apache.cassandra.locator.InetAddressAndPort; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.apache.cassandra.distributed.api.ConsistencyLevel.ALL; +import static org.apache.cassandra.distributed.api.ConsistencyLevel.QUORUM; +import static org.apache.cassandra.distributed.api.Feature.GOSSIP; +import static org.apache.cassandra.distributed.api.Feature.NETWORK; +import static org.apache.cassandra.distributed.shared.AssertUtils.assertRows; +import static org.apache.cassandra.index.sai.plan.Expression.IndexOperator.EQ; +import static org.apache.cassandra.index.sai.plan.Expression.IndexOperator.RANGE; + +/** + * SAI queries, like all filtering queries, must correctly resolve divergent views of row data across replicas. In + * particular, cases where writes do not propagate to all replicas can, if not resolved correctly, lead to consistency + * violations, as rows that should not appear in our results do, while rows that should appear do not. + * <p> + * The variables that affect the behavior of these queries are, at minimum, the following: + * <p> + * 1.) The combination of write & read consistency levels used by the client. Reads at ONE/LOCAL_ONE trivially + * avoid having to resolve data from diverging replicas. + * 2.) Interaction of existing data (if there is any), with partial updates and deletes. The same query that + * erroneously returns stale matches with naïve resolution and partial updates on top of existing data might + * fail to return live matches with partial updates and no previous data. + * 3.) The number of query clauses and their targets. Clauses may target partition keys, clustering keys, static + * columns, and regular columns, and some combinations are more problematic than others. + * 4.) The repaired state of SSTables that participate in the query. A fully repaired on-disk set of SSTables cannot + * produce erroneous results due to split rows (i.e. rows which contain partial updates of different columns + * across different partitions). + * 5.) Whether data resides in SSTables or Memtables. The latter is implicitly unrepaired. + * 6.) Interaction w/ existing mechanisms on the distributed read path that deal with short reads, replica filtering + * protection, etc. + * 7.) The relationship between columns selected and columns restricted by queries. (If coordinator filtering is + * involved at the implementation level, retrieving enough information to do that filtering is important.) + * 8.) The timestamps of partial updates and deletes, especially for single-column queries that might produce + * stale matches if not resolved correctly. + */ +@RunWith(Parameterized.class) +public class PartialUpdateHandlingTest extends TestBaseImpl +{ + private static final String TEST_TABLE_NAME = "test_partial_updates"; + private static final int PARTITIONS_PER_TEST = 10; + private static final int NODES = 3; Review Comment: Can we not reproduce all the problematic cases with just 2 nodes and save some resources? -- 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]

