HDFS-9087. Add some jitter to DataNode.checkDiskErrorThread (Elliott Clark via Colin P. McCabe)

(cherry picked from commit 0b31c237f2)
This commit is contained in:
Colin Patrick Mccabe 2015-09-26 20:36:24 -07:00
parent 94cbb6d164
commit 2dca55be00
2 changed files with 10 additions and 1 deletions

View File

@ -632,6 +632,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8053. Move DFSIn/OutputStream and related classes to HDFS-8053. Move DFSIn/OutputStream and related classes to
hadoop-hdfs-client. (Mingliang Liu via wheat9) hadoop-hdfs-client. (Mingliang Liu via wheat9)
HDFS-9087. Add some jitter to DataNode.checkDiskErrorThread (Elliott Clark
via Colin P. McCabe)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -88,6 +88,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -359,7 +360,7 @@ public class DataNode extends ReconfigurableBase
private final boolean getHdfsBlockLocationsEnabled; private final boolean getHdfsBlockLocationsEnabled;
private ObjectName dataNodeInfoBeanName; private ObjectName dataNodeInfoBeanName;
private Thread checkDiskErrorThread = null; private Thread checkDiskErrorThread = null;
protected final int checkDiskErrorInterval = 5*1000; protected final int checkDiskErrorInterval;
private boolean checkDiskErrorFlag = false; private boolean checkDiskErrorFlag = false;
private Object checkDiskErrorMutex = new Object(); private Object checkDiskErrorMutex = new Object();
private long lastDiskErrorCheck; private long lastDiskErrorCheck;
@ -391,6 +392,8 @@ public class DataNode extends ReconfigurableBase
this.connectToDnViaHostname = false; this.connectToDnViaHostname = false;
this.getHdfsBlockLocationsEnabled = false; this.getHdfsBlockLocationsEnabled = false;
this.pipelineSupportECN = false; this.pipelineSupportECN = false;
this.checkDiskErrorInterval =
ThreadLocalRandom.current().nextInt(5000, (int) (5000 * 1.25));
initOOBTimeout(); initOOBTimeout();
} }
@ -429,6 +432,9 @@ public class DataNode extends ReconfigurableBase
",hdfs-" + ",hdfs-" +
conf.get("hadoop.hdfs.configuration.version", "UNSPECIFIED"); conf.get("hadoop.hdfs.configuration.version", "UNSPECIFIED");
this.checkDiskErrorInterval =
ThreadLocalRandom.current().nextInt(5000, (int) (5000 * 1.25));
// Determine whether we should try to pass file descriptors to clients. // Determine whether we should try to pass file descriptors to clients.
if (conf.getBoolean(HdfsClientConfigKeys.Read.ShortCircuit.KEY, if (conf.getBoolean(HdfsClientConfigKeys.Read.ShortCircuit.KEY,
HdfsClientConfigKeys.Read.ShortCircuit.DEFAULT)) { HdfsClientConfigKeys.Read.ShortCircuit.DEFAULT)) {