HDFS-11488. JN log segment syncing should support HA upgrade. Contributed by Hanisha Koneru.
This commit is contained in:
parent
fd5cb2c946
commit
08fb82d6d1
|
@ -334,8 +334,8 @@ FsVolume
|
||||||
|
|
||||||
Per-volume metrics contain Datanode Volume IO related statistics. Per-volume
|
Per-volume metrics contain Datanode Volume IO related statistics. Per-volume
|
||||||
metrics are off by default. They can be enabled by setting `dfs.datanode
|
metrics are off by default. They can be enabled by setting `dfs.datanode
|
||||||
.fileio.profiling.sampling.fraction` to a fraction between 0.0 and 1.0.
|
.fileio.profiling.percentage.fraction` to an integer value between 1 and 100.
|
||||||
Setting this value to 0.0 would mean profiling is not enabled. But enabling
|
Setting this value to 0 would mean profiling is not enabled. But enabling
|
||||||
per-volume metrics may have a performance impact. Each metrics record
|
per-volume metrics may have a performance impact. Each metrics record
|
||||||
contains tags such as Hostname as additional information along with metrics.
|
contains tags such as Hostname as additional information along with metrics.
|
||||||
|
|
||||||
|
|
|
@ -731,10 +731,10 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
|
||||||
public static final boolean
|
public static final boolean
|
||||||
DFS_DATANODE_ENABLE_FILEIO_FAULT_INJECTION_DEFAULT = false;
|
DFS_DATANODE_ENABLE_FILEIO_FAULT_INJECTION_DEFAULT = false;
|
||||||
public static final String
|
public static final String
|
||||||
DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY =
|
DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY =
|
||||||
"dfs.datanode.fileio.profiling.sampling.fraction";
|
"dfs.datanode.fileio.profiling.sampling.percentage";
|
||||||
public static final double
|
public static final int
|
||||||
DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_DEFAULT = 0.0;
|
DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_DEFAULT = 0;
|
||||||
|
|
||||||
//Keys with no defaults
|
//Keys with no defaults
|
||||||
public static final String DFS_DATANODE_PLUGINS_KEY = "dfs.datanode.plugins";
|
public static final String DFS_DATANODE_PLUGINS_KEY = "dfs.datanode.plugins";
|
||||||
|
|
|
@ -215,9 +215,10 @@ public class DatanodeManager {
|
||||||
this.dataNodePeerStatsEnabled = conf.getBoolean(
|
this.dataNodePeerStatsEnabled = conf.getBoolean(
|
||||||
DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABLED_KEY,
|
DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABLED_KEY,
|
||||||
DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABLED_DEFAULT);
|
DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABLED_DEFAULT);
|
||||||
this.dataNodeDiskStatsEnabled = Util.isDiskStatsEnabled(conf.getDouble(
|
this.dataNodeDiskStatsEnabled = Util.isDiskStatsEnabled(conf.getInt(
|
||||||
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY,
|
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY,
|
||||||
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_DEFAULT));
|
DFSConfigKeys.
|
||||||
|
DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_DEFAULT));
|
||||||
|
|
||||||
final Timer timer = new Timer();
|
final Timer timer = new Timer();
|
||||||
this.slowPeerTracker = dataNodePeerStatsEnabled ?
|
this.slowPeerTracker = dataNodePeerStatsEnabled ?
|
||||||
|
|
|
@ -389,17 +389,17 @@ public final class Util {
|
||||||
return addrsList;
|
return addrsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDiskStatsEnabled(double fileIOSamplingFraction) {
|
public static boolean isDiskStatsEnabled(int fileIOSamplingPercentage) {
|
||||||
final boolean isEnabled;
|
final boolean isEnabled;
|
||||||
if (fileIOSamplingFraction < 0.000001) {
|
if (fileIOSamplingPercentage <= 0) {
|
||||||
LOG.info(DFSConfigKeys
|
LOG.info(DFSConfigKeys
|
||||||
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY + " set to "
|
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY + " set to "
|
||||||
+ fileIOSamplingFraction + ". Disabling file IO profiling");
|
+ fileIOSamplingPercentage + ". Disabling file IO profiling");
|
||||||
isEnabled = false;
|
isEnabled = false;
|
||||||
} else {
|
} else {
|
||||||
LOG.info(DFSConfigKeys
|
LOG.info(DFSConfigKeys
|
||||||
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY + " set to "
|
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY + " set to "
|
||||||
+ fileIOSamplingFraction + ". Enabling file IO profiling");
|
+ fileIOSamplingPercentage + ". Enabling file IO profiling");
|
||||||
isEnabled = true;
|
isEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,9 +175,10 @@ public class DNConf {
|
||||||
this.peerStatsEnabled = getConf().getBoolean(
|
this.peerStatsEnabled = getConf().getBoolean(
|
||||||
DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABLED_KEY,
|
DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABLED_KEY,
|
||||||
DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABLED_DEFAULT);
|
DFSConfigKeys.DFS_DATANODE_PEER_STATS_ENABLED_DEFAULT);
|
||||||
this.diskStatsEnabled = Util.isDiskStatsEnabled(getConf().getDouble(
|
this.diskStatsEnabled = Util.isDiskStatsEnabled(getConf().getInt(
|
||||||
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY,
|
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY,
|
||||||
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_DEFAULT));
|
DFSConfigKeys.
|
||||||
|
DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_DEFAULT));
|
||||||
this.outliersReportIntervalMs = getConf().getTimeDuration(
|
this.outliersReportIntervalMs = getConf().getTimeDuration(
|
||||||
DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY,
|
DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY,
|
||||||
DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_DEFAULT,
|
DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_DEFAULT,
|
||||||
|
|
|
@ -62,8 +62,8 @@ import static org.apache.hadoop.hdfs.server.datanode.FileIoProvider.OPERATION.*;
|
||||||
*
|
*
|
||||||
* Behavior can be injected into these events by enabling the
|
* Behavior can be injected into these events by enabling the
|
||||||
* profiling and/or fault injection event hooks through
|
* profiling and/or fault injection event hooks through
|
||||||
* {@link DFSConfigKeys#DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY} and
|
* {@link DFSConfigKeys#DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY}
|
||||||
* {@link DFSConfigKeys#DFS_DATANODE_ENABLE_FILEIO_FAULT_INJECTION_KEY}.
|
* and {@link DFSConfigKeys#DFS_DATANODE_ENABLE_FILEIO_FAULT_INJECTION_KEY}.
|
||||||
* These event hooks are disabled by default.
|
* These event hooks are disabled by default.
|
||||||
*
|
*
|
||||||
* Most functions accept an optional {@link FsVolumeSpi} parameter for
|
* Most functions accept an optional {@link FsVolumeSpi} parameter for
|
||||||
|
|
|
@ -44,18 +44,19 @@ class ProfilingFileIoEvents {
|
||||||
|
|
||||||
public ProfilingFileIoEvents(@Nullable Configuration conf) {
|
public ProfilingFileIoEvents(@Nullable Configuration conf) {
|
||||||
if (conf != null) {
|
if (conf != null) {
|
||||||
double fileIOSamplingFraction = conf.getDouble(
|
int fileIOSamplingPercentage = conf.getInt(
|
||||||
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY,
|
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY,
|
||||||
DFSConfigKeys
|
DFSConfigKeys
|
||||||
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_DEFAULT);
|
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_DEFAULT);
|
||||||
isEnabled = Util.isDiskStatsEnabled(fileIOSamplingFraction);
|
isEnabled = Util.isDiskStatsEnabled(fileIOSamplingPercentage);
|
||||||
if (fileIOSamplingFraction > 1) {
|
if (fileIOSamplingPercentage > 100) {
|
||||||
LOG.warn(DFSConfigKeys
|
LOG.warn(DFSConfigKeys
|
||||||
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY +
|
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY +
|
||||||
" value cannot be more than 1. Setting value to 1");
|
" value cannot be more than 100. Setting value to 100");
|
||||||
fileIOSamplingFraction = 1;
|
fileIOSamplingPercentage = 100;
|
||||||
}
|
}
|
||||||
sampleRangeMax = (int) (fileIOSamplingFraction * Integer.MAX_VALUE);
|
sampleRangeMax = (int) ((double) fileIOSamplingPercentage / 100 *
|
||||||
|
Integer.MAX_VALUE);
|
||||||
} else {
|
} else {
|
||||||
isEnabled = false;
|
isEnabled = false;
|
||||||
sampleRangeMax = 0;
|
sampleRangeMax = 0;
|
||||||
|
|
|
@ -2021,6 +2021,17 @@
|
||||||
</description>
|
</description>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
|
<property>
|
||||||
|
<name>dfs.datanode.fileio.profiling.sampling.percentage</name>
|
||||||
|
<value>0</value>
|
||||||
|
<description>
|
||||||
|
This setting controls the percentage of file I/O events which will be
|
||||||
|
profiled for DataNode disk statistics. The default value of 0 disables
|
||||||
|
disk statistics. Set to an integer value between 1 and 100 to enable disk
|
||||||
|
statistics.
|
||||||
|
</description>
|
||||||
|
</property>
|
||||||
|
|
||||||
<property>
|
<property>
|
||||||
<name>hadoop.user.group.metrics.percentiles.intervals</name>
|
<name>hadoop.user.group.metrics.percentiles.intervals</name>
|
||||||
<value></value>
|
<value></value>
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import static org.apache.hadoop.hdfs.DFSConfigKeys
|
import static org.apache.hadoop.hdfs.DFSConfigKeys
|
||||||
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY;
|
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY;
|
||||||
import static org.apache.hadoop.hdfs.DFSConfigKeys
|
import static org.apache.hadoop.hdfs.DFSConfigKeys
|
||||||
.DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY;
|
.DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY;
|
||||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY;
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY;
|
||||||
|
@ -80,7 +80,7 @@ public class TestSlowDiskTracker {
|
||||||
static {
|
static {
|
||||||
conf = new HdfsConfiguration();
|
conf = new HdfsConfiguration();
|
||||||
conf.setLong(DFS_HEARTBEAT_INTERVAL_KEY, 1L);
|
conf.setLong(DFS_HEARTBEAT_INTERVAL_KEY, 1L);
|
||||||
conf.setDouble(DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY, 1.0);
|
conf.setInt(DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY, 100);
|
||||||
conf.setTimeDuration(DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY,
|
conf.setTimeDuration(DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY,
|
||||||
OUTLIERS_REPORT_INTERVAL, TimeUnit.MILLISECONDS);
|
OUTLIERS_REPORT_INTERVAL, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,8 +218,8 @@ public class TestDataNodeMXBean {
|
||||||
@Test
|
@Test
|
||||||
public void testDataNodeMXBeanSlowDisksEnabled() throws Exception {
|
public void testDataNodeMXBeanSlowDisksEnabled() throws Exception {
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.setDouble(DFSConfigKeys
|
conf.setInt(DFSConfigKeys
|
||||||
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY, 1.0);
|
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY, 100);
|
||||||
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build();
|
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -121,8 +121,8 @@ public class TestDataNodeVolumeMetrics {
|
||||||
|
|
||||||
private MiniDFSCluster setupClusterForVolumeMetrics() throws IOException {
|
private MiniDFSCluster setupClusterForVolumeMetrics() throws IOException {
|
||||||
Configuration conf = new HdfsConfiguration();
|
Configuration conf = new HdfsConfiguration();
|
||||||
conf.setDouble(DFSConfigKeys
|
conf.setInt(DFSConfigKeys
|
||||||
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY, 1.0);
|
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY, 100);
|
||||||
SimulatedFSDataset.setFactory(conf);
|
SimulatedFSDataset.setFactory(conf);
|
||||||
return new MiniDFSCluster.Builder(conf)
|
return new MiniDFSCluster.Builder(conf)
|
||||||
.numDataNodes(NUM_DATANODES)
|
.numDataNodes(NUM_DATANODES)
|
||||||
|
|
|
@ -105,8 +105,9 @@ public class TestNameNodeStatusMXBean {
|
||||||
@Test
|
@Test
|
||||||
public void testNameNodeMXBeanSlowDisksEnabled() throws Exception {
|
public void testNameNodeMXBeanSlowDisksEnabled() throws Exception {
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
conf.setDouble(
|
conf.setInt(
|
||||||
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY, 1.0);
|
DFSConfigKeys.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_PERCENTAGE_KEY,
|
||||||
|
100);
|
||||||
conf.setTimeDuration(
|
conf.setTimeDuration(
|
||||||
DFSConfigKeys.DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY,
|
DFSConfigKeys.DFS_DATANODE_OUTLIERS_REPORT_INTERVAL_KEY,
|
||||||
1000, TimeUnit.MILLISECONDS);
|
1000, TimeUnit.MILLISECONDS);
|
||||||
|
|
|
@ -105,8 +105,6 @@ public class TestHdfsConfigFields extends TestConfigurationFieldsBase {
|
||||||
.add(DFSConfigKeys.DFS_NAMENODE_STARTUP_KEY);
|
.add(DFSConfigKeys.DFS_NAMENODE_STARTUP_KEY);
|
||||||
configurationPropsToSkipCompare.add(DFSConfigKeys
|
configurationPropsToSkipCompare.add(DFSConfigKeys
|
||||||
.DFS_DATANODE_ENABLE_FILEIO_FAULT_INJECTION_KEY);
|
.DFS_DATANODE_ENABLE_FILEIO_FAULT_INJECTION_KEY);
|
||||||
configurationPropsToSkipCompare.add(DFSConfigKeys
|
|
||||||
.DFS_DATANODE_FILEIO_PROFILING_SAMPLING_FRACTION_KEY);
|
|
||||||
|
|
||||||
// Allocate
|
// Allocate
|
||||||
xmlPropsToSkipCompare = new HashSet<String>();
|
xmlPropsToSkipCompare = new HashSet<String>();
|
||||||
|
|
Loading…
Reference in New Issue