HDFS-16274. Improve error msg for FSNamesystem#startFileInt (#3554)

* HDFS-16274. Improve log for FSNamesystem#startFileInt

* fix failed unit test
This commit is contained in:
litao 2021-10-16 01:11:38 +08:00 committed by GitHub
parent cb2b7970ee
commit d72e2cb786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -2722,11 +2722,10 @@ private HdfsFileStatus startFileInt(String src,
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) {

View File

@ -210,8 +210,9 @@ public void testMinBlockSizeLimit() throws Exception {
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();