HADOOP-12689. S3 filesystem operations stopped working correctly

Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2d16f40d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2d16f40d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2d16f40d

Branch: refs/heads/HDFS-1312
Commit: 2d16f40dab291a29b3fc005221b12fd587615d4e
Parents: c52b407
Author: Ravi Prakash <[email protected]>
Authored: Tue Jan 5 23:26:03 2016 -0800
Committer: Ravi Prakash <[email protected]>
Committed: Tue Jan 5 23:26:03 2016 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt              | 3 +++
 .../java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java  | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2d16f40d/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt 
b/hadoop-common-project/hadoop-common/CHANGES.txt
index 863d047..1b867f0 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -1550,6 +1550,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12682. Fix TestKMS#testKMSRestart* failure.
     (Wei-Chiu Chuang via xyao)
 
+    HADOOP-12689. S3 filesystem operations stopped working correctly
+    (Matt Paduano via raviprak)
+
 Release 2.7.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2d16f40d/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
 
b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
index 5f46aea..a186c14 100644
--- 
a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
+++ 
b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java
@@ -173,7 +173,7 @@ class Jets3tFileSystemStore implements FileSystemStore {
       return object.getDataInputStream();
     } catch (S3ServiceException e) {
       if ("NoSuchKey".equals(e.getS3ErrorCode())) {
-        throw new IOException(key + " doesn't exist");
+        return null;
       }
       if (e.getCause() instanceof IOException) {
         throw (IOException) e.getCause();
@@ -241,7 +241,11 @@ class Jets3tFileSystemStore implements FileSystemStore {
     OutputStream out = null;
     try {
       fileBlock = newBackupFile();
-      in = get(blockToKey(block), byteRangeStart);
+      String blockId = blockToKey(block);
+      in = get(blockId, byteRangeStart);
+      if (in == null) {
+        throw new IOException("Block missing from S3 store: " + blockId);
+      }
       out = new BufferedOutputStream(new FileOutputStream(fileBlock));
       byte[] buf = new byte[bufferSize];
       int numRead;

Reply via email to