org.apache.hadoop.hdfs.server.datanode.DataNode.reportRemoteBadBlock()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.apache.hadoop.hdfs.server.datanode.DataNode.reportRemoteBadBlock()方法的一些代码示例,展示了DataNode.reportRemoteBadBlock()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataNode.reportRemoteBadBlock()方法的具体详情如下:
包路径:org.apache.hadoop.hdfs.server.datanode.DataNode
类名称:DataNode
方法名:reportRemoteBadBlock

DataNode.reportRemoteBadBlock介绍

[英]Report a bad block on another DN (eg if we received a corrupt replica from a remote host).
[中]报告另一个DN上的坏块(例如,如果我们从远程主机接收到损坏的副本)。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

public void reportCorruptedBlocks(
  DFSUtilClient.CorruptedBlocks corruptedBlocks) throws IOException {
 Map<ExtendedBlock, Set<DatanodeInfo>> corruptionMap =
   corruptedBlocks.getCorruptionMap();
 if (corruptionMap != null) {
  for (Map.Entry<ExtendedBlock, Set<DatanodeInfo>> entry :
    corruptionMap.entrySet()) {
   for (DatanodeInfo dnInfo : entry.getValue()) {
    reportRemoteBadBlock(dnInfo, entry.getKey());
   }
  }
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

LOG.info("report corrupt " + block + " from datanode " +
      srcDataNode + " to namenode");
 datanode.reportRemoteBadBlock(srcDataNode, block);
} catch (IOException e) {
 LOG.warn("Failed to report bad " + block +

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

/**
 * Verify multiple CRC chunks. 
 */
private void verifyChunks(ByteBuffer dataBuf, ByteBuffer checksumBuf)
  throws IOException {
 try {
  clientChecksum.verifyChunkedSums(dataBuf, checksumBuf, clientname, 0);
 } catch (ChecksumException ce) {
  LOG.warn("Checksum error in block " + block + " from " + inAddr, ce);
  // No need to report to namenode when client is writing.
  if (srcDataNode != null && isDatanode) {
   try {
    LOG.info("report corrupt " + block + " from datanode " +
         srcDataNode + " to namenode");
    datanode.reportRemoteBadBlock(srcDataNode, block);
   } catch (IOException e) {
    LOG.warn("Failed to report bad " + block + 
         " from datanode " + srcDataNode + " to namenode");
   }
  }
  throw new IOException("Unexpected checksum mismatch while writing "
    + block + " from " + inAddr);
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Verify multiple CRC chunks. 
 */
private void verifyChunks(ByteBuffer dataBuf, ByteBuffer checksumBuf)
  throws IOException {
 try {
  clientChecksum.verifyChunkedSums(dataBuf, checksumBuf, clientname, 0);
 } catch (ChecksumException ce) {
  LOG.warn("Checksum error in block " + block + " from " + inAddr, ce);
  // No need to report to namenode when client is writing.
  if (srcDataNode != null && isDatanode) {
   try {
    LOG.info("report corrupt " + block + " from datanode " +
         srcDataNode + " to namenode");
    datanode.reportRemoteBadBlock(srcDataNode, block);
   } catch (IOException e) {
    LOG.warn("Failed to report bad " + block + 
         " from datanode " + srcDataNode + " to namenode");
   }
  }
  throw new IOException("Unexpected checksum mismatch while writing "
    + block + " from " + inAddr);
 }
}

相关文章

DataNode类方法