[ 
https://issues.apache.org/jira/browse/HADOOP-18184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17749924#comment-17749924
 ] 

ASF GitHub Bot commented on HADOOP-18184:
-----------------------------------------

steveloughran commented on code in PR #5832:
URL: https://github.com/apache/hadoop/pull/5832#discussion_r1280864279


##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/prefetch/S3ARemoteInputStream.java:
##########
@@ -339,49 +367,67 @@ public int read(byte[] buffer, int offset, int len) 
throws IOException {
       numBytesRemaining -= bytesToRead;
       numBytesRead += bytesToRead;
     }
-
     return numBytesRead;
   }
 
-  protected S3ARemoteObject getFile() {
+  /**
+   * Forward to superclass after updating the read fully IOStatistics
+   * {@inheritDoc}
+   */
+  @Override
+  public void readFully(final long position,
+      final byte[] buffer,
+      final int offset,
+      final int length) throws IOException {
+    throwIfClosed();
+    validatePositionedReadArgs(position, buffer, offset, length);
+    streamStatistics.readFullyOperationStarted(position, length);
+    super.readFully(position, buffer, offset, length);
+  }
+
+  protected final S3ARemoteObject getRemoteObject() {
     return remoteObject;
   }
 
-  protected S3ARemoteObjectReader getReader() {
+  protected final S3ARemoteObjectReader getReader() {
     return reader;
   }
 
-  protected S3ObjectAttributes getS3ObjectAttributes() {
+  protected final S3ObjectAttributes getS3ObjectAttributes() {
     return s3Attributes;
   }
 
-  protected FilePosition getFilePosition() {
+  protected final FilePosition getFilePosition() {
     return fpos;
   }
 
-  protected String getName() {
+  protected final String getName() {
     return name;
   }
 
-  protected boolean isClosed() {
-    return closed;
+  protected final boolean isClosed() {
+    return closed.get();
+  }
+
+  protected final boolean underlyingResourcesClosed() {
+    return underlyingResourcesClosed.get();
   }
 
-  protected long getNextReadPos() {
+  protected final long getNextReadPos() {
     return nextReadPos;
   }
 
-  protected BlockData getBlockData() {
+  protected final BlockData getBlockData() {
     return blockData;
   }
 
-  protected S3AReadOpContext getContext() {
+  protected final S3AReadOpContext getContext() {
     return context;
   }
 
   private void incrementBytesRead(int bytesRead) {
     if (bytesRead > 0) {
-      streamStatistics.bytesRead(bytesRead);
+      streamStatistics.bytesReadFromBuffer(bytesRead);

Review Comment:
   trying to differentiate bytes we read remotely vs bytes which were returned 
from cached data. 





> s3a prefetching stream to support unbuffer()
> --------------------------------------------
>
>                 Key: HADOOP-18184
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18184
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/s3
>    Affects Versions: 3.4.0
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>            Priority: Minor
>              Labels: pull-request-available
>
> Apache Impala uses unbuffer() to free up all client side resources held by a 
> stream, so allowing it to have a map of available (path -> stream) objects, 
> retained across queries.
> This saves on having to reopen the files, with the cost of HEAD checks etc. 
> S3AInputStream just closes its http connection. here there is a lot more 
> state to discard, but all memory and file storage must be freed.
> until this done, ITestS3AContractUnbuffer must skip when the prefetch stream 
> is used.
> its notable that the other tests don't fail, even though the stream doesn't 
> implement the interface; the graceful degradation handles that. it should 
> fail if the test xml resource says the stream does it, but that the stream 
> capabilities say it doesn't.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to