Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.ChecksumException


      checksum.reset();
      int dLen = Math.min(dLeft, chunkSize);
      checksum.update(buf, dOff, dLen);
      if (!checksum.compare(buf, cOff)) {
        long failedPos = offset + datalen - dLeft;
        throw new ChecksumException("Checksum failed at " + failedPos,
            failedPos);
      }
      dLeft -= dLen;
      dOff += dLen;
      cOff += checksumSize;
View Full Code Here


         
          if (verifyChecksum) {
            checksum.reset();
            checksum.update(buf, 0, len);
            if (!checksum.compare(buf, len)) {
              throw new ChecksumException("Checksum failed at " + offset, len);
            }
          }
        } catch (IOException e) {
          LOG.warn(" Could not read or failed to veirfy checksum for data" +
                   " at offset " + offset + " for block " + block + " got : "
View Full Code Here

                    // If message has partition key, need to construct it with Key for checkSum to match
                    Message messageWithKey = new Message(bytes,keyBytes);
                    Message messageWithoutKey = new Message(bytes);
                    long checksum = key.getChecksum();
                    if (checksum != messageWithKey.checksum() && checksum != messageWithoutKey.checksum()) {
                      throw new ChecksumException("Invalid message checksum : MessageWithKey : "
                              + messageWithKey.checksum() + " MessageWithoutKey checksum : "
                          + messageWithoutKey.checksum()
                          + ". Expected " + key.getChecksum()
                          key.getOffset());
                    }
View Full Code Here

  throws IOException {
    if (supportChecksum) {
      int expectedChecksum = rawStream.readInt()// read in checksum
      int calculatedChecksum = (int)checksum.getValue();
      if (expectedChecksum != calculatedChecksum) {
        throw new ChecksumException(
            "Transaction " + tid + " is corrupt.", tid);
      }
    }
  }
View Full Code Here

    while ((read = inputStream.read(buf)) > -1) {
      LOG.info(String.format("read %d bytes", read));

      if (!validateSequentialBytes(buf, (int) (startPos + numRead), read)) {
        LOG.error(String.format("invalid bytes: [%s]\n", Arrays.toString(buf)));
        throw new ChecksumException(
          String.format("unable to validate bytes"),
          startPos
        );
      }
View Full Code Here

      if (crc != null) {
        crc.reset();
        CheckedInputStream chk = new CheckedInputStream(in, crc);
        IOUtils.readFully(chk, buf.array(), 0, size);
        if (chk.getChecksum().getValue() != in.readLong()) {
          throw new ChecksumException("Checksum error reading spill index: " +
                                indexFileName, -1);
        }
      } else {
        IOUtils.readFully(in, buf.array(), 0, size);
      }
View Full Code Here

        simulatedFailure++;
        if (event == InjectionEvent.INGEST_READ_OP
            && synchronizationPoint == event && !disabled) {
          if((simulatedFailure % 3) == 1){
            LOG.info("Throwing checksum exception");  
            throw new ChecksumException("Testing checksum exception...", 0);
          }  
          if ((simulatedFailure % 5) == 1) {
            LOG.info("Throwing unchecked exception");
            throw new ArrayIndexOutOfBoundsException(
                "Testing uncecked exception...");
View Full Code Here

        throws IOException {
      if (event == InjectionEvent.SERVERLOGREADER_READOP && failures) {
        simulatedFailure++;
        if ((simulatedFailure % 3) == 1) {
          LOG.info("Throwing checksum exception");
          throw new ChecksumException("Testing checksum exception...", 0);
        }
        if ((simulatedFailure % 7) == 1) {
          LOG.info("Throwing unchecked exception");
          throw new ArrayIndexOutOfBoundsException(
              "Testing uncecked exception...");
View Full Code Here

          (sum[1] << 16 & 0xff0000) |
          (sum[2] << 8 & 0xff00) |
          sum[3] & 0xff;
        if (calculated != stored) {
          long errPos = basePos + data.position() - startDataPos - n;
          throw new ChecksumException(
              "Checksum error: "+ fileName + " at "+ errPos +
              " exp: " + stored + " got: " + calculated, errPos);
        }
      }
    } finally {
View Full Code Here

        (checksums[checksumsOff + 2] << 8 & 0xff00) |
        checksums[checksumsOff + 3] & 0xff;
      checksumsOff += 4;
      if (calculated != stored) {
        long errPos = basePos + dataPos - n;
        throw new ChecksumException(
            "Checksum error: "+ fileName + " at "+ errPos +
            " exp: " + stored + " got: " + calculated, errPos);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.ChecksumException

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.