Skip to content

Commit

Permalink
[test] Fix flaky test VectoredReadUtilsTest.testRandom
Browse files Browse the repository at this point in the history
  • Loading branch information
Zouxxyy committed May 30, 2024
1 parent 2da5098 commit 71fbe24
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public static void readVectored(VectoredReadable readable, List<? extends FileRa

int parallelism = readable.parallelismForVectorReads();

if (combinedRanges.size() == 1) {
fallbackToReadSequence(readable, sortRanges);
if (combinedRanges.size() == 1 && readable instanceof SeekableInputStream) {
fallbackToReadSequence((SeekableInputStream) readable, sortRanges);
return;
}

Expand All @@ -78,8 +78,7 @@ public static void readVectored(VectoredReadable readable, List<? extends FileRa
}

private static void fallbackToReadSequence(
VectoredReadable readable, List<? extends FileRange> ranges) throws IOException {
SeekableInputStream in = (SeekableInputStream) readable;
SeekableInputStream in, List<? extends FileRange> ranges) throws IOException {
for (FileRange range : ranges) {
byte[] bytes = new byte[range.getLength()];
in.seek(range.getOffset());
Expand Down

0 comments on commit 71fbe24

Please sign in to comment.