Example #1
0
 /** DFS client read bytes starting from the specified position. */
 private void dfsClientReadFileFromPosition(Path corruptedFile)
     throws UnresolvedLinkException, IOException {
   DFSInputStream in = dfs.dfs.open(corruptedFile.toUri().getPath());
   byte[] buf = new byte[buffersize];
   int startPosition = 2;
   int nRead = 0; // total number of bytes read
   try {
     do {
       nRead = in.read(startPosition, buf, 0, buf.length);
       startPosition += buf.length;
     } while (nRead > 0);
   } catch (BlockMissingException bme) {
     LOG.debug("DfsClientReadFile caught BlockMissingException.");
   }
 }
Example #2
0
  /** Ask dfs client to read the file */
  private void dfsClientReadFile(Path corruptedFile) throws IOException, UnresolvedLinkException {
    DFSInputStream in = dfs.dfs.open(corruptedFile.toUri().getPath());
    byte[] buf = new byte[buffersize];
    int nRead = 0; // total number of bytes read

    try {
      do {
        nRead = in.read(buf, 0, buf.length);
      } while (nRead > 0);
    } catch (ChecksumException ce) {
      // caught ChecksumException if all replicas are bad, ignore and continue.
      LOG.debug("DfsClientReadFile caught ChecksumException.");
    } catch (BlockMissingException bme) {
      // caught BlockMissingException, ignore.
      LOG.debug("DfsClientReadFile caught BlockMissingException.");
    }
  }