|
@@ -35,6 +35,8 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_IN
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_DIRECTORYSCAN_INTERVAL_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_DNS_INTERFACE_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_DNS_NAMESERVER_KEY;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_DEFAULT;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HANDLER_COUNT_DEFAULT;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HANDLER_COUNT_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_HOST_NAME_KEY;
|
|
@@ -48,6 +50,8 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_MAX_RECEIVER_THR
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_MAX_RECEIVER_THREADS_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_DEFAULT;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_KEY;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_DEFAULT;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_NETWORK_COUNTS_CACHE_MAX_SIZE_DEFAULT;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_NETWORK_COUNTS_CACHE_MAX_SIZE_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_OOB_TIMEOUT_DEFAULT;
|
|
@@ -59,6 +63,10 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABL
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_PLUGINS_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_DEFAULT;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_KEY;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_DEFAULT;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_DEFAULT;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_STARTUP_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_DEFAULT;
|
|
@@ -70,6 +78,7 @@ import static org.apache.hadoop.hdfs.protocol.datatransfer.BlockConstructionStag
|
|
|
import static org.apache.hadoop.hdfs.protocol.datatransfer.BlockConstructionStage.PIPELINE_SETUP_CREATE;
|
|
|
import static org.apache.hadoop.hdfs.protocol.datatransfer.BlockConstructionStage.PIPELINE_SETUP_STREAMING_RECOVERY;
|
|
|
import static org.apache.hadoop.util.ExitUtil.terminate;
|
|
|
+import static org.apache.hadoop.util.Preconditions.checkNotNull;
|
|
|
import static org.apache.hadoop.util.Time.now;
|
|
|
|
|
|
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
|
@@ -327,7 +336,11 @@ public class DataNode extends ReconfigurableBase
|
|
|
DFS_DATANODE_PEER_STATS_ENABLED_KEY,
|
|
|
DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_KEY,
|
|
|
DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_KEY,
|
|
|
- DFS_DATANODE_PEER_METRICS_MIN_OUTLIER_DETECTION_SAMPLES_KEY));
|
|
|
+ DFS_DATANODE_PEER_METRICS_MIN_OUTLIER_DETECTION_SAMPLES_KEY,
|
|
|
+ DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY,
|
|
|
+ DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY,
|
|
|
+ DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_KEY,
|
|
|
+ DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_KEY));
|
|
|
|
|
|
public static final Log METRICS_LOG = LogFactory.getLog("DataNodeMetricsLog");
|
|
|
|
|
@@ -370,7 +383,7 @@ public class DataNode extends ReconfigurableBase
|
|
|
DataNodeMetrics metrics;
|
|
|
@Nullable
|
|
|
private volatile DataNodePeerMetrics peerMetrics;
|
|
|
- private DataNodeDiskMetrics diskMetrics;
|
|
|
+ private volatile DataNodeDiskMetrics diskMetrics;
|
|
|
private InetSocketAddress streamingAddr;
|
|
|
|
|
|
private LoadingCache<String, Map<String, Long>> datanodeNetworkCounts;
|
|
@@ -651,6 +664,11 @@ public class DataNode extends ReconfigurableBase
|
|
|
case DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_KEY:
|
|
|
case DFS_DATANODE_PEER_METRICS_MIN_OUTLIER_DETECTION_SAMPLES_KEY:
|
|
|
return reconfSlowPeerParameters(property, newVal);
|
|
|
+ case DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY:
|
|
|
+ case DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY:
|
|
|
+ case DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_KEY:
|
|
|
+ case DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_KEY:
|
|
|
+ return reconfSlowDiskParameters(property, newVal);
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -777,6 +795,61 @@ public class DataNode extends ReconfigurableBase
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private String reconfSlowDiskParameters(String property, String newVal)
|
|
|
+ throws ReconfigurationException {
|
|
|
+ String result = null;
|
|
|
+ try {
|
|
|
+ LOG.info("Reconfiguring {} to {}", property, newVal);
|
|
|
+ if (property.equals(DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY)) {
|
|
|
+ checkNotNull(dnConf, "DNConf has not been initialized.");
|
|
|
+ String reportInterval = (newVal == null ? DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_DEFAULT :
|
|
|
+ newVal);
|
|
|
+ result = reportInterval;
|
|
|
+ dnConf.setOutliersReportIntervalMs(reportInterval);
|
|
|
+ for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) {
|
|
|
+ if (bpos != null) {
|
|
|
+ for (BPServiceActor actor : bpos.getBPServiceActors()) {
|
|
|
+ actor.getScheduler().setOutliersReportIntervalMs(
|
|
|
+ dnConf.outliersReportIntervalMs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (property.equals(DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY)) {
|
|
|
+ checkNotNull(dnConf, "DNConf has not been initialized.");
|
|
|
+ int samplingPercentage = (newVal == null ?
|
|
|
+ DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_DEFAULT :
|
|
|
+ Integer.parseInt(newVal));
|
|
|
+ result = Integer.toString(samplingPercentage);
|
|
|
+ dnConf.setFileIoProfilingSamplingPercentage(samplingPercentage);
|
|
|
+ if (fileIoProvider != null) {
|
|
|
+ fileIoProvider.getProfilingEventHook().setSampleRangeMax(samplingPercentage);
|
|
|
+ }
|
|
|
+ if (samplingPercentage > 0 && diskMetrics == null) {
|
|
|
+ diskMetrics = new DataNodeDiskMetrics(this,
|
|
|
+ dnConf.outliersReportIntervalMs, getConf());
|
|
|
+ } else if (samplingPercentage <= 0 && diskMetrics != null) {
|
|
|
+ diskMetrics.shutdownAndWait();
|
|
|
+ }
|
|
|
+ } else if (property.equals(DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_KEY)) {
|
|
|
+ checkNotNull(diskMetrics, "DataNode disk stats may be disabled.");
|
|
|
+ long minDisks = (newVal == null ? DFS_DATANODE_MIN_OUTLIER_DETECTION_DISKS_DEFAULT :
|
|
|
+ Long.parseLong(newVal));
|
|
|
+ result = Long.toString(minDisks);
|
|
|
+ diskMetrics.setMinOutlierDetectionDisks(minDisks);
|
|
|
+ } else if (property.equals(DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_KEY)) {
|
|
|
+ checkNotNull(diskMetrics, "DataNode disk stats may be disabled.");
|
|
|
+ long threshold = (newVal == null ? DFS_DATANODE_SLOWDISK_LOW_THRESHOLD_MS_DEFAULT :
|
|
|
+ Long.parseLong(newVal));
|
|
|
+ result = Long.toString(threshold);
|
|
|
+ diskMetrics.setLowThresholdMs(threshold);
|
|
|
+ }
|
|
|
+ LOG.info("RECONFIGURE* changed {} to {}", property, newVal);
|
|
|
+ return result;
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ throw new ReconfigurationException(property, newVal, getConf().get(property), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Get a list of the keys of the re-configurable properties in configuration.
|
|
|
*/
|
|
@@ -2372,7 +2445,7 @@ public class DataNode extends ReconfigurableBase
|
|
|
if (metrics != null) {
|
|
|
metrics.shutdown();
|
|
|
}
|
|
|
- if (diskMetrics != null) {
|
|
|
+ if (dnConf.diskStatsEnabled && diskMetrics != null) {
|
|
|
diskMetrics.shutdownAndWait();
|
|
|
}
|
|
|
if (dataNodeInfoBeanName != null) {
|
|
@@ -3942,7 +4015,7 @@ public class DataNode extends ReconfigurableBase
|
|
|
|
|
|
@Override // DataNodeMXBean
|
|
|
public String getSlowDisks() {
|
|
|
- if (diskMetrics == null) {
|
|
|
+ if (!dnConf.diskStatsEnabled || diskMetrics == null) {
|
|
|
//Disk Stats not enabled
|
|
|
return null;
|
|
|
}
|