HADOOP-11088. Quash unnecessary safemode WARN message during NameNode startup. Contributed by Yiqun Lin.
(cherry picked from commit 5cad93d5c7
)
This commit is contained in:
parent
6d0cea4a5a
commit
9ede5ccfdd
|
@ -36,6 +36,7 @@ import org.apache.hadoop.net.NetworkTopology;
|
||||||
import org.apache.hadoop.util.Daemon;
|
import org.apache.hadoop.util.Daemon;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -127,8 +128,8 @@ class BlockManagerSafeMode {
|
||||||
this.threshold = conf.getFloat(DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_KEY,
|
this.threshold = conf.getFloat(DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_KEY,
|
||||||
DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_DEFAULT);
|
DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_DEFAULT);
|
||||||
if (this.threshold > 1.0) {
|
if (this.threshold > 1.0) {
|
||||||
LOG.warn("The threshold value should't be greater than 1, threshold: {}",
|
LOG.warn("The threshold value shouldn't be greater than 1, " +
|
||||||
threshold);
|
"threshold: {}", threshold);
|
||||||
}
|
}
|
||||||
this.datanodeThreshold = conf.getInt(
|
this.datanodeThreshold = conf.getInt(
|
||||||
DFS_NAMENODE_SAFEMODE_MIN_DATANODES_KEY,
|
DFS_NAMENODE_SAFEMODE_MIN_DATANODES_KEY,
|
||||||
|
@ -171,7 +172,8 @@ class BlockManagerSafeMode {
|
||||||
startTime = monotonicNow();
|
startTime = monotonicNow();
|
||||||
setBlockTotal(total);
|
setBlockTotal(total);
|
||||||
if (areThresholdsMet()) {
|
if (areThresholdsMet()) {
|
||||||
leaveSafeMode(true);
|
boolean exitResult = leaveSafeMode(false);
|
||||||
|
Preconditions.checkState(exitResult, "Failed to leave safe mode.");
|
||||||
} else {
|
} else {
|
||||||
// enter safe mode
|
// enter safe mode
|
||||||
status = BMSafeModeStatus.PENDING_THRESHOLD;
|
status = BMSafeModeStatus.PENDING_THRESHOLD;
|
||||||
|
|
Loading…
Reference in New Issue