Search in sources :

Example 1 with BlockScanner

use of org.apache.hadoop.hdfs.server.datanode.BlockScanner in project hadoop by apache.

the class TestFsVolumeList method setUp.

@Before
public void setUp() {
    dataset = mock(FsDatasetImpl.class);
    baseDir = new FileSystemTestHelper().getTestRootDir();
    Configuration blockScannerConf = new Configuration();
    blockScannerConf.setInt(DFSConfigKeys.DFS_DATANODE_SCAN_PERIOD_HOURS_KEY, -1);
    blockScanner = new BlockScanner(null, blockScannerConf);
}
Also used : FileSystemTestHelper(org.apache.hadoop.fs.FileSystemTestHelper) Configuration(org.apache.hadoop.conf.Configuration) BlockScanner(org.apache.hadoop.hdfs.server.datanode.BlockScanner) Before(org.junit.Before)

Example 2 with BlockScanner

use of org.apache.hadoop.hdfs.server.datanode.BlockScanner in project hadoop by apache.

the class TestFsDatasetImpl method setUp.

@Before
public void setUp() throws IOException {
    datanode = mock(DataNode.class);
    storage = mock(DataStorage.class);
    this.conf = new Configuration();
    this.conf.setLong(DFS_DATANODE_SCAN_PERIOD_HOURS_KEY, 0);
    when(datanode.getConf()).thenReturn(conf);
    final DNConf dnConf = new DNConf(datanode);
    when(datanode.getDnConf()).thenReturn(dnConf);
    final BlockScanner disabledBlockScanner = new BlockScanner(datanode);
    when(datanode.getBlockScanner()).thenReturn(disabledBlockScanner);
    final ShortCircuitRegistry shortCircuitRegistry = new ShortCircuitRegistry(conf);
    when(datanode.getShortCircuitRegistry()).thenReturn(shortCircuitRegistry);
    createStorageDirs(storage, conf, NUM_INIT_VOLUMES);
    dataset = new FsDatasetImpl(datanode, storage, conf);
    for (String bpid : BLOCK_POOL_IDS) {
        dataset.addBlockPool(bpid, conf);
    }
    assertEquals(NUM_INIT_VOLUMES, getNumVolumes());
    assertEquals(0, dataset.getNumFailedVolumes());
}
Also used : DataStorage(org.apache.hadoop.hdfs.server.datanode.DataStorage) Configuration(org.apache.hadoop.conf.Configuration) HdfsConfiguration(org.apache.hadoop.hdfs.HdfsConfiguration) BlockScanner(org.apache.hadoop.hdfs.server.datanode.BlockScanner) DataNode(org.apache.hadoop.hdfs.server.datanode.DataNode) ShortCircuitRegistry(org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry) DNConf(org.apache.hadoop.hdfs.server.datanode.DNConf) Matchers.anyString(org.mockito.Matchers.anyString) Before(org.junit.Before)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)2 BlockScanner (org.apache.hadoop.hdfs.server.datanode.BlockScanner)2 Before (org.junit.Before)2 FileSystemTestHelper (org.apache.hadoop.fs.FileSystemTestHelper)1 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)1 DNConf (org.apache.hadoop.hdfs.server.datanode.DNConf)1 DataNode (org.apache.hadoop.hdfs.server.datanode.DataNode)1 DataStorage (org.apache.hadoop.hdfs.server.datanode.DataStorage)1 ShortCircuitRegistry (org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry)1 Matchers.anyString (org.mockito.Matchers.anyString)1