maedhroz commented on code in PR #2540:
URL: https://github.com/apache/cassandra/pull/2540#discussion_r1283926986


##########
test/unit/org/apache/cassandra/index/sai/utils/SAIRandomizedTester.java:
##########
@@ -80,6 +80,29 @@ public static IndexDescriptor newIndexDescriptor() throws 
IOException
                                                                                
.build());
     }
 
+    public static IndexDescriptor newClusteringIndexDescriptor() throws 
IOException
+    {
+        String keyspace = randomSimpleString(5, 13);
+        String table = randomSimpleString(3, 17);
+        TableMetadata metadata = TableMetadata.builder(keyspace, table)
+                                              
.addPartitionKeyColumn(randomSimpleString(3, 15), Int32Type.instance)
+                                              
.addClusteringColumn(randomSimpleString(3,25), Int32Type.instance)
+                                              
.partitioner(Murmur3Partitioner.instance)
+                                              .build();
+        return indexInputLeakDetector.newIndexDescriptor(new Descriptor(new 
File(temporaryFolder.newFolder()),
+                                                                        
randomSimpleString(5, 13),
+                                                                        
randomSimpleString(3, 17),
+                                                                        new 
SequenceBasedSSTableId(getRandom().nextIntBetween(0, 128))),
+                                                         metadata,
+                                                         
SequentialWriterOption.newBuilder()
+                                                                               
.bufferSize(getRandom().nextIntBetween(17, 1 << 13))
+                                                                               
.bufferType(getRandom().nextBoolean() ? BufferType.ON_HEAP : 
BufferType.OFF_HEAP)
+                                                                               
.trickleFsync(getRandom().nextBoolean())
+                                                                               
.trickleFsyncByteInterval(nextInt(1 << 10, 1 << 16))
+                                                                               
.finishOnClose(true)
+                                                                               
.build());

Review Comment:
   Is there any reason we don't just use `IndexFileUtils.DEFAULT_WRITER_OPTION` 
here (and in `newIndexDescriptor()`)? Callers of 
`newClusteringIndexDescriptor()` and `newIndexDescriptor()` don't seem to 
really benefit much from the randomization, as they just perform a single test 
run with an arbitrary ` SequentialWriterOption` rather than performing multiple 
iterations. (I guess you could, for example, run `TermsReaderTest` many times 
manually or wait for it to flake over time in CI...but I don't imagine that's 
the intended outcome.)



-- 
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]

Reply via email to