HDFS-3325. When configuring 'dfs.namenode.safemode.threshold-pct' to a value greater or equal to 1 there is mismatch in the UI report (Contributed by J.Andreina)

This commit is contained in:
Vinayakumar B 2015-03-24 12:12:01 +05:30
parent fbceb3b418
commit c6c396fcd6
4 changed files with 7 additions and 3 deletions

View File

@ -338,6 +338,10 @@ Release 2.8.0 - UNRELEASED
HDFS-7867. Update action param from "start" to "prepare" in rolling upgrade HDFS-7867. Update action param from "start" to "prepare" in rolling upgrade
javadoc (J.Andreina via vinayakumarb) javadoc (J.Andreina via vinayakumarb)
HDFS-3325. When configuring "dfs.namenode.safemode.threshold-pct" to a value
greater or equal to 1 there is mismatch in the UI report
(J.Andreina via vinayakumarb)
Release 2.7.0 - UNRELEASED Release 2.7.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -5417,7 +5417,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
msg += String.format( msg += String.format(
"The reported blocks %d needs additional %d" "The reported blocks %d needs additional %d"
+ " blocks to reach the threshold %.4f of total blocks %d.%n", + " blocks to reach the threshold %.4f of total blocks %d.%n",
blockSafe, (blockThreshold - blockSafe) + 1, threshold, blockTotal); blockSafe, (blockThreshold - blockSafe), threshold, blockTotal);
thresholdsMet = false; thresholdsMet = false;
} else { } else {
msg += String.format("The reported blocks %d has reached the threshold" msg += String.format("The reported blocks %d has reached the threshold"

View File

@ -198,7 +198,7 @@ public class TestSafeMode {
String status = nn.getNamesystem().getSafemode(); String status = nn.getNamesystem().getSafemode();
assertEquals("Safe mode is ON. The reported blocks 0 needs additional " + assertEquals("Safe mode is ON. The reported blocks 0 needs additional " +
"15 blocks to reach the threshold 0.9990 of total blocks 15." + NEWLINE + "14 blocks to reach the threshold 0.9990 of total blocks 15." + NEWLINE +
"The number of live datanodes 0 has reached the minimum number 0. " + "The number of live datanodes 0 has reached the minimum number 0. " +
"Safe mode will be turned off automatically once the thresholds " + "Safe mode will be turned off automatically once the thresholds " +
"have been reached.", status); "have been reached.", status);

View File

@ -498,7 +498,7 @@ public class TestHASafeMode {
+ nodeThresh + ". In safe mode extension. " + nodeThresh + ". In safe mode extension. "
+ "Safe mode will be turned off automatically")); + "Safe mode will be turned off automatically"));
} else { } else {
int additional = total - safe; int additional = (int) (total * 0.9990) - safe;
assertTrue("Bad safemode status: '" + status + "'", assertTrue("Bad safemode status: '" + status + "'",
status.startsWith( status.startsWith(
"Safe mode is ON. " + "Safe mode is ON. " +