From bf1f59937dd5d860c9ed7fefce203d6a9f645182 Mon Sep 17 00:00:00 2001 From: Naganarasimha Date: Sun, 2 Jul 2017 15:56:27 +0530 Subject: [PATCH] MAPREDUCE-6905. HADOOP_JOB_HISTORY_OPTS should be HADOOP_JOB_HISTORYSERVER_OPTS in mapred-config.sh. Contributed by LiXin Ge. --- .../test/java/org/apache/hadoop/fs/TestDFSIO.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java index 34eac83ae5..12fbdad814 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/fs/TestDFSIO.java @@ -294,8 +294,17 @@ private void createControlFile(FileSystem fs, int nrFiles ) throws IOException { LOG.info("creating control file: "+nrBytes+" bytes, "+nrFiles+" files"); - + final int maxDirItems = config.getInt( + DFSConfigKeys.DFS_NAMENODE_MAX_DIRECTORY_ITEMS_KEY, + DFSConfigKeys.DFS_NAMENODE_MAX_DIRECTORY_ITEMS_DEFAULT); Path controlDir = getControlDir(config); + + if (nrFiles > maxDirItems) { + final String message = "The directory item limit of " + controlDir + + " is exceeded: limit=" + maxDirItems + " items=" + nrFiles; + throw new IOException(message); + } + fs.delete(controlDir, true); for(int i=0; i < nrFiles; i++) { @@ -310,8 +319,9 @@ private void createControlFile(FileSystem fs, } catch(Exception e) { throw new IOException(e.getLocalizedMessage()); } finally { - if (writer != null) + if (writer != null) { writer.close(); + } writer = null; } }