public DistributedFileSystem getDistributedFileSystem() { return nnc.getDistributedFileSystem(); }
@Override public int getNumLiveDataNodes() { try { return nnc.getDistributedFileSystem() .getDataNodeStats(DatanodeReportType.LIVE).length; } catch (IOException e) { LOG.warn("Exception while getting number of live datanodes.", e); } return 0; }
@Override public boolean isInSafeMode() { try { return nnc != null ? nnc.getDistributedFileSystem().isInSafeMode() : false; } catch (IOException e) { LOG.warn("Exception while creating Namenode Connector..", e); return false; } }
@Override public void removeSPSHint(long inodeId) throws IOException { Path filePath = DFSUtilClient.makePathFromFileId(inodeId); try { nnc.getDistributedFileSystem().removeXAttr(filePath, HdfsServerConstants.XATTR_SATISFY_STORAGE_POLICY); } catch (IOException e) { List<String> listXAttrs = nnc.getDistributedFileSystem() .listXAttrs(filePath); if (!listXAttrs .contains(HdfsServerConstants.XATTR_SATISFY_STORAGE_POLICY)) { LOG.info("SPS hint already removed for the inodeId:{}." + " Ignoring exception:{}", inodeId, e.getMessage()); } } }
@Override public boolean isFileExist(long path) { Path filePath = DFSUtilClient.makePathFromFileId(path); try { return nnc.getDistributedFileSystem().exists(filePath); } catch (IllegalArgumentException | IOException e) { LOG.warn("Exception while getting file is for the given path:{}", filePath, e); } return false; }
@Override public HdfsFileStatus getFileInfo(long path) throws IOException { HdfsLocatedFileStatus fileInfo = null; try { Path filePath = DFSUtilClient.makePathFromFileId(path); fileInfo = nnc.getDistributedFileSystem().getClient() .getLocatedFileInfo(filePath.toString(), false); } catch (FileNotFoundException e) { LOG.debug("Path:{} doesn't exists!", path, e); } return fileInfo; }
public DistributedFileSystem getDistributedFileSystem() { return nnc.getDistributedFileSystem(); }
public DistributedFileSystem getDistributedFileSystem() { return nnc.getDistributedFileSystem(); }