gaborgsomogyi commented on code in PR #28012:
URL: https://github.com/apache/flink/pull/28012#discussion_r3137184296
##########
flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/NativeS3InputStream.java:
##########
@@ -268,45 +259,16 @@ public void close() throws IOException {
if (closed) {
return;
}
-
closed = true;
- IOException exception = null;
- if (bufferedStream != null) {
- try {
- bufferedStream.close();
- } catch (IOException e) {
- exception = e;
- LOG.warn("Error closing buffered stream for {}/{}",
bucketName, key, e);
- } finally {
- bufferedStream = null;
- }
- }
-
- if (currentStream != null) {
- try {
- currentStream.close();
- } catch (IOException e) {
- if (exception == null) {
- exception = e;
- } else {
- exception.addSuppressed(e);
- }
- LOG.warn("Error closing S3 response stream for {}/{}",
bucketName, key, e);
- } finally {
- currentStream = null;
- }
- }
+ releaseStream();
LOG.debug(
"Closed S3 input stream - bucket: {}, key: {}, final
position: {}/{}",
bucketName,
key,
position,
contentLength);
- if (exception != null) {
- throw exception;
- }
Review Comment:
This is a hidden behavior change. Is this intentional? If yes why?
##########
flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/NativeS3InputStream.java:
##########
@@ -108,24 +108,7 @@ private void lazyInitialize() throws IOException {
private void openStreamAtCurrentPosition() throws IOException {
lock.lock();
try {
- if (bufferedStream != null) {
Review Comment:
This is offtopic in this PR but want to mention. For such places we should
use `@GuardedBy("lock")` to make tools and our life easier otherwise hard to
catch any intention or bug.
##########
flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/NativeS3InputStream.java:
##########
@@ -143,27 +126,35 @@ private void openStreamAtCurrentPosition() throws
IOException {
currentStream = s3Client.getObject(requestBuilder.build());
bufferedStream = new BufferedInputStream(currentStream,
readBufferSize);
} catch (Exception e) {
- if (bufferedStream != null) {
- try {
- bufferedStream.close();
- } catch (IOException ignored) {
- }
- bufferedStream = null;
- }
- if (currentStream != null) {
- try {
- currentStream.close();
- } catch (IOException ignored) {
- }
- currentStream = null;
- }
+ releaseStream();
throw new IOException("Failed to open S3 stream for " +
bucketName + "/" + key, e);
}
} finally {
lock.unlock();
}
}
+ /**
+ * Aborts the in-flight S3 response and releases both stream references.
+ *
+ * <p>We deliberately skip {@link BufferedInputStream#close()} because it
delegates to the
+ * underlying {@link ResponseInputStream#close()}, which drains remaining
bytes.
+ */
Review Comment:
All other functions are guarded by lock (the whole functions). If we don't
put lock here then we must state that it must be called in from guarded places.
Other possibility is add guard.
##########
flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/NativeS3InputStreamTest.java:
##########
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.fs.s3native;
+
+import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.core.ResponseInputStream;
+import software.amazon.awssdk.http.Abortable;
+import software.amazon.awssdk.http.AbortableInputStream;
+import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.model.GetObjectRequest;
+import software.amazon.awssdk.services.s3.model.GetObjectResponse;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.time.Duration;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link NativeS3InputStream}. */
+class NativeS3InputStreamTest {
+
+ private static final String BUCKET = "test-bucket";
+ private static final String KEY = "test-key";
+
+ private static final byte[] DATA;
+
+ static {
+ DATA = new byte[256];
+ for (int i = 0; i < DATA.length; i++) {
+ DATA[i] = (byte) i;
+ }
+ }
+
+ private static class TrackingInputStream extends InputStream implements
Abortable {
+ private final ByteArrayInputStream delegate;
+ private final AtomicBoolean aborted = new AtomicBoolean();
+
+ TrackingInputStream(byte[] data, int offset) {
+ this.delegate = new ByteArrayInputStream(data, offset, data.length
- offset);
+ }
+
+ TrackingInputStream(byte[] data) {
+ this(data, 0);
+ }
+
+ @Override
+ public int read() {
+ return delegate.read();
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) {
+ return delegate.read(b, off, len);
+ }
+
+ @Override
+ public void abort() {
+ aborted.set(true);
+ }
+
+ @Override
+ public void close() throws IOException {
+ delegate.close();
+ }
+
+ boolean wasAborted() {
+ return aborted.get();
+ }
+ }
+
+ /** {@link S3Client} stub. */
+ private static final class StubS3Client implements S3Client {
+ private final byte[] data;
+ private final AtomicInteger getObjectCalls = new AtomicInteger();
+ private volatile TrackingInputStream lastStream;
+
+ StubS3Client(byte[] data) {
+ this.data = data;
+ }
+
+ @Override
+ public ResponseInputStream<GetObjectResponse>
getObject(GetObjectRequest request) {
+ getObjectCalls.incrementAndGet();
+ int offset = 0;
+ String range = request.range();
+ if (range != null && range.startsWith("bytes=")) {
+ offset = Integer.parseInt(range.substring(6,
range.indexOf('-')));
+ }
+ TrackingInputStream tracking = new TrackingInputStream(data,
offset);
+ lastStream = tracking;
+ AbortableInputStream abortable =
AbortableInputStream.create(tracking, tracking);
+ return new ResponseInputStream<>(
+ GetObjectResponse.builder().build(), abortable,
Duration.ZERO);
+ }
+
+ @Override
+ public String serviceName() {
+ return "s3";
+ }
+
+ @Override
+ public void close() {}
+
+ TrackingInputStream lastStream() {
+ return lastStream;
+ }
+
+ int getObjectCalls() {
+ return getObjectCalls.get();
+ }
+ }
+
+ @Test
+ void closeAbortsUnderlyingStream() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ assertThat(in.read()).isEqualTo(0);
+ assertThat(in.getPos()).isEqualTo(1);
+ }
+ assertThat(client.lastStream().wasAborted()).isTrue();
+ }
+
+ @Test
+ void seekAbortsOldStreamAndOpensNew() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ in.read();
+ TrackingInputStream first = client.lastStream();
+
+ in.seek(100);
+
+ assertThat(first.wasAborted()).isTrue();
+ assertThat(client.getObjectCalls()).isEqualTo(2);
+ assertThat(in.getPos()).isEqualTo(100);
+ in.seek(100);
+ assertThat(client.getObjectCalls()).isEqualTo(2);
+ }
+ }
+
+ @Test
+ void skipAbortsOldStreamAndOpensNew() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ in.read();
+ TrackingInputStream first = client.lastStream();
+ assertThat(in.skip(100)).isEqualTo(100);
+ assertThat(first.wasAborted()).isTrue();
+ assertThat(client.getObjectCalls()).isEqualTo(2);
+ // skip(0) and skip(negative) are no-ops
+ assertThat(in.skip(0)).isZero();
+ assertThat(in.skip(-5)).isZero();
+ assertThat(client.getObjectCalls()).isEqualTo(2);
+ }
+ }
+
+ @Test
+ void closeWithoutReadNeverOpensStream() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ // lazy init means no getObject call
+ }
+ assertThat(client.getObjectCalls()).isEqualTo(0);
+ }
+
+ @Test
+ void doubleCloseIsIdempotent() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ NativeS3InputStream in = new NativeS3InputStream(client, BUCKET, KEY,
DATA.length);
+ in.read();
+ in.close();
+ in.close();
+
+ assertThat(client.getObjectCalls()).isEqualTo(1);
+ assertThat(client.lastStream().wasAborted()).isTrue();
+ }
+
+ @Test
+ void seekBeforeFirstReadUpdatesPositionOnly() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ in.seek(50);
+ assertThat(in.getPos()).isEqualTo(50);
+ assertThat(client.getObjectCalls()).isEqualTo(0);
+ }
+ }
+
+ @Test
+ void readAndSeekReturnCorrectData() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ // single-byte read
+ assertThat(in.read()).isEqualTo(0);
+ assertThat(in.getPos()).isEqualTo(1);
+ // bulk read returns correct bytes and advances position
+ byte[] buf = new byte[10];
+ assertThat(in.read(buf, 0, 10)).isEqualTo(10);
+ assertThat(in.getPos()).isEqualTo(11);
+ for (int i = 0; i < 10; i++) {
+ assertThat(buf[i]).isEqualTo(DATA[i + 1]);
+ }
+ // available() reflects remaining bytes
+ assertThat(in.available()).isEqualTo(DATA.length - 11);
+ // seek then read returns data at the seeked position
+ in.seek(200);
+ assertThat(in.read()).isEqualTo(200);
+ assertThat(in.getPos()).isEqualTo(201);
+ // partial read at EOF returns only remaining bytes
+ in.seek(250);
+ byte[] tail = new byte[20];
+ assertThat(in.read(tail, 0, 20)).isEqualTo(6);
+ assertThat(in.getPos()).isEqualTo(256);
+ // read past EOF
Review Comment:
AFAIK hadoop is throwing such case, isn't it?
##########
flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/NativeS3InputStream.java:
##########
@@ -143,27 +126,35 @@ private void openStreamAtCurrentPosition() throws
IOException {
currentStream = s3Client.getObject(requestBuilder.build());
bufferedStream = new BufferedInputStream(currentStream,
readBufferSize);
} catch (Exception e) {
- if (bufferedStream != null) {
- try {
- bufferedStream.close();
- } catch (IOException ignored) {
- }
- bufferedStream = null;
- }
- if (currentStream != null) {
- try {
- currentStream.close();
- } catch (IOException ignored) {
- }
- currentStream = null;
- }
+ releaseStream();
throw new IOException("Failed to open S3 stream for " +
bucketName + "/" + key, e);
}
} finally {
lock.unlock();
}
}
+ /**
+ * Aborts the in-flight S3 response and releases both stream references.
+ *
+ * <p>We deliberately skip {@link BufferedInputStream#close()} because it
delegates to the
+ * underlying {@link ResponseInputStream#close()}, which drains remaining
bytes.
+ */
+ private void releaseStream() {
+ // Drop the wrapper without closing it; closing would trigger the
drain path.
+ bufferedStream = null;
Review Comment:
What makes sure that system resources which are normally freed in `close()`
will be handled properly?
##########
flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/NativeS3InputStreamTest.java:
##########
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.fs.s3native;
+
+import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.core.ResponseInputStream;
+import software.amazon.awssdk.http.Abortable;
+import software.amazon.awssdk.http.AbortableInputStream;
+import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.model.GetObjectRequest;
+import software.amazon.awssdk.services.s3.model.GetObjectResponse;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.time.Duration;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link NativeS3InputStream}. */
+class NativeS3InputStreamTest {
+
+ private static final String BUCKET = "test-bucket";
+ private static final String KEY = "test-key";
+
+ private static final byte[] DATA;
+
+ static {
+ DATA = new byte[256];
+ for (int i = 0; i < DATA.length; i++) {
+ DATA[i] = (byte) i;
+ }
+ }
+
+ private static class TrackingInputStream extends InputStream implements
Abortable {
+ private final ByteArrayInputStream delegate;
+ private final AtomicBoolean aborted = new AtomicBoolean();
+
+ TrackingInputStream(byte[] data, int offset) {
+ this.delegate = new ByteArrayInputStream(data, offset, data.length
- offset);
+ }
+
+ TrackingInputStream(byte[] data) {
+ this(data, 0);
+ }
+
+ @Override
+ public int read() {
+ return delegate.read();
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) {
+ return delegate.read(b, off, len);
+ }
+
+ @Override
+ public void abort() {
+ aborted.set(true);
+ }
+
+ @Override
+ public void close() throws IOException {
+ delegate.close();
+ }
+
+ boolean wasAborted() {
+ return aborted.get();
+ }
+ }
+
+ /** {@link S3Client} stub. */
+ private static final class StubS3Client implements S3Client {
+ private final byte[] data;
+ private final AtomicInteger getObjectCalls = new AtomicInteger();
+ private volatile TrackingInputStream lastStream;
+
+ StubS3Client(byte[] data) {
+ this.data = data;
+ }
+
+ @Override
+ public ResponseInputStream<GetObjectResponse>
getObject(GetObjectRequest request) {
+ getObjectCalls.incrementAndGet();
+ int offset = 0;
+ String range = request.range();
+ if (range != null && range.startsWith("bytes=")) {
+ offset = Integer.parseInt(range.substring(6,
range.indexOf('-')));
+ }
+ TrackingInputStream tracking = new TrackingInputStream(data,
offset);
+ lastStream = tracking;
+ AbortableInputStream abortable =
AbortableInputStream.create(tracking, tracking);
+ return new ResponseInputStream<>(
+ GetObjectResponse.builder().build(), abortable,
Duration.ZERO);
+ }
+
+ @Override
+ public String serviceName() {
+ return "s3";
+ }
+
+ @Override
+ public void close() {}
+
+ TrackingInputStream lastStream() {
+ return lastStream;
+ }
+
+ int getObjectCalls() {
+ return getObjectCalls.get();
+ }
+ }
+
+ @Test
+ void closeAbortsUnderlyingStream() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ assertThat(in.read()).isEqualTo(0);
+ assertThat(in.getPos()).isEqualTo(1);
+ }
+ assertThat(client.lastStream().wasAborted()).isTrue();
+ }
+
+ @Test
+ void seekAbortsOldStreamAndOpensNew() throws Exception {
Review Comment:
This is offtopic here but AFAIK hadoop is kicking forward the offset when
data is available in the buffer. Closing and opening new TLS socket is extreme
resource heavy as a first feeling. List state restore is such a good example,
there are maybe 100k elements which are not consecutive because rescaling
happened. Such seeks can be maybe couple of bytes forth and back. Restoring
that would be quite challanging. Let's discuss this later.
##########
flink-filesystems/flink-s3-fs-native/src/test/java/org/apache/flink/fs/s3native/NativeS3InputStreamTest.java:
##########
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.fs.s3native;
+
+import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.core.ResponseInputStream;
+import software.amazon.awssdk.http.Abortable;
+import software.amazon.awssdk.http.AbortableInputStream;
+import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.model.GetObjectRequest;
+import software.amazon.awssdk.services.s3.model.GetObjectResponse;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.time.Duration;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link NativeS3InputStream}. */
+class NativeS3InputStreamTest {
+
+ private static final String BUCKET = "test-bucket";
+ private static final String KEY = "test-key";
+
+ private static final byte[] DATA;
+
+ static {
+ DATA = new byte[256];
+ for (int i = 0; i < DATA.length; i++) {
+ DATA[i] = (byte) i;
+ }
+ }
+
+ private static class TrackingInputStream extends InputStream implements
Abortable {
+ private final ByteArrayInputStream delegate;
+ private final AtomicBoolean aborted = new AtomicBoolean();
+
+ TrackingInputStream(byte[] data, int offset) {
+ this.delegate = new ByteArrayInputStream(data, offset, data.length
- offset);
+ }
+
+ TrackingInputStream(byte[] data) {
+ this(data, 0);
+ }
+
+ @Override
+ public int read() {
+ return delegate.read();
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) {
+ return delegate.read(b, off, len);
+ }
+
+ @Override
+ public void abort() {
+ aborted.set(true);
+ }
+
+ @Override
+ public void close() throws IOException {
+ delegate.close();
+ }
+
+ boolean wasAborted() {
+ return aborted.get();
+ }
+ }
+
+ /** {@link S3Client} stub. */
+ private static final class StubS3Client implements S3Client {
+ private final byte[] data;
+ private final AtomicInteger getObjectCalls = new AtomicInteger();
+ private volatile TrackingInputStream lastStream;
+
+ StubS3Client(byte[] data) {
+ this.data = data;
+ }
+
+ @Override
+ public ResponseInputStream<GetObjectResponse>
getObject(GetObjectRequest request) {
+ getObjectCalls.incrementAndGet();
+ int offset = 0;
+ String range = request.range();
+ if (range != null && range.startsWith("bytes=")) {
+ offset = Integer.parseInt(range.substring(6,
range.indexOf('-')));
+ }
+ TrackingInputStream tracking = new TrackingInputStream(data,
offset);
+ lastStream = tracking;
+ AbortableInputStream abortable =
AbortableInputStream.create(tracking, tracking);
+ return new ResponseInputStream<>(
+ GetObjectResponse.builder().build(), abortable,
Duration.ZERO);
+ }
+
+ @Override
+ public String serviceName() {
+ return "s3";
+ }
+
+ @Override
+ public void close() {}
+
+ TrackingInputStream lastStream() {
+ return lastStream;
+ }
+
+ int getObjectCalls() {
+ return getObjectCalls.get();
+ }
+ }
+
+ @Test
+ void closeAbortsUnderlyingStream() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ assertThat(in.read()).isEqualTo(0);
+ assertThat(in.getPos()).isEqualTo(1);
+ }
+ assertThat(client.lastStream().wasAborted()).isTrue();
+ }
+
+ @Test
+ void seekAbortsOldStreamAndOpensNew() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ in.read();
+ TrackingInputStream first = client.lastStream();
+
+ in.seek(100);
+
+ assertThat(first.wasAborted()).isTrue();
+ assertThat(client.getObjectCalls()).isEqualTo(2);
+ assertThat(in.getPos()).isEqualTo(100);
+ in.seek(100);
+ assertThat(client.getObjectCalls()).isEqualTo(2);
+ }
+ }
+
+ @Test
+ void skipAbortsOldStreamAndOpensNew() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ in.read();
+ TrackingInputStream first = client.lastStream();
+ assertThat(in.skip(100)).isEqualTo(100);
+ assertThat(first.wasAborted()).isTrue();
+ assertThat(client.getObjectCalls()).isEqualTo(2);
+ // skip(0) and skip(negative) are no-ops
+ assertThat(in.skip(0)).isZero();
+ assertThat(in.skip(-5)).isZero();
+ assertThat(client.getObjectCalls()).isEqualTo(2);
+ }
+ }
+
+ @Test
+ void closeWithoutReadNeverOpensStream() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ try (NativeS3InputStream in = new NativeS3InputStream(client, BUCKET,
KEY, DATA.length)) {
+ // lazy init means no getObject call
+ }
+ assertThat(client.getObjectCalls()).isEqualTo(0);
+ }
+
+ @Test
+ void doubleCloseIsIdempotent() throws Exception {
+ StubS3Client client = new StubS3Client(DATA);
+ NativeS3InputStream in = new NativeS3InputStream(client, BUCKET, KEY,
DATA.length);
+ in.read();
+ in.close();
+ in.close();
Review Comment:
Maybe we can check states in between
--
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]