Package org.apache.hadoop.raid.StripeReader

Examples of org.apache.hadoop.raid.StripeReader.StripeInputInfo


    try {
      // Loop over stripe
      boolean redo;
      while (sReader.hasNext()) {
        reporter.progress();
        StripeInputInfo stripeInputInfo = null;
        InputStream[] blocks = null;
        // Create input streams for blocks in the stripe.
        long currentStripeIdx = sReader.getCurrentStripeIdx();
        stripeInputInfo = sReader.getNextStripeInputs();
        // The offset of first temporary output stream
        long encodeStartOffset = out.getPos();
        int retry = 3;
        do {
          redo = false;
          retry --;
          try {
            blocks = stripeInputInfo.getInputs();
            CRC32[] curCRCOuts = new CRC32[codec.parityLength];
           
            if (crcOuts != null) {
              for (int i = 0; i < codec.parityLength; i++) {
                crcOuts[finishedParityBlockIdx + i] = curCRCOuts[i]
                    = new CRC32();
              }
            }
            // Create output streams to the temp files.
            for (int i = 0; i < codec.parityLength - 1; i++) {
              tmpOuts[i + 1] = new FileOutputStream(tmpFiles[i]);
            }
            // Call the implementation of encoding.
            encodeStripe(blocks, blockSize, tmpOuts, curCRCOuts, reporter,
                true, errorLocations);
          } catch (IOException e) {
            if (out.getPos() > encodeStartOffset) {
              // Partial data is already written, throw the exception
              InjectionHandler.processEventIO(
                  InjectionEvent.RAID_ENCODING_PARTIAL_STRIPE_ENCODED);
              throw e;
            }
            // try to fix the missing block in the stripe using stripe store.
            if ((e instanceof BlockMissingException ||
                e instanceof ChecksumException) && codec.isDirRaid) {
              if (retry <= 0) {
                throw e;
              }
              redo = true;
              CorruptBlockReconstructor constructor =
                  new CorruptBlockReconstructor(conf);
             
              Set<Path> srcPaths = new HashSet<Path>();
              for (int idx : errorLocations) {
                Path srcPath = stripeInputInfo.getSrcPaths()[idx];
                if (srcPath != null) {
                  srcPaths.add(srcPath);
                }
              }
            
View Full Code Here

TOP

Related Classes of org.apache.hadoop.raid.StripeReader.StripeInputInfo

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.