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


Java BlockUCState.UNDER_CONSTRUCTION属性代码示例

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


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

示例1: addBlock

/**
 * Add a block to the file. Returns a reference to the added block.
 */
BlockInfoContiguous addBlock(String path, INodesInPath inodesInPath,
    Block block, DatanodeStorageInfo[] targets) throws IOException {
  writeLock();
  try {
    final INodeFile fileINode = inodesInPath.getLastINode().asFile();
    Preconditions.checkState(fileINode.isUnderConstruction());

    // check quota limits and updated space consumed
    updateCount(inodesInPath, 0, fileINode.getPreferredBlockSize(),
        fileINode.getBlockReplication(), true);

    // associate new last block for the file
    BlockInfoContiguousUnderConstruction blockInfo =
      new BlockInfoContiguousUnderConstruction(
          block,
          fileINode.getFileReplication(),
          BlockUCState.UNDER_CONSTRUCTION,
          targets);
    getBlockManager().addBlockCollection(blockInfo, fileINode);
    fileINode.addBlock(blockInfo);

    if(NameNode.stateChangeLog.isDebugEnabled()) {
      NameNode.stateChangeLog.debug("DIR* FSDirectory.addBlock: "
          + path + " with " + block
          + " block is added to the in-memory "
          + "file system");
    }
    return blockInfo;
  } finally {
    writeUnlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:FSDirectory.java

示例2: addBlock

/**
 * Add a block to the file. Returns a reference to the added block.
 */
BlockInfo addBlock(String path, INodesInPath inodesInPath, Block block,
    DatanodeStorageInfo[] targets) throws IOException {
  writeLock();
  try {
    final INodeFile fileINode = inodesInPath.getLastINode().asFile();
    Preconditions.checkState(fileINode.isUnderConstruction());

    // check quota limits and updated space consumed
    updateCount(inodesInPath, 0, fileINode.getBlockDiskspace(), true);

    // associate new last block for the file
    BlockInfoUnderConstruction blockInfo =
      new BlockInfoUnderConstruction(
          block,
          fileINode.getFileReplication(),
          BlockUCState.UNDER_CONSTRUCTION,
          targets);
    getBlockManager().addBlockCollection(blockInfo, fileINode);
    fileINode.addBlock(blockInfo);

    if(NameNode.stateChangeLog.isDebugEnabled()) {
      NameNode.stateChangeLog.debug("DIR* FSDirectory.addBlock: "
          + path + " with " + block
          + " block is added to the in-memory "
          + "file system");
    }
    return blockInfo;
  } finally {
    writeUnlock();
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:34,代码来源:FSDirectory.java

示例3: addBlock

/**
 * Add a block to the file. Returns a reference to the added block.
 */
BlockInfo addBlock(String path, INodesInPath inodesInPath, Block block,
    DatanodeDescriptor targets[]) throws IOException {
  waitForReady();

  writeLock();
  try {
    final INodeFileUnderConstruction fileINode = 
        INodeFileUnderConstruction.valueOf(inodesInPath.getLastINode(), path);

    // check quota limits and updated space consumed
    updateCount(inodesInPath, 0, fileINode.getBlockDiskspace(), true);

    // associate new last block for the file
    BlockInfoUnderConstruction blockInfo =
      new BlockInfoUnderConstruction(
          block,
          fileINode.getFileReplication(),
          BlockUCState.UNDER_CONSTRUCTION,
          targets);
    getBlockManager().addBlockCollection(blockInfo, fileINode);
    fileINode.addBlock(blockInfo);

    if(NameNode.stateChangeLog.isDebugEnabled()) {
      NameNode.stateChangeLog.debug("DIR* FSDirectory.addBlock: "
          + path + " with " + block
          + " block is added to the in-memory "
          + "file system");
    }
    return blockInfo;
  } finally {
    writeUnlock();
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:36,代码来源:FSDirectory.java

示例4: checkUCBlock

private INodeFileUnderConstruction checkUCBlock(ExtendedBlock block,
    String clientName) throws IOException {
  if (isInSafeMode()) {
    throw new SafeModeException("Cannot get a new generation stamp and an " +
        "access token for block " + block, safeMode);
  }

  // check stored block state
  BlockInfo storedBlock =
      blockManager.getStoredBlock(ExtendedBlock.getLocalBlock(block));
  if (storedBlock == null ||
      storedBlock.getBlockUCState() != BlockUCState.UNDER_CONSTRUCTION) {
    throw new IOException(block +
        " does not exist or is not under Construction" + storedBlock);
  }

  // check file inode
  INodeFile file = (INodeFile) storedBlock.getBlockCollection();
  if (file == null || !file.isUnderConstruction()) {
    throw new IOException("The file " + storedBlock +
        " belonged to does not exist or it is not under construction.");
  }

  // check lease
  INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction) file;
  if (clientName == null || !clientName.equals(pendingFile.getClientName())) {
    throw new LeaseExpiredException("Lease mismatch: " + block +
        " is accessed by a non lease holder " + clientName);
  }

  return pendingFile;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:32,代码来源:FSNamesystem.java

示例5: addBlock

/**
 * Add a block to the file. Returns a reference to the added block.
 */
BlockInfo addBlock(String path, INodesInPath inodesInPath, Block block,
    DatanodeStorageInfo[] targets) throws IOException {
  waitForReady();

  writeLock();
  try {
    final INodeFile fileINode = inodesInPath.getLastINode().asFile();
    Preconditions.checkState(fileINode.isUnderConstruction());

    // check quota limits and updated space consumed
    updateCount(inodesInPath, 0, fileINode.getBlockDiskspace(), true);

    // associate new last block for the file
    BlockInfoUnderConstruction blockInfo =
      new BlockInfoUnderConstruction(
          block,
          fileINode.getFileReplication(),
          BlockUCState.UNDER_CONSTRUCTION,
          targets);
    getBlockManager().addBlockCollection(blockInfo, fileINode);
    fileINode.addBlock(blockInfo);

    if(NameNode.stateChangeLog.isDebugEnabled()) {
      NameNode.stateChangeLog.debug("DIR* FSDirectory.addBlock: "
          + path + " with " + block
          + " block is added to the in-memory "
          + "file system");
    }
    return blockInfo;
  } finally {
    writeUnlock();
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:36,代码来源:FSDirectory.java

示例6: testInitializeBlockRecovery

@Test
public void testInitializeBlockRecovery() throws Exception {
  DatanodeStorageInfo s1 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.1", "s1");
  DatanodeDescriptor dd1 = s1.getDatanodeDescriptor();
  DatanodeStorageInfo s2 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.2", "s2");
  DatanodeDescriptor dd2 = s2.getDatanodeDescriptor();
  DatanodeStorageInfo s3 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.3", "s3");
  DatanodeDescriptor dd3 = s3.getDatanodeDescriptor();

  dd1.isAlive = dd2.isAlive = dd3.isAlive = true;
  BlockInfoContiguousUnderConstruction blockInfo = new BlockInfoContiguousUnderConstruction(
      new Block(0, 0, GenerationStamp.LAST_RESERVED_STAMP),
      (short) 3,
      BlockUCState.UNDER_CONSTRUCTION,
      new DatanodeStorageInfo[] {s1, s2, s3});

  // Recovery attempt #1.
  DFSTestUtil.resetLastUpdatesWithOffset(dd1, -3 * 1000);
  DFSTestUtil.resetLastUpdatesWithOffset(dd2, -1 * 1000);
  DFSTestUtil.resetLastUpdatesWithOffset(dd3, -2 * 1000);
  blockInfo.initializeBlockRecovery(1);
  BlockInfoContiguousUnderConstruction[] blockInfoRecovery = dd2.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #2.
  DFSTestUtil.resetLastUpdatesWithOffset(dd1, -2 * 1000);
  DFSTestUtil.resetLastUpdatesWithOffset(dd2, -1 * 1000);
  DFSTestUtil.resetLastUpdatesWithOffset(dd3, -3 * 1000);
  blockInfo.initializeBlockRecovery(2);
  blockInfoRecovery = dd1.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #3.
  DFSTestUtil.resetLastUpdatesWithOffset(dd1, -2 * 1000);
  DFSTestUtil.resetLastUpdatesWithOffset(dd2, -1 * 1000);
  DFSTestUtil.resetLastUpdatesWithOffset(dd3, -3 * 1000);
  blockInfo.initializeBlockRecovery(3);
  blockInfoRecovery = dd3.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #4.
  // Reset everything. And again pick DN with most recent heart beat.
  DFSTestUtil.resetLastUpdatesWithOffset(dd1, -2 * 1000);
  DFSTestUtil.resetLastUpdatesWithOffset(dd2, -1 * 1000);
  DFSTestUtil.resetLastUpdatesWithOffset(dd3, 0);
  blockInfo.initializeBlockRecovery(3);
  blockInfoRecovery = dd3.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:49,代码来源:TestBlockInfoUnderConstruction.java

示例7: testInitializeBlockRecovery

@Test
public void testInitializeBlockRecovery() throws Exception {
  DatanodeStorageInfo s1 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.1", "s1");
  DatanodeDescriptor dd1 = s1.getDatanodeDescriptor();
  DatanodeStorageInfo s2 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.2", "s2");
  DatanodeDescriptor dd2 = s2.getDatanodeDescriptor();
  DatanodeStorageInfo s3 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.3", "s3");
  DatanodeDescriptor dd3 = s3.getDatanodeDescriptor();

  dd1.isAlive = dd2.isAlive = dd3.isAlive = true;
  BlockInfoUnderConstruction blockInfo = new BlockInfoUnderConstruction(
      new Block(0, 0, GenerationStamp.LAST_RESERVED_STAMP),
      (short) 3,
      BlockUCState.UNDER_CONSTRUCTION,
      new DatanodeStorageInfo[] {s1, s2, s3});

  // Recovery attempt #1.
  long currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 3 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 2 * 1000);
  blockInfo.initializeBlockRecovery(1);
  BlockInfoUnderConstruction[] blockInfoRecovery = dd2.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #2.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 3 * 1000);
  blockInfo.initializeBlockRecovery(2);
  blockInfoRecovery = dd1.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #3.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 3 * 1000);
  currentTime = System.currentTimeMillis();
  blockInfo.initializeBlockRecovery(3);
  blockInfoRecovery = dd3.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #4.
  // Reset everything. And again pick DN with most recent heart beat.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime);
  currentTime = System.currentTimeMillis();
  blockInfo.initializeBlockRecovery(3);
  blockInfoRecovery = dd3.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:55,代码来源:TestBlockInfoUnderConstruction.java

示例8: testInitializeBlockRecovery

@Test
public void testInitializeBlockRecovery() throws Exception {
  DatanodeDescriptor dd1 = DFSTestUtil.getDatanodeDescriptor("10.10.1.1",
      "default");
  DatanodeDescriptor dd2 = DFSTestUtil.getDatanodeDescriptor("10.10.1.2",
      "default");
  DatanodeDescriptor dd3 = DFSTestUtil.getDatanodeDescriptor("10.10.1.3",
      "default");
  dd1.isAlive = dd2.isAlive = dd3.isAlive = true;
  BlockInfoUnderConstruction blockInfo = new BlockInfoUnderConstruction(
      new Block(0, 0, GenerationStamp.LAST_RESERVED_STAMP),
      3,
      BlockUCState.UNDER_CONSTRUCTION,
      new DatanodeDescriptor[] {dd1, dd2, dd3});

  // Recovery attempt #1.
  long currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 3 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 2 * 1000);
  blockInfo.initializeBlockRecovery(1);
  BlockInfoUnderConstruction[] blockInfoRecovery = dd2.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #2.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 3 * 1000);
  blockInfo.initializeBlockRecovery(2);
  blockInfoRecovery = dd1.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #3.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 3 * 1000);
  currentTime = System.currentTimeMillis();
  blockInfo.initializeBlockRecovery(3);
  blockInfoRecovery = dd3.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #4.
  // Reset everything. And again pick DN with most recent heart beat.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime);
  currentTime = System.currentTimeMillis();
  blockInfo.initializeBlockRecovery(3);
  blockInfoRecovery = dd3.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:54,代码来源:TestBlockInfoUnderConstruction.java

示例9: testInitializeBlockRecovery

@Test
public void testInitializeBlockRecovery() throws Exception {
  DatanodeStorageInfo s1 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.1", "s1");
  DatanodeDescriptor dd1 = s1.getDatanodeDescriptor();
  DatanodeStorageInfo s2 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.2", "s2");
  DatanodeDescriptor dd2 = s2.getDatanodeDescriptor();
  DatanodeStorageInfo s3 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.3", "s3");
  DatanodeDescriptor dd3 = s3.getDatanodeDescriptor();

  dd1.isAlive = dd2.isAlive = dd3.isAlive = true;
  BlockInfoUnderConstruction blockInfo = new BlockInfoUnderConstruction(
      new Block(0, 0, GenerationStamp.LAST_RESERVED_STAMP),
      3,
      BlockUCState.UNDER_CONSTRUCTION,
      new DatanodeStorageInfo[] {s1, s2, s3});

  // Recovery attempt #1.
  long currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 3 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 2 * 1000);
  blockInfo.initializeBlockRecovery(1);
  BlockInfoUnderConstruction[] blockInfoRecovery = dd2.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #2.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 3 * 1000);
  blockInfo.initializeBlockRecovery(2);
  blockInfoRecovery = dd1.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #3.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime - 3 * 1000);
  currentTime = System.currentTimeMillis();
  blockInfo.initializeBlockRecovery(3);
  blockInfoRecovery = dd3.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);

  // Recovery attempt #4.
  // Reset everything. And again pick DN with most recent heart beat.
  currentTime = System.currentTimeMillis();
  dd1.setLastUpdate(currentTime - 2 * 1000);
  dd2.setLastUpdate(currentTime - 1 * 1000);
  dd3.setLastUpdate(currentTime);
  currentTime = System.currentTimeMillis();
  blockInfo.initializeBlockRecovery(3);
  blockInfoRecovery = dd3.getLeaseRecoveryCommand(1);
  assertEquals(blockInfoRecovery[0], blockInfo);
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:55,代码来源:TestBlockInfoUnderConstruction.java

示例10: BlockInfoUnderConstruction

/**
 * Create block and set its state to {@link BlockUCState#UNDER_CONSTRUCTION}.
 */
public BlockInfoUnderConstruction(Block blk, int inodeId) {
  this(blk, inodeId, BlockUCState.UNDER_CONSTRUCTION);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:6,代码来源:BlockInfoUnderConstruction.java

示例11: BlockInfoContiguousUnderConstruction

/**
 * Create block and set its state to
 * {@link BlockUCState#UNDER_CONSTRUCTION}.
 */
public BlockInfoContiguousUnderConstruction(Block blk, short replication) {
  this(blk, replication, BlockUCState.UNDER_CONSTRUCTION, null);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:BlockInfoContiguousUnderConstruction.java

示例12: BlockInfoUnderConstruction

/**
 * Create block and set its state to
 * {@link BlockUCState#UNDER_CONSTRUCTION}.
 */
public BlockInfoUnderConstruction(Block blk, short replication) {
  this(blk, replication, BlockUCState.UNDER_CONSTRUCTION, null);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:7,代码来源:BlockInfoUnderConstruction.java

示例13: BlockInfoUnderConstruction

/**
 * Create block and set its state to
 * {@link BlockUCState#UNDER_CONSTRUCTION}.
 */
public BlockInfoUnderConstruction(Block blk, int replication) {
  this(blk, replication, BlockUCState.UNDER_CONSTRUCTION, null);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:7,代码来源:BlockInfoUnderConstruction.java


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