org.apache.hadoop.fs.FSError Java Examples

The following examples show how to use org.apache.hadoop.fs.FSError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HadoopFileSystem.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
/**
 * Canonicalizes a path if supported by the filesystem
 *
 * @param fs   the filesystem to use
 * @param path the path to canonicalize
 * @return the canonicalized path, or the same path if not supported by the filesystem.
 * @throws IOException
 */
public static Path canonicalizePath(org.apache.hadoop.fs.FileSystem fs, Path path) throws IOException {
  try {
    if (fs instanceof PathCanonicalizer) {
      final org.apache.hadoop.fs.Path hadoopPath = toHadoopPath(path);
      final org.apache.hadoop.fs.Path result = ((PathCanonicalizer) fs).canonicalizePath(hadoopPath);
      if (hadoopPath == result) {
        return path;
      }
      return fromHadoopPath(result);
    }
    return path;
  } catch (FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #2
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void createSymlink(Path target, Path link, boolean createParent) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, UnsupportedFileSystemException, IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    underlyingFs.createSymlink(target, link, createParent);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #3
Source File: FSDataOutputStreamWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public long getPos() {
  try {
    return underlyingOS.getPos();
  } catch(FSError e) {
    throw propagateFSRuntimeException(e);
  }
}
 
Example #4
Source File: FSDataInputStreamWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void close() throws IOException {
  if (underlyingIs != null) {
    try {
      underlyingIs.close();
      underlyingIs = null;
    } catch(FSError e) {
      throw HadoopFileSystemWrapper.propagateFSError(e);
    }
  }
}
 
Example #5
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void moveFromLocalFile(Path src, Path dst) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    underlyingFs.moveFromLocalFile(src, dst);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #6
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
@LimitedPrivate({"HDFS", "MapReduce"})
public Token<?>[] addDelegationTokens(String renewer, Credentials credentials) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.addDelegationTokens(renewer, credentials);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #7
Source File: DremioHadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<FileBlockLocation> getFileBlockLocations(FileAttributes file, long start, long len) throws IOException {
  if (!(file instanceof HadoopFileStatusWrapper)) {
    throw new ProviderMismatchException();
  }
  final FileStatus status = ((HadoopFileStatusWrapper) file).getFileStatus();
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return toFileBlockLocations(() -> underlyingFs.getFileBlockLocations(status, start, len));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #8
Source File: FSDataInputStreamWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void readFully(long position, byte[] buffer) throws IOException {
  try {
    is.readFully(position, buffer);
  } catch(FSError e) {
    throw HadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example #9
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataOutputStreamWrapper(underlyingFs.append(f, bufferSize, progress));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #10
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void access(final Path path, final FsAction mode) throws AccessControlException, FileNotFoundException, IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    underlyingFs.access(path, mode);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #11
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
@Deprecated
public long getLength(Path f) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.getLength(f);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #12
Source File: DremioHadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void setPermission(Path p, Set<PosixFilePermission> permissions) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    underlyingFs.setPermission(toHadoopPath(p), toFsPermission(permissions));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #13
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FileChecksum getFileChecksum(Path f) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.getFileChecksum(f);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #14
Source File: FSDataInputStreamWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void setReadahead(Long readahead) throws IOException, UnsupportedOperationException {
  try {
    underlyingIs.setReadahead(readahead);
  } catch(FSError e) {
    throw HadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example #15
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FileStatus getFileLinkStatus(Path f) throws AccessControlException, FileNotFoundException,
    UnsupportedFileSystemException, IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.getFileLinkStatus(f);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #16
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FsStatus getStatus(Path p) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.getStatus(p);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #17
Source File: FSDataInputStreamWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public int read(byte[] b, int off, int len) throws IOException {
  try {
    return underlyingIs.read(b, off, len);
  } catch(FSError e) {
    throw DremioHadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example #18
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataOutputStreamWrapper(underlyingFs.create(f, overwrite, bufferSize, replication, blockSize, progress));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #19
Source File: FSDataInputStreamWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void reset() throws IOException {
  try {
    is.reset();
  } catch(FSError e) {
    throw HadoopFileSystemWrapper.propagateFSError(e);
  }
}
 
Example #20
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, Progressable progress) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataOutputStreamWrapper(underlyingFs.create(f, overwrite, bufferSize, progress));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #21
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isDirectory(Path f) throws IOException {
  boolean exists = false;
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    exists = underlyingFs.isDirectory(f);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
  return exists;
}
 
Example #22
Source File: FSDataOutputStreamWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void write(byte[] b, int off, int len) throws IOException {
  try {
    underlyingOS.write(b, off, len);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #23
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FSDataOutputStream create(Path f, short replication) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataOutputStreamWrapper(underlyingFs.create(f, replication));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #24
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FSDataOutputStream create(Path f, Progressable progress) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataOutputStreamWrapper(underlyingFs.create(f, progress));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #25
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void copyToLocalFile(boolean delSrc, Path src, Path dst) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    underlyingFs.copyToLocalFile(delSrc, src, dst);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #26
Source File: DremioHadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
/**
 * If OperatorStats are provided return a instrumented {@link FSDataInputStream}.
 */
@Override
public FSInputStream open(Path f) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataInputStreamWrapper(f, openFile(f));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #27
Source File: FSDataOutputStreamWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void hsync() throws IOException {
  try {
    underlyingOS.hsync();
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #28
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public BlockLocation[] getFileBlockLocations(Path p, long start, long len) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return underlyingFs.getFileBlockLocations(p, start, len);
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #29
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
/**
 * If OperatorStats are provided return a instrumented {@link org.apache.hadoop.fs.FSDataInputStream}.
 */
@Override
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataInputStreamWrapper(f, underlyingFs.open(f, bufferSize));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}
 
Example #30
Source File: HadoopFileSystemWrapper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
@Deprecated
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission, boolean overwrite, int bufferSize,
    short replication, long blockSize, Progressable progress) throws IOException {
  try (WaitRecorder recorder = OperatorStats.getWaitRecorder(operatorStats)) {
    return newFSDataOutputStreamWrapper(underlyingFs.createNonRecursive(f, permission, overwrite, bufferSize, replication,
        blockSize, progress));
  } catch(FSError e) {
    throw propagateFSError(e);
  }
}