ifesdjeen commented on code in PR #3689:
URL: https://github.com/apache/cassandra/pull/3689#discussion_r1847862235
##########
test/distributed/org/apache/cassandra/fuzz/sai/StaticsTortureTest.java:
##########
@@ -61,206 +52,145 @@ public void staticsTortureTest()
{
CassandraRelevantProperties.SAI_INTERSECTION_CLAUSE_LIMIT.setInt(6);
int idx = 0;
- staticsTortureTest(Arrays.asList(ColumnSpec.ck("ck1",
ColumnSpec.asciiType(4, 100)),
- ColumnSpec.ck("ck2",
ColumnSpec.asciiType),
- ColumnSpec.ck("ck3",
ColumnSpec.int64Type)),
- idx++);
-
- for (boolean b1 : new boolean[]{ true, false })
- for (boolean b2 : new boolean[]{ true, false })
- for (boolean b3 : new boolean[]{ true, false })
+ for (boolean b1 : new boolean[]{ false, true })
+ for (boolean b2 : new boolean[]{ false, true })
+ for (boolean b3 : new boolean[]{ false, true })
{
- staticsTortureTest(Arrays.asList(ColumnSpec.ck("ck1",
ColumnSpec.asciiType(4, 100), b1),
- ColumnSpec.ck("ck2",
ColumnSpec.asciiType, b2),
- ColumnSpec.ck("ck3",
ColumnSpec.int64Type, b3)),
+ staticsTortureTest(Arrays.asList(ColumnSpec.ck("ck1",
ColumnSpec.asciiType, Generators.ascii(4, 1000), b1),
+ ColumnSpec.ck("ck2",
ColumnSpec.asciiType, Generators.ascii(4, 1000), b2),
+ ColumnSpec.ck("ck3",
ColumnSpec.int64Type, Generators.int64(), b3)),
idx++);
}
}
public void staticsTortureTest(List<ColumnSpec<?>> cks, int idx)
{
- SchemaSpec schema = new SchemaSpec(KEYSPACE, "tbl" + idx,
- Arrays.asList(ColumnSpec.ck("pk1",
ColumnSpec.int64Type),
- ColumnSpec.ck("pk2",
ColumnSpec.asciiType(4, 100)),
- ColumnSpec.ck("pk3",
ColumnSpec.int64Type)),
+ SchemaSpec schema = new SchemaSpec(idx,
+ 10_000,
+ KEYSPACE,
+ "tbl" + idx,
+ Arrays.asList(ColumnSpec.pk("pk1",
ColumnSpec.int64Type, Generators.int64()),
+ ColumnSpec.pk("pk2",
ColumnSpec.asciiType, Generators.ascii(4, 1000)),
+ ColumnSpec.pk("pk3",
ColumnSpec.int64Type, Generators.int64())),
cks,
-
Arrays.asList(ColumnSpec.regularColumn("v1", ColumnSpec.asciiType(40, 100)),
+
Arrays.asList(ColumnSpec.regularColumn("v1", ColumnSpec.asciiType,
Generators.ascii(4, 1000)),
ColumnSpec.regularColumn("v2", ColumnSpec.int64Type),
ColumnSpec.regularColumn("v3", ColumnSpec.int64Type)),
-
List.of(ColumnSpec.staticColumn("s1", ColumnSpec.asciiType(40, 100)),
-
ColumnSpec.staticColumn("s2", ColumnSpec.int64Type),
-
ColumnSpec.staticColumn("s3", ColumnSpec.asciiType(40, 100))
- ));
+
Arrays.asList(ColumnSpec.staticColumn("s1", ColumnSpec.asciiType,
Generators.ascii(4, 1000)),
+
ColumnSpec.staticColumn("s2", ColumnSpec.int64Type),
+
ColumnSpec.staticColumn("s3", ColumnSpec.asciiType, Generators.ascii(4,
1000))));
+
- sut.schemaChange(schema.compile().cql());
- SchemaSpec debugSchema = schema.cloneWithName(schema.keyspace,
schema.table + "_debug");
- sut.schemaChange(schema.cloneWithName(schema.keyspace, schema.table +
"_debug").compile().cql());
- sut.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON %s.%s
(%s) USING 'sai' " +
+ cluster.schemaChange(schema.compile());
+ cluster.get(1).nodetool("disableautocompaction");
+ cluster.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON
%s.%s (%s) USING 'sai' " +
"WITH OPTIONS = {'case_sensitive':
'false', 'normalize': 'true', 'ascii': 'true'};",
schema.table,
schema.regularColumns.get(0).name,
schema.keyspace,
schema.table,
schema.regularColumns.get(0).name));
- sut.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON %s.%s
(%s) USING 'sai';",
+ cluster.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON
%s.%s (%s) USING 'sai';",
schema.table,
schema.regularColumns.get(1).name,
schema.keyspace,
schema.table,
schema.regularColumns.get(1).name));
- sut.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON %s.%s
(%s) USING 'sai';",
+ cluster.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON
%s.%s (%s) USING 'sai';",
schema.table,
schema.regularColumns.get(2).name,
schema.keyspace,
schema.table,
schema.regularColumns.get(2).name));
- sut.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON %s.%s
(%s) USING 'sai';",
+ cluster.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON
%s.%s (%s) USING 'sai';",
schema.table,
schema.staticColumns.get(0).name,
schema.keyspace,
schema.table,
schema.staticColumns.get(0).name));
- sut.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON %s.%s
(%s) USING 'sai';",
+ cluster.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON
%s.%s (%s) USING 'sai';",
schema.table,
schema.staticColumns.get(1).name,
schema.keyspace,
schema.table,
schema.staticColumns.get(1).name));
- sut.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON %s.%s
(%s) USING 'sai';",
+ cluster.schemaChange(String.format("CREATE INDEX %s_%s_sai_idx ON
%s.%s (%s) USING 'sai';",
schema.table,
schema.staticColumns.get(2).name,
schema.keyspace,
schema.table,
schema.staticColumns.get(2).name));
- DataTracker tracker = new DefaultDataTracker();
+
TokenPlacementModel.ReplicationFactor rf = new
TokenPlacementModel.SimpleReplicationFactor(cluster.size());
- ReplayingHistoryBuilder history = new ReplayingHistoryBuilder(SEED +
idx,
-
MAX_PARTITION_SIZE,
- 100,
- tracker,
- new
DoubleWritingSut(sut,
-
new QueryModifyingSut(sut,
-
schema.keyspace + "." + schema.table,
-
debugSchema.keyspace + "." +
debugSchema.table)),
- schema,
- rf,
-
SystemUnderTest.ConsistencyLevel.QUORUM);
+ Generator<BitSet> regularColumnBitSet =
Generators.bitSet(schema.regularColumns.size());
+ Generator<BitSet> staticColumnBitSet =
Generators.bitSet(schema.staticColumns.size());
EntropySource rng = new JdkRandomEntropySource(1l);
+
+ ReplayingHistoryBuilder history = new
ReplayingHistoryBuilder(schema.valueGenerators, hb -> {
+ return InJvmDTestVisitExecutor.builder().pageSizeSelector(i ->
rng.nextInt(1, 10)).build(schema, hb, cluster);
+ });
+
+
long[] values = new long[UNIQUE_CELL_VALUES];
Review Comment:
Yes, it is now redundant, thank you for spotting this. I over-focused on
porting the test, so missed this.
--
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]