adelapena commented on PR #2465:
URL: https://github.com/apache/cassandra/pull/2465#issuecomment-1621827364
@mike-tr-adamson I think it would be good to add a dtest quickly verifying
that tokenisation and analysis don't break RFP (classic CASSANDRA-8272). I
think something like this would work:
```java
public class ReplicaFilteringProtectionTest extends TestBaseImpl
{
private static final int REPLICAS = 2;
@Test
public void testRFPWithIndexTransformations() throws IOException
{
try (Cluster cluster = init(Cluster.build()
.withNodes(REPLICAS)
.withConfig(config ->
config.set("hinted_handoff_enabled", false)
.set("commitlog_sync", "batch")).start()))
{
String tableName = "sai_rfp";
String fullTableName = KEYSPACE + '.' + tableName;
cluster.schemaChange("CREATE TABLE " + fullTableName + " (k int
PRIMARY KEY, v text)");
cluster.schemaChange("CREATE CUSTOM INDEX ON " + fullTableName +
"(v) USING 'StorageAttachedIndex' " +
"WITH OPTIONS = { 'case_sensitive' :
false}");
// both nodes have the old value
cluster.coordinator(1).execute("INSERT INTO " + fullTableName +
"(k, v) VALUES (0, 'OLD')", ALL);
String select = "SELECT * FROM " + fullTableName + " WHERE v =
'old'";
Object[][] initialRows = cluster.coordinator(1).execute(select,
ALL);
assertRows(initialRows, row(0, "OLD"));
// only one node gets the new value
cluster.get(1).executeInternal("UPDATE " + fullTableName + " SET
v = 'new' WHERE k = 0");
// querying by the old value shouldn't return the old surviving
row
SimpleQueryResult oldResult =
cluster.coordinator(1).executeWithResult(select, ALL);
assertRows(oldResult.toObjectArrays());
}
}
}
```
--
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]