Package org.apache.hadoop.hdfs.server.datanode.BlockInlineChecksumReader

Examples of org.apache.hadoop.hdfs.server.datanode.BlockInlineChecksumReader.GenStampAndChecksum


      long sizeFromDisk;

      if (!isInlineChecksum()) {
        sizeFromDisk = getDataFile().length();
      } else {
        GenStampAndChecksum sac = BlockInlineChecksumReader
            .getGenStampAndChecksumFromInlineChecksumFile(getDataFile()
                .getName());
        sizeFromDisk = BlockInlineChecksumReader.getBlockSizeFromFileLength(
            getDataFile().length(), sac.checksumType, sac.bytesPerChecksum);
      }
View Full Code Here


          boolean isInlineChecksum = Block.isInlineChecksumBlockFilename(f
              .getName());
          int checksumType = DataChecksum.CHECKSUM_UNKNOWN;
          int bytesPerChecksum = -1;
          if (isInlineChecksum) {
            GenStampAndChecksum sac = BlockInlineChecksumReader
                .getGenStampAndChecksumFromInlineChecksumFile(f.getName());
            checksumType = sac.checksumType;
            bytesPerChecksum = sac.bytesPerChecksum;
          }
          DatanodeBlockInfo binfo = new DatanodeBlockInfo(volume, f,
View Full Code Here

                      DataChecksum.CHECKSUM_UNKNOWN, -1, false, 0));
            }
          } else if (Block.isInlineChecksumBlockFilename(fileName)) {
            numBlocks++;
            if (volume != null) {
              GenStampAndChecksum sac = BlockInlineChecksumReader
                      .getGenStampAndChecksumFromInlineChecksumFile(fileName);
              long blkSize = BlockInlineChecksumReader
                  .getBlockSizeFromFileLength(file.length(), sac.checksumType,
                      sac.bytesPerChecksum);
              volumeMap.add(namespaceId, new Block(file, blkSize,
View Full Code Here

              blockFilesNames[index]);
      return new Block(blockFiles[index], blockFiles[index].length(),
          genStamp);
    } else if (Block.isInlineChecksumBlockFilename(blockFilesNames[index])) {
      // TODO: We might want to optimize it.
      GenStampAndChecksum sac = BlockInlineChecksumReader
          .getGenStampAndChecksumFromInlineChecksumFile(blockFilesNames[index]);
      long blockLengh = BlockInlineChecksumReader.getBlockSizeFromFileLength(
          blockFiles[index].length(), sac.checksumType, sac.bytesPerChecksum);

      return new Block(blockFiles[index], blockLengh, sac.generationStamp);
View Full Code Here

      }

      int checksumType = DataChecksum.CHECKSUM_UNKNOWN;
      int bytesPerChecksum = -1;
      if (inlineChecksum) {
        GenStampAndChecksum sac = BlockInlineChecksumReader
            .getGenStampAndChecksumFromInlineChecksumFile(srcBlockFile
                .getName());
        checksumType = sac.checksumType;
        bytesPerChecksum = sac.bytesPerChecksum;
      }
View Full Code Here

          Block newBlock = new Block(blockId, info.getLength(),
              info.getGenStamp());
          boolean isInlineChecksum = info.isInlineChecksum();
          DatanodeBlockInfo diskBlockInfo = null;
          if (isInlineChecksum) {
            GenStampAndChecksum sac = BlockInlineChecksumReader
                .getGenStampAndChecksumFromInlineChecksumFile(info
                    .getBlockFile().getName());
            diskBlockInfo = new DatanodeBlockInfo(info.getVolume(),
                info.getBlockFile(), info.getLength(), true, true,
                sac.checksumType, sac.bytesPerChecksum, false, 0);
View Full Code Here

    assertFalse(Block.isInlineChecksumBlockFilename(bname));
    assertFalse(Block.isInlineChecksumBlockFilename(cname));
    assertTrue(Block.isInlineChecksumBlockFilename(iname));

    // parse filename
    GenStampAndChecksum sac = BlockInlineChecksumReader
        .getGenStampAndChecksumFromInlineChecksumFile(iname);
    assertEquals(2000, sac.generationStamp);
    assertEquals(512, sac.bytesPerChecksum);
    assertEquals(1, sac.checksumType);
View Full Code Here

                  " length " + length);
      }
     
      DataChecksum checksum = null;
      if (isInlineChecksum) {
        GenStampAndChecksum gac = BlockInlineChecksumReader
            .getGenStampAndChecksumFromInlineChecksumFile(new Path(pathinfo
                .getBlockPath()).getName());
        checksum = DataChecksum.newDataChecksum(gac.getChecksumType(),
            gac.getBytesPerChecksum());
       
        if (verifyChecksum) {

          return new BlockReaderLocalInlineChecksum(conf, file, blk,
              startOffset, length, pathinfo, metrics, checksum, verifyChecksum,
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.datanode.BlockInlineChecksumReader.GenStampAndChecksum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.