From d72e2cb7861ec5c85eaf00334523b39726ee3324 Mon Sep 17 00:00:00 2001 From: litao Date: Sat, 16 Oct 2021 01:11:38 +0800 Subject: [PATCH] HDFS-16274. Improve error msg for FSNamesystem#startFileInt (#3554) * HDFS-16274. Improve log for FSNamesystem#startFileInt * fix failed unit test --- .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 7 +++---- .../apache/hadoop/hdfs/server/namenode/TestFileLimit.java | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 1fb6238c39b..7ad90ac1a93 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -2722,11 +2722,10 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, iip = FSDirWriteFileOp.resolvePathForStartFile( dir, pc, src, flag, createParent); - if (blockSize < minBlockSize) { - throw new IOException("Specified block size is less than configured" + - " minimum value (" + DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY - + "): " + blockSize + " < " + minBlockSize); + throw new IOException("Specified block size " + blockSize + + " is less than configured minimum value " + + DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY + "=" + minBlockSize); } if (shouldReplicate) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java index 636dc6059f1..d5a04c8e4ff 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java @@ -210,8 +210,9 @@ public class TestFileLimit { assert false : "Expected IOException after creating a file with small" + " blocks "; } catch (IOException e) { - GenericTestUtils.assertExceptionContains("Specified block size is less", - e); + GenericTestUtils.assertExceptionContains( + "is less than configured minimum value " + + "dfs.namenode.fs-limits.min-block-size=", e); } } finally { cluster.shutdown();