Java 类org.apache.hadoop.hdfs.server.datanode.BlockScanner 实例源码

项目:hadoop    文件:TestFsDatasetImpl.java   
@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);
  final DNConf dnConf = new DNConf(conf);

  when(datanode.getConf()).thenReturn(conf);
  when(datanode.getDnConf()).thenReturn(dnConf);
  final BlockScanner disabledBlockScanner = new BlockScanner(datanode, conf);
  when(datanode.getBlockScanner()).thenReturn(disabledBlockScanner);

  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, dataset.getVolumes().size());
  assertEquals(0, dataset.getNumFailedVolumes());
}
项目:aliyun-oss-hadoop-fs    文件:TestFsDatasetImpl.java   
@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);
  final DNConf dnConf = new DNConf(conf);

  when(datanode.getConf()).thenReturn(conf);
  when(datanode.getDnConf()).thenReturn(dnConf);
  final BlockScanner disabledBlockScanner = new BlockScanner(datanode, conf);
  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());
}
项目:big-c    文件:TestFsDatasetImpl.java   
@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);
  final DNConf dnConf = new DNConf(conf);

  when(datanode.getConf()).thenReturn(conf);
  when(datanode.getDnConf()).thenReturn(dnConf);
  final BlockScanner disabledBlockScanner = new BlockScanner(datanode, conf);
  when(datanode.getBlockScanner()).thenReturn(disabledBlockScanner);

  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, dataset.getVolumes().size());
  assertEquals(0, dataset.getNumFailedVolumes());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestFsDatasetImpl.java   
@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);
  final DNConf dnConf = new DNConf(conf);

  when(datanode.getConf()).thenReturn(conf);
  when(datanode.getDnConf()).thenReturn(dnConf);
  final BlockScanner disabledBlockScanner = new BlockScanner(datanode, conf);
  when(datanode.getBlockScanner()).thenReturn(disabledBlockScanner);

  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, dataset.getVolumes().size());
  assertEquals(0, dataset.getNumFailedVolumes());
}
项目:hadoop    文件:FsVolumeList.java   
FsVolumeList(List<VolumeFailureInfo> initialVolumeFailureInfos,
    BlockScanner blockScanner,
    VolumeChoosingPolicy<FsVolumeImpl> blockChooser) {
  this.blockChooser = blockChooser;
  this.blockScanner = blockScanner;
  for (VolumeFailureInfo volumeFailureInfo: initialVolumeFailureInfos) {
    volumeFailureInfos.put(volumeFailureInfo.getFailedStorageLocation(),
        volumeFailureInfo);
  }
}
项目:hadoop    文件:SnapshotTestHelper.java   
/** Disable the logs that are not very useful for snapshot related tests. */
public static void disableLogs() {
  final String[] lognames = {
      "org.apache.hadoop.hdfs.server.datanode.BlockPoolSliceScanner",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetAsyncDiskService",
  };
  for(String n : lognames) {
    GenericTestUtils.disableLog(LogFactory.getLog(n));
  }

  GenericTestUtils.disableLog(LogFactory.getLog(UserGroupInformation.class));
  GenericTestUtils.disableLog(LogFactory.getLog(BlockManager.class));
  GenericTestUtils.disableLog(LogFactory.getLog(FSNamesystem.class));
  GenericTestUtils.disableLog(LogFactory.getLog(DirectoryScanner.class));
  GenericTestUtils.disableLog(LogFactory.getLog(MetricsSystemImpl.class));

  GenericTestUtils.disableLog(BlockScanner.LOG);
  GenericTestUtils.disableLog(HttpServer2.LOG);
  GenericTestUtils.disableLog(DataNode.LOG);
  GenericTestUtils.disableLog(BlockPoolSliceStorage.LOG);
  GenericTestUtils.disableLog(LeaseManager.LOG);
  GenericTestUtils.disableLog(NameNode.stateChangeLog);
  GenericTestUtils.disableLog(NameNode.blockStateChangeLog);
  GenericTestUtils.disableLog(DFSClient.LOG);
  GenericTestUtils.disableLog(Server.LOG);
}
项目:hadoop    文件:TestFsVolumeList.java   
@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);
}
项目:aliyun-oss-hadoop-fs    文件:FsVolumeList.java   
FsVolumeList(List<VolumeFailureInfo> initialVolumeFailureInfos,
    BlockScanner blockScanner,
    VolumeChoosingPolicy<FsVolumeImpl> blockChooser) {
  this.blockChooser = blockChooser;
  this.blockScanner = blockScanner;
  for (VolumeFailureInfo volumeFailureInfo: initialVolumeFailureInfos) {
    volumeFailureInfos.put(volumeFailureInfo.getFailedStorageLocation(),
        volumeFailureInfo);
  }
}
项目:aliyun-oss-hadoop-fs    文件:SnapshotTestHelper.java   
/** Disable the logs that are not very useful for snapshot related tests. */
public static void disableLogs() {
  final String[] lognames = {
      "org.apache.hadoop.hdfs.server.datanode.BlockPoolSliceScanner",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetAsyncDiskService",
  };
  for(String n : lognames) {
    GenericTestUtils.disableLog(LogFactory.getLog(n));
  }

  GenericTestUtils.disableLog(LogFactory.getLog(UserGroupInformation.class));
  GenericTestUtils.disableLog(LogFactory.getLog(BlockManager.class));
  GenericTestUtils.disableLog(LogFactory.getLog(FSNamesystem.class));
  GenericTestUtils.disableLog(LogFactory.getLog(DirectoryScanner.class));
  GenericTestUtils.disableLog(LogFactory.getLog(MetricsSystemImpl.class));

  GenericTestUtils.disableLog(BlockScanner.LOG);
  GenericTestUtils.disableLog(HttpServer2.LOG);
  GenericTestUtils.disableLog(DataNode.LOG);
  GenericTestUtils.disableLog(BlockPoolSliceStorage.LOG);
  GenericTestUtils.disableLog(LeaseManager.LOG);
  GenericTestUtils.disableLog(NameNode.stateChangeLog);
  GenericTestUtils.disableLog(NameNode.blockStateChangeLog);
  GenericTestUtils.disableLog(DFSClient.LOG);
  GenericTestUtils.disableLog(Server.LOG);
}
项目:aliyun-oss-hadoop-fs    文件:TestFsVolumeList.java   
@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);
}
项目:big-c    文件:FsVolumeList.java   
FsVolumeList(List<VolumeFailureInfo> initialVolumeFailureInfos,
    BlockScanner blockScanner,
    VolumeChoosingPolicy<FsVolumeImpl> blockChooser) {
  this.blockChooser = blockChooser;
  this.blockScanner = blockScanner;
  for (VolumeFailureInfo volumeFailureInfo: initialVolumeFailureInfos) {
    volumeFailureInfos.put(volumeFailureInfo.getFailedStorageLocation(),
        volumeFailureInfo);
  }
}
项目:big-c    文件:SnapshotTestHelper.java   
/** Disable the logs that are not very useful for snapshot related tests. */
public static void disableLogs() {
  final String[] lognames = {
      "org.apache.hadoop.hdfs.server.datanode.BlockPoolSliceScanner",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetAsyncDiskService",
  };
  for(String n : lognames) {
    GenericTestUtils.disableLog(LogFactory.getLog(n));
  }

  GenericTestUtils.disableLog(LogFactory.getLog(UserGroupInformation.class));
  GenericTestUtils.disableLog(LogFactory.getLog(BlockManager.class));
  GenericTestUtils.disableLog(LogFactory.getLog(FSNamesystem.class));
  GenericTestUtils.disableLog(LogFactory.getLog(DirectoryScanner.class));
  GenericTestUtils.disableLog(LogFactory.getLog(MetricsSystemImpl.class));

  GenericTestUtils.disableLog(BlockScanner.LOG);
  GenericTestUtils.disableLog(HttpServer2.LOG);
  GenericTestUtils.disableLog(DataNode.LOG);
  GenericTestUtils.disableLog(BlockPoolSliceStorage.LOG);
  GenericTestUtils.disableLog(LeaseManager.LOG);
  GenericTestUtils.disableLog(NameNode.stateChangeLog);
  GenericTestUtils.disableLog(NameNode.blockStateChangeLog);
  GenericTestUtils.disableLog(DFSClient.LOG);
  GenericTestUtils.disableLog(Server.LOG);
}
项目:big-c    文件:TestFsVolumeList.java   
@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);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FsVolumeList.java   
FsVolumeList(List<VolumeFailureInfo> initialVolumeFailureInfos,
    BlockScanner blockScanner,
    VolumeChoosingPolicy<FsVolumeImpl> blockChooser) {
  this.blockChooser = blockChooser;
  this.blockScanner = blockScanner;
  for (VolumeFailureInfo volumeFailureInfo: initialVolumeFailureInfos) {
    volumeFailureInfos.put(volumeFailureInfo.getFailedStorageLocation(),
        volumeFailureInfo);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:SnapshotTestHelper.java   
/** Disable the logs that are not very useful for snapshot related tests. */
public static void disableLogs() {
  final String[] lognames = {
      "org.apache.hadoop.hdfs.server.datanode.BlockPoolSliceScanner",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl",
      "org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetAsyncDiskService",
  };
  for(String n : lognames) {
    GenericTestUtils.disableLog(LogFactory.getLog(n));
  }

  GenericTestUtils.disableLog(LogFactory.getLog(UserGroupInformation.class));
  GenericTestUtils.disableLog(LogFactory.getLog(BlockManager.class));
  GenericTestUtils.disableLog(LogFactory.getLog(FSNamesystem.class));
  GenericTestUtils.disableLog(LogFactory.getLog(DirectoryScanner.class));
  GenericTestUtils.disableLog(LogFactory.getLog(MetricsSystemImpl.class));

  GenericTestUtils.disableLog(BlockScanner.LOG);
  GenericTestUtils.disableLog(HttpServer2.LOG);
  GenericTestUtils.disableLog(DataNode.LOG);
  GenericTestUtils.disableLog(BlockPoolSliceStorage.LOG);
  GenericTestUtils.disableLog(LeaseManager.LOG);
  GenericTestUtils.disableLog(NameNode.stateChangeLog);
  GenericTestUtils.disableLog(NameNode.blockStateChangeLog);
  GenericTestUtils.disableLog(DFSClient.LOG);
  GenericTestUtils.disableLog(Server.LOG);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestFsVolumeList.java   
@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);
}