|
@@ -18,8 +18,6 @@
|
|
|
package org.apache.hadoop.hdfs.server.blockmanagement;
|
|
|
|
|
|
import static org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol.DNA_ERASURE_CODING_RECONSTRUCTION;
|
|
|
-import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY;
|
|
|
-import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_DEFAULT;
|
|
|
import static org.apache.hadoop.util.Time.monotonicNow;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -141,7 +139,7 @@ public class DatanodeManager {
|
|
|
private final boolean avoidStaleDataNodesForRead;
|
|
|
|
|
|
/** Whether or not to avoid using slow DataNodes for reading. */
|
|
|
- private final boolean avoidSlowDataNodesForRead;
|
|
|
+ private volatile boolean avoidSlowDataNodesForRead;
|
|
|
|
|
|
/** Whether or not to consider lad for reading. */
|
|
|
private final boolean readConsiderLoad;
|
|
@@ -217,7 +215,6 @@ public class DatanodeManager {
|
|
|
private Daemon slowPeerCollectorDaemon;
|
|
|
private final long slowPeerCollectionInterval;
|
|
|
private final int maxSlowPeerReportNodes;
|
|
|
- private boolean excludeSlowNodesEnabled;
|
|
|
|
|
|
@Nullable
|
|
|
private final SlowDiskTracker slowDiskTracker;
|
|
@@ -260,9 +257,6 @@ public class DatanodeManager {
|
|
|
final Timer timer = new Timer();
|
|
|
this.slowPeerTracker = dataNodePeerStatsEnabled ?
|
|
|
new SlowPeerTracker(conf, timer) : null;
|
|
|
- this.excludeSlowNodesEnabled = conf.getBoolean(
|
|
|
- DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY,
|
|
|
- DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_DEFAULT);
|
|
|
this.maxSlowPeerReportNodes = conf.getInt(
|
|
|
DFSConfigKeys.DFS_NAMENODE_MAX_SLOWPEER_COLLECT_NODES_KEY,
|
|
|
DFSConfigKeys.DFS_NAMENODE_MAX_SLOWPEER_COLLECT_NODES_DEFAULT);
|
|
@@ -270,7 +264,7 @@ public class DatanodeManager {
|
|
|
DFSConfigKeys.DFS_NAMENODE_SLOWPEER_COLLECT_INTERVAL_KEY,
|
|
|
DFSConfigKeys.DFS_NAMENODE_SLOWPEER_COLLECT_INTERVAL_DEFAULT,
|
|
|
TimeUnit.MILLISECONDS);
|
|
|
- if (slowPeerTracker != null && excludeSlowNodesEnabled) {
|
|
|
+ if (slowPeerTracker != null) {
|
|
|
startSlowPeerCollector();
|
|
|
}
|
|
|
this.slowDiskTracker = dataNodeDiskStatsEnabled ?
|
|
@@ -511,7 +505,16 @@ public class DatanodeManager {
|
|
|
private boolean isSlowNode(String dnUuid) {
|
|
|
return avoidSlowDataNodesForRead && slowNodesUuidSet.contains(dnUuid);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ public void setAvoidSlowDataNodesForReadEnabled(boolean enable) {
|
|
|
+ this.avoidSlowDataNodesForRead = enable;
|
|
|
+ }
|
|
|
+
|
|
|
+ @VisibleForTesting
|
|
|
+ public boolean getEnableAvoidSlowDataNodesForRead() {
|
|
|
+ return this.avoidSlowDataNodesForRead;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Sort the non-striped located blocks by the distance to the target host.
|
|
|
*
|