thecoop commented on code in PR #16619:
URL: https://github.com/apache/lucene/pull/16619#discussion_r3914199497


##########
lucene/misc/src/test/org/apache/lucene/misc/store/TestDirectIODirectory.java:
##########
@@ -218,6 +219,245 @@ public void testUseDirectIODefaults() throws Exception {
     }
   }
 
+  private static byte[] writeRandomFile(Directory dir, String name, int size) 
throws IOException {
+    byte[] bytes = new byte[size];
+    random().nextBytes(bytes);
+    try (IndexOutput o = dir.createOutput(name, IOContext.DEFAULT)) {
+      o.writeBytes(bytes, 0, size);
+    }
+    return bytes;
+  }
+
+  public void testSliceDefersIOAtEveryOffset() throws Exception {
+    Path path = createTempDir("testSliceDefersIOAtEveryOffset");
+    final int blockSize = 
Math.toIntExact(Files.getFileStore(path).getBlockSize());
+    final int fileSize = 4 * blockSize;
+    try (Directory dir = getDirectory(path)) {
+      byte[] bytes = writeRandomFile(dir, "out", fileSize);
+      final long[] offsets = {
+        0, 1, 7, 96, blockSize, blockSize + 188, 2L * blockSize, 3L * 
blockSize - 4

Review Comment:
   Are these specific values? Could they be randomized?



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