You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SearchableSnapshotIndexInput should read all bytes (#52199)
This commit fixes a bug in SearchableSnapshotIndexInput which does
not use the InputStream.read(byte[], int, int) method correctly.
The javadoc indicates that: "An attempt is made to read as many as
len bytes, but a smaller number may be read." Consequently,
SearchableSnapshotIndexInput should try to read more bytes when
a first reading operation has not brought back all the requested bytes.
Copy file name to clipboardExpand all lines: x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/SearchableSnapshotIndexInput.java
Copy file name to clipboardExpand all lines: x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/index/store/SearchableSnapshotIndexInputTests.java
+17-2Lines changed: 17 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,9 @@
16
16
17
17
importjava.io.ByteArrayInputStream;
18
18
importjava.io.EOFException;
19
+
importjava.io.FilterInputStream;
19
20
importjava.io.IOException;
21
+
importjava.io.InputStream;
20
22
importjava.nio.charset.StandardCharsets;
21
23
importjava.util.concurrent.atomic.AtomicInteger;
22
24
@@ -64,9 +66,10 @@ private SearchableSnapshotIndexInput createIndexInput(final byte[] input, long p
64
66
65
67
onReadBlob.run();
66
68
69
+
finalInputStreamstream;
67
70
if (fileInfo.numberOfParts() == 1L) {
68
71
assertThat("Unexpected blob name [" + name + "]", name, equalTo(fileInfo.name()));
0 commit comments