Forráskód Böngészése

HADOOP-12689. S3 filesystem operations stopped working correctly

(cherry picked from commit 2d16f40dab291a29b3fc005221b12fd587615d4e)
Ravi Prakash 9 éve
szülő
commit
6330683778

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -923,6 +923,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12608. Fix exception message in WASB when connecting with anonymous
     credential. (Dushyanth via xyao)
 
+    HADOOP-12689. S3 filesystem operations stopped working correctly
+    (Matt Paduano via raviprak)
+
 Release 2.7.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 6 - 2
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3/Jets3tFileSystemStore.java

@@ -167,7 +167,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();
@@ -229,7 +229,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;