mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Enable skip methods on retrying inputstreams (#96337)
Currently we have a number of input streams that specifically override the skip() method disabling the ability to skip bytes. In each case the skip implementation works as we have properly implemented the read(byte[]) methods used to discard bytes. However, we appear to have disabled it as it would be possible to retry from the end of a skip if there is a failure in the middle. At this time, that optimization is not really necessary, however, we sporadically used skip so it would be nice for the IS to support the method. This commit enables the super.skip() and adds a comment about future optimizations.
This commit is contained in:
parent
3c5d96d2eb
commit
ac829edc55
4 changed files with 12 additions and 11 deletions
|
@ -765,11 +765,6 @@ public class AzureBlobStore implements BlobStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long skip(long n) {
|
|
||||||
throw new UnsupportedOperationException("skip is not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void releaseByteBuf(ByteBuf buf) {
|
private void releaseByteBuf(ByteBuf buf) {
|
||||||
ReferenceCountUtil.safeRelease(buf);
|
ReferenceCountUtil.safeRelease(buf);
|
||||||
this.byteBuf = null;
|
this.byteBuf = null;
|
||||||
|
|
|
@ -246,8 +246,10 @@ class GoogleCloudStorageRetryingInputStream extends InputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long skip(long n) {
|
public long skip(long n) throws IOException {
|
||||||
throw new UnsupportedOperationException("GoogleCloudStorageRetryingInputStream does not support seeking");
|
// This could be optimized on a failure by re-opening stream directly to the preferred location. However, it is rarely called,
|
||||||
|
// so for now we will rely on the default implementation which just discards bytes by reading.
|
||||||
|
return super.skip(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -225,8 +225,10 @@ class S3RetryingInputStream extends InputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long skip(long n) {
|
public long skip(long n) throws IOException {
|
||||||
throw new UnsupportedOperationException("S3RetryingInputStream does not support seeking");
|
// This could be optimized on a failure by re-opening stream directly to the preferred location. However, it is rarely called,
|
||||||
|
// so for now we will rely on the default implementation which just discards bytes by reading.
|
||||||
|
return super.skip(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -112,8 +112,10 @@ class RetryingHttpInputStream extends InputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long skip(long n) {
|
public long skip(long n) throws IOException {
|
||||||
throw new UnsupportedOperationException("RetryingHttpInputStream does not support seeking");
|
// This could be optimized on a failure by re-opening stream directly to the preferred location. However, it is rarely called,
|
||||||
|
// so for now we will rely on the default implementation which just discards bytes by reading.
|
||||||
|
return super.skip(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue