|
@@ -124,7 +124,7 @@ public class RetriableFileCopyCommand extends RetriableCommand {
|
|
tmpTargetPath, true, BUFFER_SIZE,
|
|
tmpTargetPath, true, BUFFER_SIZE,
|
|
getReplicationFactor(fileAttributes, sourceFileStatus, targetFS, tmpTargetPath),
|
|
getReplicationFactor(fileAttributes, sourceFileStatus, targetFS, tmpTargetPath),
|
|
getBlockSize(fileAttributes, sourceFileStatus, targetFS, tmpTargetPath), context));
|
|
getBlockSize(fileAttributes, sourceFileStatus, targetFS, tmpTargetPath), context));
|
|
- return copyBytes(sourceFileStatus, outStream, BUFFER_SIZE, true, context);
|
|
|
|
|
|
+ return copyBytes(sourceFileStatus, outStream, BUFFER_SIZE, context);
|
|
}
|
|
}
|
|
|
|
|
|
private void compareFileLengths(FileStatus sourceFileStatus, Path target,
|
|
private void compareFileLengths(FileStatus sourceFileStatus, Path target,
|
|
@@ -170,8 +170,8 @@ public class RetriableFileCopyCommand extends RetriableCommand {
|
|
}
|
|
}
|
|
|
|
|
|
private long copyBytes(FileStatus sourceFileStatus, OutputStream outStream,
|
|
private long copyBytes(FileStatus sourceFileStatus, OutputStream outStream,
|
|
- int bufferSize, boolean mustCloseStream,
|
|
|
|
- Mapper.Context context) throws IOException {
|
|
|
|
|
|
+ int bufferSize, Mapper.Context context)
|
|
|
|
+ throws IOException {
|
|
Path source = sourceFileStatus.getPath();
|
|
Path source = sourceFileStatus.getPath();
|
|
byte buf[] = new byte[bufferSize];
|
|
byte buf[] = new byte[bufferSize];
|
|
ThrottledInputStream inStream = null;
|
|
ThrottledInputStream inStream = null;
|
|
@@ -187,8 +187,7 @@ public class RetriableFileCopyCommand extends RetriableCommand {
|
|
bytesRead = inStream.read(buf);
|
|
bytesRead = inStream.read(buf);
|
|
}
|
|
}
|
|
} finally {
|
|
} finally {
|
|
- if (mustCloseStream)
|
|
|
|
- IOUtils.cleanup(LOG, outStream, inStream);
|
|
|
|
|
|
+ IOUtils.cleanup(LOG, outStream, inStream);
|
|
}
|
|
}
|
|
|
|
|
|
return totalBytesRead;
|
|
return totalBytesRead;
|