ifesdjeen commented on code in PR #3689: URL: https://github.com/apache/cassandra/pull/3689#discussion_r1848073061
##########
test/distributed/org/apache/cassandra/fuzz/topology/HarryTopologyMixupTest.java:
##########
@@ -101,28 +108,73 @@ protected void destroyState(State<Spec> state, @Nullable
Throwable cause)
if (cause != null) return;
if (((HarryState) state).numInserts > 0)
{
- // do one last read just to make sure we validate the data...
- var harry = state.schemaSpec.harry;
- harry.validateAll(harry.quiescentChecker());
+ for (Integer pkIdx : state.testState.pkGen.generated())
+ state.testState.history.selectPartition(pkIdx);
}
}
private static BiFunction<RandomSource, Cluster, Spec>
createSchemaSpec(AccordMode mode)
{
return (rs, cluster) -> {
- long seed = rs.nextLong();
- var schema = HarryHelper.schemaSpecBuilder("harry",
"tbl").surjection().inflate(seed);
+ EntropySource rng = new JdkRandomEntropySource(rs.nextLong());
+ Generator<SchemaSpec> schemaGen;
+ org.apache.cassandra.harry.SchemaSpec schema;
if (mode.kind != AccordMode.Kind.None)
- schema = schema.withTransactionMode(mode.passthroughMode);
- ReplayingHistoryBuilder harry = HarryHelper.dataGen(seed,
- mode.kind == AccordMode.Kind.Direct ? new
AccordSut(cluster) : new InJvmSut(cluster),
- new TokenPlacementModel.SimpleReplicationFactor(3),
- SystemUnderTest.ConsistencyLevel.QUORUM,
- schema);
- cluster.schemaChange(String.format("CREATE KEYSPACE %s WITH
replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};",
HarryHelper.KEYSPACE));
- cluster.schemaChange(schema.compile().cql());
+ schemaGen = SchemaGenerators.schemaSpecGen("harry", "table",
1000,
+
SchemaSpec.Options.TRANSACTIONAL_MODE, mode.passthroughMode.toString());
+ else
+ schemaGen = SchemaGenerators.schemaSpecGen("harry", "table",
1000);
+
+ schema = schemaGen.generate(rng);
+
+ HistoryBuilder harry = new
ReplayingHistoryBuilder(schema.valueGenerators,
+ hb ->
InJvmDTestVisitExecutor.builder()
+
.nodeSelector(new InJvmDTestVisitExecutor.NodeSelector()
+
{
+
private final AtomicLong cnt = new AtomicLong();
+
+
@Override
+
public int select(long lts)
+
{
+
for (int i = 0; i < 42; i++)
+
{
+
int selected = (int) (cnt.getAndIncrement() %
cluster.size() + 1);
+
if (!cluster.get(selected).isShutdown())
+
return selected;
+
}
+
throw new IllegalStateException("Unable to find an alive
instance");
+
}
+
})
+
.retryPolicy(t -> {
+
t = Throwables.getRootCause(t);
+
if (!TIMEOUT_CHECKER.matches(t))
+
return false;
+
+
TxnId id;
+
try
+
{
+
id = TxnId.parse(t.getMessage());
+
}
+
catch (Throwable t2)
+
{
+
return true;
+
}
+
try
+
{
+
var nodes = cluster.stream().filter(i ->
!i.isShutdown()).mapToInt(i -> i.config().num()).toArray();
Review Comment:
I never use var, so this must have been a code copied over.
--
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]

