[
https://issues.apache.org/jira/browse/HADOOP-15245?focusedWorklogId=741699&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-741699
]
ASF GitHub Bot logged work on HADOOP-15245:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 15/Mar/22 15:46
Start Date: 15/Mar/22 15:46
Worklog Time Spent: 10m
Work Description: ahmarsuhail commented on a change in pull request #3927:
URL: https://github.com/apache/hadoop/pull/3927#discussion_r827130861
##########
File path:
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInputStream.java
##########
@@ -781,6 +781,46 @@ public void readFully(long position, byte[] buffer, int
offset, int length)
}
}
+ /**
+ * {@inheritDoc}
+ *
+ * This implements a more efficient method for skip. It calls lazy seek
+ * which will either make a new get request or do a default skip.
+ * If lazy seek fails, try doing a default skip.
+ *
+ * @param n Number of bytes to be skipped
+ * @return Number of bytes skipped
+ * @throws IOException on any problem
+ */
+ @Override
+ @Retries.OnceTranslated
+ public long skip(final long n) throws IOException {
+
+ if (n <= 0) {
+ return 0;
+ }
+
+ checkNotClosed();
+ streamStatistics.skipOperationStarted();
+
+ long targetPos = pos + n;
Review comment:
from what I understand getPos() returns `nextReadPos` which is currently
not updated in `reopen()` or `seekInStream()`. To do that, I can add
`nextReadPos = targePos` after
[this](https://github.com/apache/hadoop/blob/trunk/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInputStream.java#L239)
&
[this](https://github.com/apache/hadoop/blob/trunk/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInputStream.java#L352),
and also `nextReadPos += skipped` after
[this](https://github.com/apache/hadoop/blob/trunk/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInputStream.java#L313),
but not sure if we want to do this?
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 741699)
Time Spent: 2.5h (was: 2h 20m)
> S3AInputStream.skip() to use lazy seek
> --------------------------------------
>
> Key: HADOOP-15245
> URL: https://issues.apache.org/jira/browse/HADOOP-15245
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs/s3
> Affects Versions: 3.1.0
> Reporter: Steve Loughran
> Priority: Major
> Labels: pull-request-available
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> the default skip() does a read and discard of all bytes, no matter how far
> ahead the skip is. This is very inefficient if the skip() is being done on
> S3A random IO, though exactly what to do when in sequential mode.
> Proposed:
> * add an optimized version of S3AInputStream.skip() which does a lazy seek,
> which itself will decided when to skip() vs issue a new GET.
> * add some more instrumentation to measure how often this gets used
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]