HADOOP-12689. S3 filesystem operations stopped working correctly

(cherry picked from commit 2d16f40dab)
This commit is contained in:
Ravi Prakash 2016-01-05 23:26:03 -08:00
parent 7458854888
commit 6330683778
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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;