Search in sources :

Example 1 with StreamSlowMonitor

use of org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor in project hbase by apache.

the class TestExcludeDatanodeManager method testExcludeSlowDNByProcessTime.

@Test
public void testExcludeSlowDNByProcessTime() {
    Configuration conf = HBaseConfiguration.create();
    ExcludeDatanodeManager excludeDatanodeManager = new ExcludeDatanodeManager(conf);
    StreamSlowMonitor streamSlowDNsMonitor = excludeDatanodeManager.getStreamSlowMonitor("testMonitor");
    assertEquals(0, excludeDatanodeManager.getExcludeDNs().size());
    DatanodeInfo datanodeInfo = new DatanodeInfo.DatanodeInfoBuilder().setIpAddr("0.0.0.0").setHostName("hostname1").setDatanodeUuid("uuid1").setXferPort(111).setInfoPort(222).setInfoSecurePort(333).setIpcPort(444).setNetworkLocation("location1").build();
    streamSlowDNsMonitor.checkProcessTimeAndSpeed(datanodeInfo, 5000, 7000, System.currentTimeMillis() - 7000, 0);
    streamSlowDNsMonitor.checkProcessTimeAndSpeed(datanodeInfo, 5000, 7000, System.currentTimeMillis() - 7000, 0);
    streamSlowDNsMonitor.checkProcessTimeAndSpeed(datanodeInfo, 5000, 7000, System.currentTimeMillis() - 7000, 0);
    assertEquals(1, excludeDatanodeManager.getExcludeDNs().size());
    assertTrue(excludeDatanodeManager.getExcludeDNs().containsKey(datanodeInfo));
}
Also used : DatanodeInfo(org.apache.hadoop.hdfs.protocol.DatanodeInfo) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Configuration(org.apache.hadoop.conf.Configuration) StreamSlowMonitor(org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor) ExcludeDatanodeManager(org.apache.hadoop.hbase.io.asyncfs.monitor.ExcludeDatanodeManager) Test(org.junit.Test)

Example 2 with StreamSlowMonitor

use of org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor in project hbase by apache.

the class TestExcludeDatanodeManager method testExcludeSlowDNBySpeed.

@Test
public void testExcludeSlowDNBySpeed() {
    Configuration conf = HBaseConfiguration.create();
    ExcludeDatanodeManager excludeDatanodeManager = new ExcludeDatanodeManager(conf);
    StreamSlowMonitor streamSlowDNsMonitor = excludeDatanodeManager.getStreamSlowMonitor("testMonitor");
    assertEquals(0, excludeDatanodeManager.getExcludeDNs().size());
    DatanodeInfo datanodeInfo = new DatanodeInfo.DatanodeInfoBuilder().setIpAddr("0.0.0.0").setHostName("hostname1").setDatanodeUuid("uuid1").setXferPort(111).setInfoPort(222).setInfoSecurePort(333).setIpcPort(444).setNetworkLocation("location1").build();
    streamSlowDNsMonitor.checkProcessTimeAndSpeed(datanodeInfo, 100000, 5100, System.currentTimeMillis() - 5100, 0);
    streamSlowDNsMonitor.checkProcessTimeAndSpeed(datanodeInfo, 100000, 5100, System.currentTimeMillis() - 5100, 0);
    streamSlowDNsMonitor.checkProcessTimeAndSpeed(datanodeInfo, 100000, 5100, System.currentTimeMillis() - 5100, 0);
    assertEquals(1, excludeDatanodeManager.getExcludeDNs().size());
    assertTrue(excludeDatanodeManager.getExcludeDNs().containsKey(datanodeInfo));
}
Also used : DatanodeInfo(org.apache.hadoop.hdfs.protocol.DatanodeInfo) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Configuration(org.apache.hadoop.conf.Configuration) StreamSlowMonitor(org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor) ExcludeDatanodeManager(org.apache.hadoop.hbase.io.asyncfs.monitor.ExcludeDatanodeManager) Test(org.junit.Test)

Example 3 with StreamSlowMonitor

use of org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor in project hbase by apache.

the class TestFanOutOneBlockAsyncDFSOutput method testExcludeFailedConnectToDatanode.

@Test
public void testExcludeFailedConnectToDatanode() throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InterruptedException, NoSuchFieldException {
    Field xceiverServerDaemonField = DataNode.class.getDeclaredField("dataXceiverServer");
    xceiverServerDaemonField.setAccessible(true);
    Class<?> xceiverServerClass = Class.forName("org.apache.hadoop.hdfs.server.datanode.DataXceiverServer");
    Method numPeersMethod = xceiverServerClass.getDeclaredMethod("getNumPeers");
    numPeersMethod.setAccessible(true);
    // make one datanode broken
    DataNodeProperties dnProp = CLUSTER.stopDataNode(0);
    Path f = new Path("/test");
    EventLoop eventLoop = EVENT_LOOP_GROUP.next();
    ExcludeDatanodeManager excludeDatanodeManager = new ExcludeDatanodeManager(HBaseConfiguration.create());
    StreamSlowMonitor streamSlowDNsMonitor = excludeDatanodeManager.getStreamSlowMonitor("testMonitor");
    assertEquals(0, excludeDatanodeManager.getExcludeDNs().size());
    try (FanOutOneBlockAsyncDFSOutput output = FanOutOneBlockAsyncDFSOutputHelper.createOutput(FS, f, true, false, (short) 3, FS.getDefaultBlockSize(), eventLoop, CHANNEL_CLASS, streamSlowDNsMonitor)) {
        // should exclude the dead dn when retry so here we only have 2 DNs in pipeline
        assertEquals(2, output.getPipeline().length);
        assertEquals(1, excludeDatanodeManager.getExcludeDNs().size());
    } finally {
        CLUSTER.restartDataNode(dnProp);
    }
}
Also used : Path(org.apache.hadoop.fs.Path) Field(java.lang.reflect.Field) EventLoop(org.apache.hbase.thirdparty.io.netty.channel.EventLoop) StreamSlowMonitor(org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor) DataNodeProperties(org.apache.hadoop.hdfs.MiniDFSCluster.DataNodeProperties) Method(java.lang.reflect.Method) ExcludeDatanodeManager(org.apache.hadoop.hbase.io.asyncfs.monitor.ExcludeDatanodeManager) Test(org.junit.Test)

Aggregations

ExcludeDatanodeManager (org.apache.hadoop.hbase.io.asyncfs.monitor.ExcludeDatanodeManager)3 StreamSlowMonitor (org.apache.hadoop.hbase.io.asyncfs.monitor.StreamSlowMonitor)3 Test (org.junit.Test)3 Configuration (org.apache.hadoop.conf.Configuration)2 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)2 DatanodeInfo (org.apache.hadoop.hdfs.protocol.DatanodeInfo)2 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 Path (org.apache.hadoop.fs.Path)1 DataNodeProperties (org.apache.hadoop.hdfs.MiniDFSCluster.DataNodeProperties)1 EventLoop (org.apache.hbase.thirdparty.io.netty.channel.EventLoop)1