HADOOP-11283. SequenceFile.Writer can leak file descriptors in DistCpV1#setup(). (Contributed by Varun Saxena via ozawa)
This commit is contained in:
parent
b256dd7600
commit
a164ce2ac9
@ -650,6 +650,9 @@ Release 2.7.0 - UNRELEASED
|
||||
HADOOP-11414. FileBasedIPList#readLines() can leak file descriptors.
|
||||
(ozawa)
|
||||
|
||||
HADOOP-11283. SequenceFile.Writer can leak file descriptors in
|
||||
DistCpV1#setup(). (Varun Saxena via ozawa)
|
||||
|
||||
Release 2.6.0 - 2014-11-18
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -1258,30 +1258,29 @@ static boolean setup(Configuration conf, JobConf jobConf,
|
||||
FileSystem jobfs = jobDirectory.getFileSystem(jobConf);
|
||||
|
||||
Path srcfilelist = new Path(jobDirectory, "_distcp_src_files");
|
||||
jobConf.set(SRC_LIST_LABEL, srcfilelist.toString());
|
||||
SequenceFile.Writer src_writer = SequenceFile.createWriter(jobfs, jobConf,
|
||||
srcfilelist, LongWritable.class, FilePair.class,
|
||||
SequenceFile.CompressionType.NONE);
|
||||
|
||||
Path dstfilelist = new Path(jobDirectory, "_distcp_dst_files");
|
||||
SequenceFile.Writer dst_writer = SequenceFile.createWriter(jobfs, jobConf,
|
||||
dstfilelist, Text.class, Text.class,
|
||||
SequenceFile.CompressionType.NONE);
|
||||
|
||||
Path dstdirlist = new Path(jobDirectory, "_distcp_dst_dirs");
|
||||
jobConf.set(SRC_LIST_LABEL, srcfilelist.toString());
|
||||
jobConf.set(DST_DIR_LIST_LABEL, dstdirlist.toString());
|
||||
SequenceFile.Writer dir_writer = SequenceFile.createWriter(jobfs, jobConf,
|
||||
dstdirlist, Text.class, FilePair.class,
|
||||
int srcCount = 0, cnsyncf = 0, dirsyn = 0;
|
||||
long fileCount = 0L, dirCount = 0L, byteCount = 0L, cbsyncs = 0L,
|
||||
skipFileCount = 0L, skipByteCount = 0L;
|
||||
try (
|
||||
SequenceFile.Writer src_writer = SequenceFile.createWriter(jobfs,
|
||||
jobConf, srcfilelist, LongWritable.class, FilePair.class,
|
||||
SequenceFile.CompressionType.NONE);
|
||||
|
||||
SequenceFile.Writer dst_writer = SequenceFile.createWriter(jobfs,
|
||||
jobConf, dstfilelist, Text.class, Text.class,
|
||||
SequenceFile.CompressionType.NONE);
|
||||
SequenceFile.Writer dir_writer = SequenceFile.createWriter(jobfs,
|
||||
jobConf, dstdirlist, Text.class, FilePair.class,
|
||||
SequenceFile.CompressionType.NONE)
|
||||
) {
|
||||
// handle the case where the destination directory doesn't exist
|
||||
// and we've only a single src directory OR we're updating/overwriting
|
||||
// the contents of the destination directory.
|
||||
final boolean special =
|
||||
(args.srcs.size() == 1 && !dstExists) || update || overwrite;
|
||||
int srcCount = 0, cnsyncf = 0, dirsyn = 0;
|
||||
long fileCount = 0L, dirCount = 0L, byteCount = 0L, cbsyncs = 0L,
|
||||
skipFileCount = 0L, skipByteCount = 0L;
|
||||
|
||||
Path basedir = null;
|
||||
HashSet<Path> parentDirsToCopy = new HashSet<Path>();
|
||||
@ -1293,7 +1292,6 @@ static boolean setup(Configuration conf, JobConf jobConf,
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
for(Iterator<Path> srcItr = args.srcs.iterator(); srcItr.hasNext(); ) {
|
||||
final Path src = srcItr.next();
|
||||
FileSystem srcfs = src.getFileSystem(conf);
|
||||
@ -1426,10 +1424,6 @@ static boolean setup(Configuration conf, JobConf jobConf,
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
checkAndClose(src_writer);
|
||||
checkAndClose(dst_writer);
|
||||
checkAndClose(dir_writer);
|
||||
}
|
||||
LOG.info("sourcePathsCount(files+directories)=" + srcCount);
|
||||
LOG.info("filesToCopyCount=" + fileCount);
|
||||
|
Loading…
Reference in New Issue
Block a user