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


Java BlockUCState.COMMITTED属性代码示例

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


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

示例1: addStoredBlockImmediate

/**
 * Faster version of {@link #addStoredBlock},
 * intended for use with initial block report at startup. If not in startup
 * safe mode, will call standard addStoredBlock(). Assumes this method is
 * called "immediately" so there is no need to refresh the storedBlock from
 * blocksMap. Doesn't handle underReplication/overReplication, or worry about
 * pendingReplications or corruptReplicas, because it's in startup safe mode.
 * Doesn't log every block, because there are typically millions of them.
 * 
 * @throws IOException
 */
private void addStoredBlockImmediate(BlockInfoContiguous storedBlock,
    DatanodeStorageInfo storageInfo)
throws IOException {
  assert (storedBlock != null && namesystem.hasWriteLock());
  if (!namesystem.isInStartupSafeMode() 
      || namesystem.isPopulatingReplQueues()) {
    addStoredBlock(storedBlock, storageInfo, null, false);
    return;
  }

  // just add it
  AddBlockResult result = storageInfo.addBlock(storedBlock);

  // Now check for completion of blocks and safe block count
  int numCurrentReplica = countLiveNodes(storedBlock);
  if (storedBlock.getBlockUCState() == BlockUCState.COMMITTED
      && numCurrentReplica >= minReplication) {
    completeBlock(storedBlock.getBlockCollection(), storedBlock, false);
  } else if (storedBlock.isComplete() && result == AddBlockResult.ADDED) {
    // check whether safe replication is reached for the block
    // only complete blocks are counted towards that.
    // In the case that the block just became complete above, completeBlock()
    // handles the safe block count maintenance.
    namesystem.incrementSafeBlockCount(numCurrentReplica);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:BlockManager.java

示例2: commitBlock

/**
 * Commit block's length and generation stamp as reported by the client.
 * Set block state to {@link BlockUCState#COMMITTED}.
 * @param block - contains client reported block length and generation 
 * @throws IOException if block ids are inconsistent.
 */
void commitBlock(Block block) throws IOException {
  if(getBlockId() != block.getBlockId())
    throw new IOException("Trying to commit inconsistent block: id = "
        + block.getBlockId() + ", expected id = " + getBlockId());
  blockUCState = BlockUCState.COMMITTED;
  this.set(getBlockId(), block.getNumBytes(), block.getGenerationStamp());
  // Sort out invalid replicas.
  setGenerationStampAndVerifyReplicas(block.getGenerationStamp());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:BlockInfoContiguousUnderConstruction.java

示例3: completeBlock

/**
 * Convert a specified block of the file to a complete block.
 * @throws IOException if the block does not have at least a minimal number
 * of replicas reported from data-nodes.
 */
private void completeBlock(BlockInfo curBlock, boolean force)
    throws IOException {
  if (curBlock.isComplete()) {
    return;
  }

  int numNodes = curBlock.numNodes();
  if (!force && !hasMinStorage(curBlock, numNodes)) {
    throw new IOException("Cannot complete block: "
        + "block does not satisfy minimal replication requirement.");
  }
  if (!force && curBlock.getBlockUCState() != BlockUCState.COMMITTED) {
    throw new IOException(
        "Cannot complete block: block has not been COMMITTED by the client");
  }

  curBlock.convertToCompleteBlock();
  // Since safe-mode only counts complete blocks, and we now have
  // one more complete block, we need to adjust the total up, and
  // also count it as safe, if we have at least the minimum replica
  // count. (We may not have the minimum replica count yet if this is
  // a "forced" completion when a file is getting closed by an
  // OP_CLOSE edit on the standby).
  bmSafeMode.adjustBlockTotals(0, 1);
  final int minStorage = curBlock.isStriped() ?
      ((BlockInfoStriped) curBlock).getRealDataBlockNum() : minReplication;
  bmSafeMode.incrementSafeBlockCount(Math.min(numNodes, minStorage),
      curBlock);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:34,代码来源:BlockManager.java

示例4: addStoredBlockImmediate

/**
 * Faster version of {@link #addStoredBlock},
 * intended for use with initial block report at startup. If not in startup
 * safe mode, will call standard addStoredBlock(). Assumes this method is
 * called "immediately" so there is no need to refresh the storedBlock from
 * blocksMap. Doesn't handle underReplication/overReplication, or worry about
 * pendingReplications or corruptReplicas, because it's in startup safe mode.
 * Doesn't log every block, because there are typically millions of them.
 * 
 * @throws IOException
 */
private void addStoredBlockImmediate(BlockInfo storedBlock, Block reported,
    DatanodeStorageInfo storageInfo)
throws IOException {
  assert (storedBlock != null && namesystem.hasWriteLock());
  if (!namesystem.isInStartupSafeMode()
      || isPopulatingReplQueues()) {
    addStoredBlock(storedBlock, reported, storageInfo, null, false);
    return;
  }

  // just add it
  AddBlockResult result = storageInfo.addBlock(storedBlock, reported);

  // Now check for completion of blocks and safe block count
  int numCurrentReplica = countLiveNodes(storedBlock);
  if (storedBlock.getBlockUCState() == BlockUCState.COMMITTED
      && hasMinStorage(storedBlock, numCurrentReplica)) {
    completeBlock(storedBlock, false);
  } else if (storedBlock.isComplete() && result == AddBlockResult.ADDED) {
    // check whether safe replication is reached for the block
    // only complete blocks are counted towards that.
    // In the case that the block just became complete above, completeBlock()
    // handles the safe block count maintenance.
    bmSafeMode.incrementSafeBlockCount(numCurrentReplica, storedBlock);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:37,代码来源:BlockManager.java

示例5: getRealDataBlockNum

/**
 * If the block is committed/completed and its length is less than a full
 * stripe, it returns the the number of actual data blocks.
 * Otherwise it returns the number of data units specified by erasure coding policy.
 */
public short getRealDataBlockNum() {
  if (isComplete() || getBlockUCState() == BlockUCState.COMMITTED) {
    return (short) Math.min(getDataBlockNum(),
        (getNumBytes() - 1) / ecPolicy.getCellSize() + 1);
  } else {
    return getDataBlockNum();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:13,代码来源:BlockInfoStriped.java

示例6: addStoredBlockImmediate

/**
 * Faster version of
 * {@link #addStoredBlock(BlockInfo, DatanodeStorageInfo, DatanodeDescriptor, boolean)}
 * , intended for use with initial block report at startup. If not in startup
 * safe mode, will call standard addStoredBlock(). Assumes this method is
 * called "immediately" so there is no need to refresh the storedBlock from
 * blocksMap. Doesn't handle underReplication/overReplication, or worry about
 * pendingReplications or corruptReplicas, because it's in startup safe mode.
 * Doesn't log every block, because there are typically millions of them.
 * 
 * @throws IOException
 */
private void addStoredBlockImmediate(BlockInfo storedBlock,
    DatanodeStorageInfo storageInfo)
throws IOException {
  assert (storedBlock != null && namesystem.hasWriteLock());
  if (!namesystem.isInStartupSafeMode() 
      || namesystem.isPopulatingReplQueues()) {
    addStoredBlock(storedBlock, storageInfo, null, false);
    return;
  }

  // just add it
  AddBlockResult result = storageInfo.addBlock(storedBlock);

  // Now check for completion of blocks and safe block count
  int numCurrentReplica = countLiveNodes(storedBlock);
  if (storedBlock.getBlockUCState() == BlockUCState.COMMITTED
      && numCurrentReplica >= minReplication) {
    completeBlock(storedBlock.getBlockCollection(), storedBlock, false);
  } else if (storedBlock.isComplete() && result == AddBlockResult.ADDED) {
    // check whether safe replication is reached for the block
    // only complete blocks are counted towards that.
    // In the case that the block just became complete above, completeBlock()
    // handles the safe block count maintenance.
    namesystem.incrementSafeBlockCount(numCurrentReplica);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:38,代码来源:BlockManager.java

示例7: addStoredBlockImmediate

/**
 * Faster version of
 * {@link #addStoredBlock(BlockInfo, DatanodeDescriptor, DatanodeDescriptor, boolean)}
 * , intended for use with initial block report at startup. If not in startup
 * safe mode, will call standard addStoredBlock(). Assumes this method is
 * called "immediately" so there is no need to refresh the storedBlock from
 * blocksMap. Doesn't handle underReplication/overReplication, or worry about
 * pendingReplications or corruptReplicas, because it's in startup safe mode.
 * Doesn't log every block, because there are typically millions of them.
 * 
 * @throws IOException
 */
private void addStoredBlockImmediate(BlockInfo storedBlock,
                             DatanodeDescriptor node)
throws IOException {
  assert (storedBlock != null && namesystem.hasWriteLock());
  if (!namesystem.isInStartupSafeMode() 
      || namesystem.isPopulatingReplQueues()) {
    addStoredBlock(storedBlock, node, null, false);
    return;
  }

  // just add it
  node.addBlock(storedBlock);

  // Now check for completion of blocks and safe block count
  int numCurrentReplica = countLiveNodes(storedBlock);
  if (storedBlock.getBlockUCState() == BlockUCState.COMMITTED
      && numCurrentReplica >= minReplication) {
    completeBlock((MutableBlockCollection)storedBlock.getBlockCollection(), storedBlock, false);
  } else if (storedBlock.isComplete()) {
    // check whether safe replication is reached for the block
    // only complete blocks are counted towards that.
    // In the case that the block just became complete above, completeBlock()
    // handles the safe block count maintenance.
    namesystem.incrementSafeBlockCount(numCurrentReplica);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:38,代码来源:BlockManager.java

示例8: commitBlock

/**
 * Commit block's length and generation stamp as reported by the client.
 * Set block state to {@link BlockUCState#COMMITTED}.
 * @param block - contains client reported block length and generation 
 * @throws IOException if block ids are inconsistent.
 */
void commitBlock(Block block) throws IOException {
  if(getBlockId() != block.getBlockId())
    throw new IOException("Trying to commit inconsistent block: id = "
        + block.getBlockId() + ", expected id = " + getBlockId());
  blockUCState = BlockUCState.COMMITTED;
  this.set(getBlockId(), block.getNumBytes(), block.getGenerationStamp());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:13,代码来源:BlockInfoUnderConstruction.java

示例9: addStoredBlockImmediate

/**
 * Faster version of
 * {@link #addStoredBlock(BlockInfo, DatanodeStorageInfo, DatanodeDescriptor, boolean)}
 * , intended for use with initial block report at startup. If not in startup
 * safe mode, will call standard addStoredBlock(). Assumes this method is
 * called "immediately" so there is no need to refresh the storedBlock from
 * blocksMap. Doesn't handle underReplication/overReplication, or worry about
 * pendingReplications or corruptReplicas, because it's in startup safe mode.
 * Doesn't log every block, because there are typically millions of them.
 * 
 * @throws IOException
 */
private void addStoredBlockImmediate(BlockInfo storedBlock,
    DatanodeStorageInfo storageInfo)
throws IOException {
  assert (storedBlock != null && namesystem.hasWriteLock());
  if (!namesystem.isInStartupSafeMode() 
      || namesystem.isPopulatingReplQueues()) {
    addStoredBlock(storedBlock, storageInfo, null, false);
    return;
  }

  // just add it
  storageInfo.addBlock(storedBlock);

  // Now check for completion of blocks and safe block count
  int numCurrentReplica = countLiveNodes(storedBlock);
  if (storedBlock.getBlockUCState() == BlockUCState.COMMITTED
      && numCurrentReplica >= minReplication) {
    completeBlock(storedBlock.getBlockCollection(), storedBlock, false);
  } else if (storedBlock.isComplete()) {
    // check whether safe replication is reached for the block
    // only complete blocks are counted towards that.
    // In the case that the block just became complete above, completeBlock()
    // handles the safe block count maintenance.
    namesystem.incrementSafeBlockCount(numCurrentReplica);
  }
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:38,代码来源:BlockManager.java

示例10: addStoredBlockImmediate

/**
 * Faster version of
 * {@link #addStoredBlock(BlockInfo, DatanodeDescriptor, DatanodeDescriptor,
 * boolean)}
 * , intended for use with initial block report at startup. If not in startup
 * safe mode, will call standard addStoredBlock(). Assumes this method is
 * called "immediately" so there is no need to refresh the storedBlock from
 * blocksMap. Doesn't handle underReplication/overReplication, or worry about
 * pendingReplications or corruptReplicas, because it's in startup safe mode.
 * Doesn't log every block, because there are typically millions of them.
 *
 * @throws IOException
 */
private void addStoredBlockImmediate(BlockInfo storedBlock,
    DatanodeDescriptor node) throws IOException {
  assert (storedBlock != null);
  if (!namesystem.isInStartupSafeMode() ||
      namesystem.isPopulatingReplQueues()) {
    addStoredBlock(storedBlock, node, null, false);
    return;
  }

  // just add it
  node.addBlock(storedBlock);

  // Now check for completion of blocks and safe block count
  int numCurrentReplica = countLiveNodes(storedBlock);
  if (storedBlock.getBlockUCState() == BlockUCState.COMMITTED &&
      numCurrentReplica >= minReplication) {
    completeBlock((MutableBlockCollection) storedBlock.getBlockCollection(),
        storedBlock, false);
  } else if (storedBlock.isComplete()) {
    // check whether safe replication is reached for the block
    // only complete blocks are counted towards that.
    // In the case that the block just became complete above, completeBlock()
    // handles the safe block count maintenance.
    namesystem.incrementSafeBlockCount(storedBlock);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:39,代码来源:BlockManager.java

示例11: tryToCompleteBlock

public BlockInfo tryToCompleteBlock(final MutableBlockCollection bc,
    final int blkIndex) throws IOException {

  if (blkIndex < 0) {
    return null;
  }
  BlockInfo curBlock = bc.getBlock(blkIndex);
  LOG.debug("tryToCompleteBlock. blkId = " + curBlock.getBlockId());
  if (curBlock.isComplete()) {
    return curBlock;
  }
  BlockInfoUnderConstruction ucBlock = (BlockInfoUnderConstruction) curBlock;
  int numNodes = ucBlock.numNodes(datanodeManager);
  if (numNodes < minReplication) {
    return null;
  }
  if (ucBlock.getBlockUCState() != BlockUCState.COMMITTED) {
    return null;
  }
  BlockInfo completeBlock = ucBlock.convertToCompleteBlock();
  // replace penultimate block in file
  bc.setBlock(blkIndex, completeBlock);

  // Since safe-mode only counts complete blocks, and we now have
  // one more complete block, we need to adjust the total up, and
  // also count it as safe, if we have at least the minimum replica
  // count. (We may not have the minimum replica count yet if this is
  // a "forced" completion when a file is getting closed by an
  // OP_CLOSE edit on the standby).
  namesystem.adjustSafeModeBlockTotals(0, 1);
  namesystem.incrementSafeBlockCount(curBlock);

  return completeBlock;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:34,代码来源:BlockManager.java

示例12: commitBlock

/**
 * Commit block's length and generation stamp as reported by the client. Set
 * block state to {@link BlockUCState#COMMITTED}.
 *
 * @param block
 *     - contains client reported block length and generation
 * @throws IOException
 *     if block ids are inconsistent.
 */
void commitBlock(Block block) throws IOException {
  if (getBlockId() != block.getBlockId()) {
    throw new IOException(
        "Trying to commit inconsistent block: id = " + block.getBlockId() +
            ", expected id = " + getBlockId());
  }
  blockUCState = BlockUCState.COMMITTED;
  this.set(getBlockId(), block.getNumBytes(), block.getGenerationStamp());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:18,代码来源:BlockInfoUnderConstruction.java

示例13: addStoredBlockImmediate

/**
 * Faster version of
 * {@link #addStoredBlock(BlockInfo, DatanodeDescriptor, String, DatanodeDescriptor, boolean)}
 * , intended for use with initial block report at startup. If not in startup
 * safe mode, will call standard addStoredBlock(). Assumes this method is
 * called "immediately" so there is no need to refresh the storedBlock from
 * blocksMap. Doesn't handle underReplication/overReplication, or worry about
 * pendingReplications or corruptReplicas, because it's in startup safe mode.
 * Doesn't log every block, because there are typically millions of them.
 * 
 * @throws IOException
 */
private void addStoredBlockImmediate(BlockInfo storedBlock,
    DatanodeDescriptor node, String storageID)
throws IOException {
  assert (storedBlock != null && namesystem.hasWriteLock());
  if (!namesystem.isInStartupSafeMode() 
      || namesystem.isPopulatingReplQueues()) {
    addStoredBlock(storedBlock, node, storageID, null, false);
    return;
  }

  // just add it
  node.addBlock(storageID, storedBlock);

  // Now check for completion of blocks and safe block count
  int numCurrentReplica = countLiveNodes(storedBlock);
  if (storedBlock.getBlockUCState() == BlockUCState.COMMITTED
      && numCurrentReplica >= minReplication) {
    completeBlock(storedBlock.getBlockCollection(), storedBlock, false);
  } else if (storedBlock.isComplete()) {
    // check whether safe replication is reached for the block
    // only complete blocks are counted towards that.
    // In the case that the block just became complete above, completeBlock()
    // handles the safe block count maintenance.
    namesystem.incrementSafeBlockCount(numCurrentReplica);
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:38,代码来源:BlockManager.java

示例14: commit

/**
 * Set {@link #blockUCState} to {@link BlockUCState#COMMITTED}.
 */
void commit() {
  blockUCState = BlockUCState.COMMITTED;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:6,代码来源:BlockUnderConstructionFeature.java


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