• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BlockRecord类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord的典型用法代码示例。如果您正苦于以下问题:Java BlockRecord类的具体用法?Java BlockRecord怎么用?Java BlockRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BlockRecord类属于org.apache.hadoop.hdfs.server.datanode.DataNode包,在下文中一共展示了BlockRecord类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testSyncReplicas

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/** Sync two replicas */
private void testSyncReplicas(ReplicaRecoveryInfo replica1, 
    ReplicaRecoveryInfo replica2,
    InterDatanodeProtocol dn1,
    InterDatanodeProtocol dn2,
    long expectLen) throws IOException {
  
  DatanodeInfo[] locs = new DatanodeInfo[]{
      mock(DatanodeInfo.class), mock(DatanodeInfo.class)};
  RecoveringBlock rBlock = new RecoveringBlock(block, 
      locs, RECOVERY_ID);
  ArrayList<BlockRecord> syncList = new ArrayList<BlockRecord>(2);
  BlockRecord record1 = new BlockRecord(
      DFSTestUtil.getDatanodeInfo("1.2.3.4", "bogus", 1234), dn1, replica1);
  BlockRecord record2 = new BlockRecord(
      DFSTestUtil.getDatanodeInfo("1.2.3.4", "bogus", 1234), dn2, replica2);
  syncList.add(record1);
  syncList.add(record2);
  
  when(dn1.updateReplicaUnderRecovery((ExtendedBlock)anyObject(), anyLong(),
      anyLong(), anyLong())).thenReturn("storage1");
  when(dn2.updateReplicaUnderRecovery((ExtendedBlock)anyObject(), anyLong(),
      anyLong(), anyLong())).thenReturn("storage2");
  dn.syncBlock(rBlock, syncList);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestBlockRecovery.java


示例2: testSyncReplicas

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/** Sync two replicas */
private void testSyncReplicas(ReplicaRecoveryInfo replica1, 
    ReplicaRecoveryInfo replica2,
    InterDatanodeProtocol dn1,
    InterDatanodeProtocol dn2,
    long expectLen) throws IOException {
  
  DatanodeInfo[] locs = new DatanodeInfo[]{
      mock(DatanodeInfo.class), mock(DatanodeInfo.class)};
  RecoveringBlock rBlock = new RecoveringBlock(block, 
      locs, RECOVERY_ID);
  ArrayList<BlockRecord> syncList = new ArrayList<BlockRecord>(2);
  BlockRecord record1 = new BlockRecord(
      DFSTestUtil.getDatanodeInfo("1.2.3.4", "bogus", 1234), dn1, replica1);
  BlockRecord record2 = new BlockRecord(
      DFSTestUtil.getDatanodeInfo("1.2.3.4", "bogus", 1234), dn2, replica2);
  syncList.add(record1);
  syncList.add(record2);
  
  when(dn1.updateReplicaUnderRecovery((ExtendedBlock)anyObject(), anyLong(), 
      anyLong())).thenReturn("storage1");
  when(dn2.updateReplicaUnderRecovery((ExtendedBlock)anyObject(), anyLong(), 
      anyLong())).thenReturn("storage2");
  dn.syncBlock(rBlock, syncList);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:26,代码来源:TestBlockRecovery.java


示例3: testSyncReplicas

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/**
 * Sync two replicas
 */
private void testSyncReplicas(ReplicaRecoveryInfo replica1,
    ReplicaRecoveryInfo replica2, InterDatanodeProtocol dn1,
    InterDatanodeProtocol dn2, long expectLen) throws IOException {
  
  DatanodeInfo[] locs =
      new DatanodeInfo[]{mock(DatanodeInfo.class), mock(DatanodeInfo.class)};
  RecoveringBlock rBlock = new RecoveringBlock(block, locs, RECOVERY_ID);
  ArrayList<BlockRecord> syncList = new ArrayList<>(2);
  BlockRecord record1 =
      new BlockRecord(DFSTestUtil.getDatanodeInfo("1.2.3.4", "bogus", 1234),
          dn1, replica1);
  BlockRecord record2 =
      new BlockRecord(DFSTestUtil.getDatanodeInfo("1.2.3.4", "bogus", 1234),
          dn2, replica2);
  syncList.add(record1);
  syncList.add(record2);
  
  when(dn1.updateReplicaUnderRecovery((ExtendedBlock) anyObject(), anyLong(),
      anyLong())).thenReturn("storage1");
  when(dn2.updateReplicaUnderRecovery((ExtendedBlock) anyObject(), anyLong(),
      anyLong())).thenReturn("storage2");
  dn.syncBlock(rBlock, syncList);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:TestBlockRecovery.java


示例4: testRecoveryInProgressException

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/**
 * BlockRecoveryFI_05. One DN throws RecoveryInProgressException.
 *
 * @throws IOException
 *     in case of an error
 */
@Test
public void testRecoveryInProgressException()
    throws IOException, InterruptedException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Running " + GenericTestUtils.getMethodName());
  }
  try {
    DataNode spyDN = spy(dn);
    doThrow(
        new RecoveryInProgressException("Replica recovery is in progress")).
        when(spyDN).initReplicaRecovery(any(RecoveringBlock.class));
    Daemon d = spyDN.recoverBlocks("fake NN", initRecoveringBlocks());
    d.join();
    verify(spyDN, never())
        .syncBlock(any(RecoveringBlock.class), anyListOf(BlockRecord.class));
  } catch (Exception e) {
    e.printStackTrace();
  }

}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:TestBlockRecovery.java


示例5: testRecoveryInProgressException

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/**
 * BlockRecoveryFI_05. One DN throws RecoveryInProgressException.
 *
 * @throws IOException
 *           in case of an error
 */
@Test
public void testRecoveryInProgressException()
  throws IOException, InterruptedException {
  if(LOG.isDebugEnabled()) {
    LOG.debug("Running " + GenericTestUtils.getMethodName());
  }
  DataNode spyDN = spy(dn);
  doThrow(new RecoveryInProgressException("Replica recovery is in progress")).
     when(spyDN).initReplicaRecovery(any(RecoveringBlock.class));
  Daemon d = spyDN.recoverBlocks("fake NN", initRecoveringBlocks());
  d.join();
  verify(spyDN, never()).syncBlock(
      any(RecoveringBlock.class), anyListOf(BlockRecord.class));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestBlockRecovery.java


示例6: testErrorReplicas

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/**
 * BlockRecoveryFI_06. all datanodes throws an exception.
 *
 * @throws IOException
 *           in case of an error
 */
@Test
public void testErrorReplicas() throws IOException, InterruptedException {
  if(LOG.isDebugEnabled()) {
    LOG.debug("Running " + GenericTestUtils.getMethodName());
  }
  DataNode spyDN = spy(dn);
  doThrow(new IOException()).
     when(spyDN).initReplicaRecovery(any(RecoveringBlock.class));
  Daemon d = spyDN.recoverBlocks("fake NN", initRecoveringBlocks());
  d.join();
  verify(spyDN, never()).syncBlock(
      any(RecoveringBlock.class), anyListOf(BlockRecord.class));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestBlockRecovery.java


示例7: initBlockRecords

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
private List<BlockRecord> initBlockRecords(DataNode spyDN) throws IOException {
  List<BlockRecord> blocks = new ArrayList<BlockRecord>(1);
  DatanodeRegistration dnR = dn.getDNRegistrationForBP(block.getBlockPoolId());
  BlockRecord blockRecord = new BlockRecord(
      new DatanodeID(dnR), spyDN,
      new ReplicaRecoveryInfo(block.getBlockId(), block.getNumBytes(),
          block.getGenerationStamp(), ReplicaState.FINALIZED));
  blocks.add(blockRecord);
  return blocks;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:TestBlockRecovery.java


示例8: testErrorReplicas

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/**
 * BlockRecoveryFI_06. all datanodes throws an exception.
 *
 * @throws IOException
 *     in case of an error
 */
@Test
public void testErrorReplicas() throws IOException, InterruptedException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Running " + GenericTestUtils.getMethodName());
  }
  DataNode spyDN = spy(dn);
  doThrow(new IOException()).
      when(spyDN).initReplicaRecovery(any(RecoveringBlock.class));
  Daemon d = spyDN.recoverBlocks("fake NN", initRecoveringBlocks());
  d.join();
  verify(spyDN, never())
      .syncBlock(any(RecoveringBlock.class), anyListOf(BlockRecord.class));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:20,代码来源:TestBlockRecovery.java


示例9: initBlockRecords

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
private List<BlockRecord> initBlockRecords(DataNode spyDN)
    throws IOException {
  List<BlockRecord> blocks = new ArrayList<>(1);
  DatanodeRegistration dnR =
      dn.getDNRegistrationForBP(block.getBlockPoolId());
  BlockRecord blockRecord = new BlockRecord(new DatanodeID(dnR), spyDN,
      new ReplicaRecoveryInfo(block.getBlockId(), block.getNumBytes(),
          block.getGenerationStamp(), ReplicaState.FINALIZED));
  blocks.add(blockRecord);
  return blocks;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:12,代码来源:TestBlockRecovery.java


示例10: testSyncReplicas

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/** Sync two replicas */
private void testSyncReplicas(ReplicaRecoveryInfo replica1, 
    ReplicaRecoveryInfo replica2,
    InterDatanodeProtocol dn1,
    InterDatanodeProtocol dn2,
    long expectLen) throws IOException {
  
  DatanodeInfo[] locs = new DatanodeInfo[]{
      mock(DatanodeInfo.class), mock(DatanodeInfo.class)};
  RecoveringBlock rBlock = new RecoveringBlock(block, 
      locs, RECOVERY_ID);
  ArrayList<BlockRecord> syncList = new ArrayList<BlockRecord>(2);
  BlockRecord record1 = new BlockRecord(
      new DatanodeID("xx", "yy", 44, 55), dn1, replica1);
  BlockRecord record2 = new BlockRecord(
      new DatanodeID("aa", "bb", 11, 22), dn2, replica2);
  syncList.add(record1);
  syncList.add(record2);
  
  when(dn1.updateReplicaUnderRecovery((Block)anyObject(), anyLong(), 
      anyLong())).thenReturn(new Block(block.getBlockId(), 
          expectLen, block.getGenerationStamp()));
  when(dn2.updateReplicaUnderRecovery((Block)anyObject(), anyLong(), 
      anyLong())).thenReturn(new Block(block.getBlockId(), 
          expectLen, block.getGenerationStamp()));
  dn.syncBlock(rBlock, syncList);
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:28,代码来源:TestBlockRecovery.java


示例11: testRecoveryInProgressException

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/**
 * BlockRecoveryFI_05. One DN throws RecoveryInProgressException.
 *
 * @throws IOException
 *           in case of an error
 */
@Test
public void testRecoveryInProgressException()
  throws IOException, InterruptedException {
  if(LOG.isDebugEnabled()) {
    LOG.debug("Running " + GenericTestUtils.getMethodName());
  }
  DataNode spyDN = spy(dn);
  doThrow(new RecoveryInProgressException("Replica recovery is in progress")).
     when(spyDN).initReplicaRecovery(any(RecoveringBlock.class));
  Daemon d = spyDN.recoverBlocks(initRecoveringBlocks());
  d.join();
  verify(spyDN, never()).syncBlock(
      any(RecoveringBlock.class), anyListOf(BlockRecord.class));
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:21,代码来源:TestBlockRecovery.java


示例12: testErrorReplicas

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
/**
 * BlockRecoveryFI_06. all datanodes throws an exception.
 *
 * @throws IOException
 *           in case of an error
 */
@Test
public void testErrorReplicas() throws IOException, InterruptedException {
  if(LOG.isDebugEnabled()) {
    LOG.debug("Running " + GenericTestUtils.getMethodName());
  }
  DataNode spyDN = spy(dn);
  doThrow(new IOException()).
     when(spyDN).initReplicaRecovery(any(RecoveringBlock.class));
  Daemon d = spyDN.recoverBlocks(initRecoveringBlocks());
  d.join();
  verify(spyDN, never()).syncBlock(
      any(RecoveringBlock.class), anyListOf(BlockRecord.class));
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:20,代码来源:TestBlockRecovery.java


示例13: initBlockRecords

import org.apache.hadoop.hdfs.server.datanode.DataNode.BlockRecord; //导入依赖的package包/类
private List<BlockRecord> initBlockRecords(DataNode spyDN) {
  List<BlockRecord> blocks = new ArrayList<BlockRecord>(1);
  BlockRecord blockRecord = new BlockRecord(
      new DatanodeID(dn.dnRegistration), spyDN,
      new ReplicaRecoveryInfo(block.getBlockId(), block.getNumBytes(),
          block.getGenerationStamp(), ReplicaState.FINALIZED));
  blocks.add(blockRecord);
  return blocks;
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:10,代码来源:TestBlockRecovery.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TokenStream类代码示例发布时间:2022-05-22
下一篇:
Java MembershipKey类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap