diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
index a8a87ad8c9c..cea38d63965 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
@@ -2027,6 +2027,8 @@ public static boolean isAclEnabled(Configuration conf) {
* marked as offline. Values can range from 0.0 to 100.0. If the value is
* greater than or equal to 100, NM will check for full disk. This applies to
* nm-local-dirs and nm-log-dirs.
+ *
+ * This applies when disk-utilization-threshold-enabled is true.
*/
public static final String NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE =
NM_DISK_HEALTH_CHECK_PREFIX + "max-disk-utilization-per-disk-percentage";
@@ -2036,6 +2038,17 @@ public static boolean isAclEnabled(Configuration conf) {
public static final float DEFAULT_NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE =
90.0F;
+ /**
+ * Enable/Disable the disk utilisation percentage
+ * threshold for disk health checker.
+ */
+ public static final String NM_DISK_UTILIZATION_THRESHOLD_ENABLED =
+ NM_DISK_HEALTH_CHECK_PREFIX +
+ "disk-utilization-threshold-enabled";
+
+ public static final
+ boolean DEFAULT_NM_DISK_UTILIZATION_THRESHOLD_ENABLED = true;
+
/**
* The low threshold percentage of disk space used when an offline disk is
* marked as online. Values can range from 0.0 to 100.0. The value shouldn't
@@ -2051,9 +2064,23 @@ public static boolean isAclEnabled(Configuration conf) {
/**
* The minimum space that must be available on a local dir for it to be used.
* This applies to nm-local-dirs and nm-log-dirs.
+ *
+ * This applies when disk-free-space-threshold-enabled is true.
*/
public static final String NM_MIN_PER_DISK_FREE_SPACE_MB =
NM_DISK_HEALTH_CHECK_PREFIX + "min-free-space-per-disk-mb";
+
+ /**
+ * Enable/Disable the minimum disk free
+ * space threshold for disk health checker.
+ */
+ public static final String NM_DISK_FREE_SPACE_THRESHOLD_ENABLED =
+ NM_DISK_HEALTH_CHECK_PREFIX +
+ "disk-free-space-threshold-enabled";
+
+ public static final boolean
+ DEFAULT_NM_DISK_FREE_SPACE_THRESHOLD_ENABLED = true;
+
/**
* The minimum space that must be available on an offline
* disk for it to be marked as online. The value should not be less
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
index f7d9fc1d2b0..6d6ae415770 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
@@ -1809,12 +1809,27 @@
0.25
+
+ Enable/Disable the disk utilisation percentage
+ threshold for disk health checker.
+ yarn.nodemanager.disk-health-checker.disk-utilization-threshold-enabled
+ true
+
+
+
+ Enable/Disable the minimum disk free
+ space threshold for disk health checker.
+ yarn.nodemanager.disk-health-checker.disk-free-space-threshold-enabled
+ true
+
+
The maximum percentage of disk space utilization allowed after
which a disk is marked as bad. Values can range from 0.0 to 100.0.
If the value is greater than or equal to 100, the nodemanager will check
for full disk. This applies to yarn.nodemanager.local-dirs and
- yarn.nodemanager.log-dirs.
+ yarn.nodemanager.log-dirs when
+ yarn.nodemanager.disk-health-checker.disk-utilization-threshold-enabled is true.
yarn.nodemanager.disk-health-checker.max-disk-utilization-per-disk-percentage
90.0
@@ -1834,7 +1849,8 @@
The minimum space in megabytes that must be available on a disk for
it to be used. If space on a disk falls below this threshold, it will be marked
as bad. This applies to yarn.nodemanager.local-dirs and
- yarn.nodemanager.log-dirs.
+ yarn.nodemanager.log-dirs when
+ yarn.nodemanager.disk-health-checker.disk-free-space-threshold-enabled is true.
yarn.nodemanager.disk-health-checker.min-free-space-per-disk-mb
0
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java
index 5b32e0e2d84..960a1812530 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java
@@ -59,6 +59,9 @@
private final Configuration conf;
private final DiskValidator diskValidator;
+
+ private final boolean diskUtilizationThresholdEnabled;
+ private final boolean diskFreeSpaceThresholdEnabled;
/**
* The enum defines disk failure type.
*/
@@ -239,6 +242,17 @@ public DirectoryCollection(String[] dirs,
throw new YarnRuntimeException(e);
}
+ diskUtilizationThresholdEnabled = conf.
+ getBoolean(YarnConfiguration.
+ NM_DISK_UTILIZATION_THRESHOLD_ENABLED,
+ YarnConfiguration.
+ DEFAULT_NM_DISK_UTILIZATION_THRESHOLD_ENABLED);
+ diskFreeSpaceThresholdEnabled = conf.
+ getBoolean(YarnConfiguration.
+ NM_DISK_FREE_SPACE_THRESHOLD_ENABLED,
+ YarnConfiguration.
+ DEFAULT_NM_DISK_FREE_SPACE_THRESHOLD_ENABLED);
+
localDirs = new ArrayList<>(Arrays.asList(dirs));
errorDirs = new ArrayList<>();
fullDirs = new ArrayList<>();
@@ -520,7 +534,9 @@ boolean checkDirs() {
diskUtilizationPercentageCutoffHigh : diskUtilizationPercentageCutoffLow;
long diskFreeSpaceCutoff = goodDirs.contains(dir) ?
diskFreeSpaceCutoffLow : diskFreeSpaceCutoffHigh;
- if (isDiskUsageOverPercentageLimit(testDir,
+
+ if (diskUtilizationThresholdEnabled
+ && isDiskUsageOverPercentageLimit(testDir,
diskUtilizationPercentageCutoff)) {
msg =
"used space above threshold of "
@@ -529,7 +545,8 @@ boolean checkDirs() {
ret.put(dir,
new DiskErrorInformation(DiskErrorCause.DISK_FULL, msg));
continue;
- } else if (isDiskFreeSpaceUnderLimit(testDir, diskFreeSpaceCutoff)) {
+ } else if (diskFreeSpaceThresholdEnabled
+ && isDiskFreeSpaceUnderLimit(testDir, diskFreeSpaceCutoff)) {
msg =
"free space below limit of " + diskFreeSpaceCutoff
+ "MB";