Examples of Progressable


Examples of org.apache.hadoop.util.Progressable

  boolean processParityFile(Path parityPath, Decoder decoder,
      Context context)
  throws IOException, InterruptedException {
    LOG.info("Processing parity file " + parityPath);
   
    Progressable progress = context;
    if (progress == null) {
      progress = RaidUtils.NULL_PROGRESSABLE;
    }
   
    Path srcPath = sourcePathFromParityPath(parityPath);
    if (srcPath == null) {
      LOG.warn("Could not get regular file corresponding to parity file "
          parityPath + ", ignoring...");
      return false;
    }

    DistributedFileSystem parityFs = getDFS(parityPath);
    DistributedFileSystem srcFs = getDFS(srcPath);
    FileStatus parityStat = parityFs.getFileStatus(parityPath);
    long blockSize = parityStat.getBlockSize();
    FileStatus srcStat = srcFs.getFileStatus(srcPath);

    // Check timestamp.
    if (srcStat.getModificationTime() != parityStat.getModificationTime()) {
      LOG.warn("Mismatching timestamp for " + srcPath + " and " + parityPath +
          ", ignoring...");
      return false;
    }

    String uriPath = parityPath.toUri().getPath();
    int numBlocksReconstructed = 0;
    List<LocatedBlockWithMetaInfo> lostBlocks =
      lostBlocksInFile(parityFs, uriPath, parityStat);
    if (lostBlocks.size() == 0) {
      LOG.warn("Couldn't find any lost blocks in parity file " + parityPath +
          ", ignoring...");
      return false;
    }
    for (LocatedBlockWithMetaInfo lb: lostBlocks) {
      Block lostBlock = lb.getBlock();
      long lostBlockOffset = lb.getStartOffset();

      LOG.info("Found lost block " + lostBlock +
          ", offset " + lostBlockOffset);

      File localBlockFile =
        File.createTempFile(lostBlock.getBlockName(), ".tmp");
      localBlockFile.deleteOnExit();

      try {
        decoder.recoverParityBlockToFile(srcFs, srcPath, parityFs, parityPath,
            blockSize, lostBlockOffset, localBlockFile, context);
       
        // Now that we have recovered the parity file block locally, send it.
        String datanode = chooseDatanode(lb.getLocations());
        computeMetadataAndSendReconstructedBlock(
            datanode, localBlockFile,
            lostBlock, blockSize,
            lb.getDataProtocolVersion(), lb.getNamespaceID(),
            progress);

        numBlocksReconstructed++;
      } finally {
        localBlockFile.delete();
      }
      progress.progress();
    }
   
    LOG.info("Reconstructed " + numBlocksReconstructed + " blocks in " + parityPath);
    return true;
  }
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

  DecoderInputStream generateAlternateStream(FileSystem srcFs, Path srcFile,
                      FileSystem parityFs, Path parityFile,
                      long blockSize, long errorOffset, long limit,
                      Context context) {
    configureBuffers(blockSize);
    Progressable reporter = context;
    if (reporter == null) {
      reporter = RaidUtils.NULL_PROGRESSABLE;
    }
   
    DecoderInputStream decoderInputStream = new DecoderInputStream(
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

      boolean fixSource,
      long blockSize, long errorOffset, long limit, boolean partial,
      OutputStream out, Context context, boolean skipVerify)
          throws IOException, InterruptedException {
    configureBuffers(blockSize);
    Progressable reporter = context;
    if (reporter == null) {
      reporter = RaidUtils.NULL_PROGRESSABLE;
    }

    LOG.info("Code: " + this.codec.id + " simulation: " + this.codec.simulateBlockFix);
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

      int initialRefCount = ClientAdapter.getRefCount(client);
      String filename = "/file1";
      DFSOutputStream out = (DFSOutputStream)
        ((DistributedFileSystem) fileSystem).getClient().create(
          filename, FsPermission.getDefault(), true, (short) 5, 1024,
          new Progressable() {
            @Override
            public void progress() {
            }
          },
          64 * 1024
 
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

        // find the right codec
        Class<? extends CompressionCodec> codecClass = getOutputCompressorClass(job, DefaultCodec.class);
        codec = ReflectionUtils.newInstance(codecClass, InputFormatBase.getConfiguration(job));
      }

      Progressable progress = new Progressable() {
        @Override
        public void progress() {
          job.progress();
        }
      };
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

  throws IOException {
    Path dir =
      HTableDescriptor.getTableDir(rootDir, regionInfo.getTableDesc().getName());
    HRegion r = HRegion.newHRegion(dir, this.hlog, this.fs, conf, regionInfo,
      this.cacheFlusher);
    long seqid = r.initialize(new Progressable() {
      public void progress() {
        addProcessingMessage(regionInfo);
      }
    });
    // If a wal and its seqid is < that of new region, use new regions seqid.
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

 
  protected HRegion instantiateRegion(final HRegionInfo regionInfo)
      throws IOException {
    return new HRegion(HTableDescriptor.getTableDir(rootDir, regionInfo
        .getTableDesc().getName()), this.log, this.fs, conf, regionInfo, null,
        this.cacheFlusher, new Progressable() {
          public void progress() {
            addProcessingMessage(regionInfo);
          }
        });
  }
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

    short replication = -1;
    long blockSize = -1;
    int bytesPerChecksum = -1;
    ChecksumOpt checksumOpt = null;
    FsPermission permission = null;
    Progressable progress = null;
    Boolean createParent = null;
    for (CreateOpts iOpt : opts) {
      if (CreateOpts.BlockSize.class.isInstance(iOpt)) {
        if (blockSize != -1) {
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

        short replication = replicationOption == null ?
          fs.getDefaultReplication(p) :
          (short) replicationOption.getValue();
        long blockSize = blockSizeOption == null ? fs.getDefaultBlockSize(p) :
          blockSizeOption.getValue();
        Progressable progress = progressOption == null ? null :
          progressOption.getValue();
        out = fs.create(p, true, bufferSize, replication, blockSize, progress);
      } else {
        out = streamOption.getValue();
      }
View Full Code Here

Examples of org.apache.hadoop.util.Progressable

        readsCounter, writesCounter, mergePhase);
    Assert.assertEquals(1.0f, mergeQueue.getProgress().get(), 0.0f);
  }

  private Progressable getReporter() {
    Progressable reporter = new Progressable() {
      @Override
      public void progress() {
      }
    };
    return reporter;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.