HDFS-15172. Remove unnecessary deadNodeDetectInterval in DeadNodeDetector#checkDeadNodes(). Contributed by Lisheng Sun.

This commit is contained in:
Inigo Goiri 2020-02-21 16:36:30 -08:00
parent 6f84269bcd
commit ed70c115a8
1 changed files with 7 additions and 18 deletions

View File

@ -24,7 +24,6 @@ import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.DatanodeLocalInfo; import org.apache.hadoop.hdfs.protocol.DatanodeLocalInfo;
import org.apache.hadoop.hdfs.protocol.HdfsConstants; import org.apache.hadoop.hdfs.protocol.HdfsConstants;
import org.apache.hadoop.util.Daemon; import org.apache.hadoop.util.Daemon;
import org.apache.hadoop.util.Time;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -104,11 +103,6 @@ public class DeadNodeDetector implements Runnable {
private Map<String, DatanodeInfo> probeInProg = private Map<String, DatanodeInfo> probeInProg =
new ConcurrentHashMap<String, DatanodeInfo>(); new ConcurrentHashMap<String, DatanodeInfo>();
/**
* The last time when detect dead node.
*/
private long lastDetectDeadTS = 0;
/** /**
* Interval time in milliseconds for probing dead node behavior. * Interval time in milliseconds for probing dead node behavior.
*/ */
@ -416,8 +410,6 @@ public class DeadNodeDetector implements Runnable {
* Check dead node periodically. * Check dead node periodically.
*/ */
private void checkDeadNodes() { private void checkDeadNodes() {
long ts = Time.monotonicNow();
if (ts - lastDetectDeadTS > deadNodeDetectInterval) {
Set<DatanodeInfo> datanodeInfos = clearAndGetDetectedDeadNodes(); Set<DatanodeInfo> datanodeInfos = clearAndGetDetectedDeadNodes();
for (DatanodeInfo datanodeInfo : datanodeInfos) { for (DatanodeInfo datanodeInfo : datanodeInfos) {
LOG.debug("Add dead node to check: {}.", datanodeInfo); LOG.debug("Add dead node to check: {}.", datanodeInfo);
@ -427,9 +419,6 @@ public class DeadNodeDetector implements Runnable {
break; break;
} }
} }
lastDetectDeadTS = ts;
}
state = State.IDLE; state = State.IDLE;
} }