This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new 98eb59d ORC-1014. Add details when we get IOException from the file
system (#924)
98eb59d is described below
commit 98eb59dd5567bb912f075af9b7fa5076c0de2fa5
Author: Owen O'Malley <[email protected]>
AuthorDate: Tue Oct 26 00:27:03 2021 -0700
ORC-1014. Add details when we get IOException from the file system (#924)
### What changes were proposed in this pull request?
It catches and wraps IOException in the data reader to give information
about the range of bytes that the reader was trying to read.
### Why are the changes needed?
To help debugging.
```
"Caused by: java.io.IOException: Failed while reading
org.apache.hadoop.fs.FSDataInputStream@2f1173dd:
S3AInputStream{s3a://.orc wrappedStream=open read policy=random pos=65539
nextReadPos=0
contentLength=121693 contentRangeStart=3 contentRangeFinish=65539
remainingInCurrentRequest=0
StreamStatistics{OpenOperations=5, CloseOperations=4, Closed=4, Aborted=0,
SeekOperations=7, ReadExceptions=0,
ForwardSeekOperations=3, BackwardSeekOperations=4, BytesSkippedOnSeek=148,
BytesBackwardsOnSeek=146391,
BytesRead=106621, BytesRead excluding skipped=106473, ReadOperations=15,
ReadFullyOperations=8,
ReadsIncomplete=8, BytesReadInClose=64722, BytesDiscardedInAbort=0,
InputPolicy=2, InputPolicySetCount=2}}"
```
### How was this patch tested?
By reading files in S3 with a version of Hadoop that had HADOOP-16109.
---
java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java
b/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java
index 39f9118..afdbde6 100644
--- a/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java
+++ b/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java
@@ -414,7 +414,15 @@ public class RecordReaderUtils {
long offset = first.getOffset();
int readSize = (int) (computeEnd(first, last) - offset);
byte[] buffer = new byte[readSize];
- file.readFully(offset, buffer, 0, buffer.length);
+ try {
+ file.readFully(offset, buffer, 0, buffer.length);
+ } catch(IOException e) {
+ throw new IOException(String.format("Failed while reading %s %d:%d",
+ file,
+ offset,
+ buffer.length),
+ e);
+ }
// get the data into a ByteBuffer
ByteBuffer bytes;