HADOOP-12689. S3 filesystem operations stopped working correctly

This commit is contained in:
Ravi Prakash 2016-01-05 23:26:03 -08:00
parent c52b407cbf
commit 2d16f40dab
2 changed files with 9 additions and 2 deletions

View File

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

View File

@ -173,7 +173,7 @@ private InputStream get(String key, boolean checkMetadata)
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 @@ public File retrieveBlock(Block block, long byteRangeStart)
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;