当前位置: 首页>>代码示例>>Java>>正文


Java BlockStatus.DELETED_BLOCK属性代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo.BlockStatus.DELETED_BLOCK属性的典型用法代码示例。如果您正苦于以下问题:Java BlockStatus.DELETED_BLOCK属性的具体用法?Java BlockStatus.DELETED_BLOCK怎么用?Java BlockStatus.DELETED_BLOCK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo.BlockStatus的用法示例。


在下文中一共展示了BlockStatus.DELETED_BLOCK属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

public static ReceivedDeletedBlockInfo convert(
    ReceivedDeletedBlockInfoProto proto) {
  ReceivedDeletedBlockInfo.BlockStatus status = null;
  switch (proto.getStatus()) {
  case RECEIVING:
    status = BlockStatus.RECEIVING_BLOCK;
    break;
  case RECEIVED:
    status = BlockStatus.RECEIVED_BLOCK;
    break;
  case DELETED:
    status = BlockStatus.DELETED_BLOCK;
    break;
  }
  return new ReceivedDeletedBlockInfo(
      PBHelper.convert(proto.getBlock()),
      status,
      proto.hasDeleteHint() ? proto.getDeleteHint() : null);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:PBHelper.java

示例2: convert

public static ReceivedDeletedBlockInfo convert(
    ReceivedDeletedBlockInfoProto proto) {
  ReceivedDeletedBlockInfo.BlockStatus status = null;
  switch (proto.getStatus()) {
  case RECEIVING:
    status = BlockStatus.RECEIVING_BLOCK;
    break;
  case RECEIVED:
    status = BlockStatus.RECEIVED_BLOCK;
    break;
  case DELETED:
    status = BlockStatus.DELETED_BLOCK;
    break;
  }
  return new ReceivedDeletedBlockInfo(
      PBHelperClient.convert(proto.getBlock()),
      status,
      proto.hasDeleteHint() ? proto.getDeleteHint() : null);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:PBHelper.java

示例3: notifyNamenodeDeletedBlock

void notifyNamenodeDeletedBlock(ExtendedBlock block, String storageUuid) {
  checkBlock(block);
  ReceivedDeletedBlockInfo bInfo = new ReceivedDeletedBlockInfo(
     block.getLocalBlock(), BlockStatus.DELETED_BLOCK, null);
  
  for (BPServiceActor actor : bpServices) {
    actor.notifyNamenodeDeletedBlock(bInfo, storageUuid);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:BPOfferService.java

示例4: notifyNamenodeDeletedBlock

void notifyNamenodeDeletedBlock(ExtendedBlock block) {
  checkBlock(block);
  ReceivedDeletedBlockInfo bInfo = new ReceivedDeletedBlockInfo(
     block.getLocalBlock(), BlockStatus.DELETED_BLOCK, null);
  
  for (BPServiceActor actor : bpServices) {
    actor.notifyNamenodeDeletedBlock(bInfo);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:9,代码来源:BPOfferService.java

示例5: injectBlockDeleted

/**
 * Inject a fake 'deleted' block into the BPServiceActor state.
 */
private void injectBlockDeleted() {
  ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo(
      getDummyBlock(), BlockStatus.DELETED_BLOCK, null);
  actor.notifyNamenodeDeletedBlock(rdbi, storageUuid);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestIncrementalBlockReports.java

示例6: testTriggerBlockReport

private void testTriggerBlockReport(boolean incremental) throws Exception {
  Configuration conf = new HdfsConfiguration();

  // Set a really long value for dfs.blockreport.intervalMsec and
  // dfs.heartbeat.interval, so that incremental block reports and heartbeats
  // won't be sent during this test unless they're triggered
  // manually.
  conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 10800000L);
  conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1080L);

  final MiniDFSCluster cluster =
      new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
  cluster.waitActive();
  FileSystem fs = cluster.getFileSystem();
  DatanodeProtocolClientSideTranslatorPB spy =
      DataNodeTestUtils.spyOnBposToNN(
          cluster.getDataNodes().get(0), cluster.getNameNode());
  DFSTestUtil.createFile(fs, new Path("/abc"), 16, (short) 1, 1L);

  // We should get 1 incremental block report.
  Mockito.verify(spy, timeout(60000).times(1)).blockReceivedAndDeleted(
      any(DatanodeRegistration.class),
      anyString(),
      any(StorageReceivedDeletedBlocks[].class));

  // We should not receive any more incremental or incremental block reports,
  // since the interval we configured is so long.
  for (int i = 0; i < 3; i++) {
    Thread.sleep(10);
    Mockito.verify(spy, times(0)).blockReport(
        any(DatanodeRegistration.class),
        anyString(),
        any(StorageBlockReport[].class),
        Mockito.<BlockReportContext>anyObject());
    Mockito.verify(spy, times(1)).blockReceivedAndDeleted(
        any(DatanodeRegistration.class),
        anyString(),
        any(StorageReceivedDeletedBlocks[].class));
  }

  // Create a fake block deletion notification on the DataNode.
  // This will be sent with the next incremental block report.
  ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo(
      new Block(5678, 512, 1000),  BlockStatus.DELETED_BLOCK, null);
  DataNode datanode = cluster.getDataNodes().get(0);
  BPServiceActor actor =
      datanode.getAllBpOs()[0].getBPServiceActors().get(0);
  String storageUuid =
      datanode.getFSDataset().getVolumes().get(0).getStorageID();
  actor.notifyNamenodeDeletedBlock(rdbi, storageUuid);

  // Manually trigger a block report.
  datanode.triggerBlockReport(
      new BlockReportOptions.Factory().
          setIncremental(incremental).
          build()
  );

  // triggerBlockReport returns before the block report is
  // actually sent.  Wait for it to be sent here.
  if (incremental) {
    Mockito.verify(spy, timeout(60000).times(2)).
        blockReceivedAndDeleted(
            any(DatanodeRegistration.class),
            anyString(),
            any(StorageReceivedDeletedBlocks[].class));
  } else {
    Mockito.verify(spy, timeout(60000)).blockReport(
        any(DatanodeRegistration.class),
        anyString(),
        any(StorageBlockReport[].class),
        Mockito.<BlockReportContext>anyObject());
  }

  cluster.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:76,代码来源:TestTriggerBlockReport.java

示例7: testTriggerBlockReport

private void testTriggerBlockReport(boolean incremental) throws Exception {
  Configuration conf = new HdfsConfiguration();

  // Set a really long value for dfs.blockreport.intervalMsec and
  // dfs.heartbeat.interval, so that incremental block reports and heartbeats
  // won't be sent during this test unless they're triggered
  // manually.
  conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 10800000L);
  conf.setLong(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1080L);

  final MiniDFSCluster cluster =
      new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
  cluster.waitActive();
  FileSystem fs = cluster.getFileSystem();
  DatanodeProtocolClientSideTranslatorPB spy =
      DataNodeTestUtils.spyOnBposToNN(
          cluster.getDataNodes().get(0), cluster.getNameNode());
  DFSTestUtil.createFile(fs, new Path("/abc"), 16, (short) 1, 1L);

  // We should get 1 incremental block report.
  Mockito.verify(spy, timeout(60000).times(1)).blockReceivedAndDeleted(
      any(DatanodeRegistration.class),
      anyString(),
      any(StorageReceivedDeletedBlocks[].class));

  // We should not receive any more incremental or incremental block reports,
  // since the interval we configured is so long.
  for (int i = 0; i < 3; i++) {
    Thread.sleep(10);
    Mockito.verify(spy, times(0)).blockReport(
        any(DatanodeRegistration.class),
        anyString(),
        any(StorageBlockReport[].class),
        Mockito.<BlockReportContext>anyObject());
    Mockito.verify(spy, times(1)).blockReceivedAndDeleted(
        any(DatanodeRegistration.class),
        anyString(),
        any(StorageReceivedDeletedBlocks[].class));
  }

  // Create a fake block deletion notification on the DataNode.
  // This will be sent with the next incremental block report.
  ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo(
      new Block(5678, 512, 1000),  BlockStatus.DELETED_BLOCK, null);
  DataNode datanode = cluster.getDataNodes().get(0);
  BPServiceActor actor =
      datanode.getAllBpOs().get(0).getBPServiceActors().get(0);
  String storageUuid;
  try (FsDatasetSpi.FsVolumeReferences volumes =
      datanode.getFSDataset().getFsVolumeReferences()) {
    storageUuid = volumes.get(0).getStorageID();
  }
  actor.notifyNamenodeDeletedBlock(rdbi, storageUuid);

  // Manually trigger a block report.
  datanode.triggerBlockReport(
      new BlockReportOptions.Factory().
          setIncremental(incremental).
          build()
  );

  // triggerBlockReport returns before the block report is
  // actually sent.  Wait for it to be sent here.
  if (incremental) {
    Mockito.verify(spy, timeout(60000).times(2)).
        blockReceivedAndDeleted(
            any(DatanodeRegistration.class),
            anyString(),
            any(StorageReceivedDeletedBlocks[].class));
  } else {
    Mockito.verify(spy, timeout(60000)).blockReport(
        any(DatanodeRegistration.class),
        anyString(),
        any(StorageBlockReport[].class),
        Mockito.<BlockReportContext>anyObject());
  }

  cluster.shutdown();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:79,代码来源:TestTriggerBlockReport.java


注:本文中的org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo.BlockStatus.DELETED_BLOCK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。