List of usage examples for org.apache.hadoop.hdfs DistributedFileSystem getSnapshottableDirListing
public SnapshottableDirectoryStatus[] getSnapshottableDirListing() throws IOException
From source file:org.apache.falcon.extensions.mirroring.hdfsSnapshot.HdfsSnapshotMirroringExtension.java
License:Apache License
private static boolean isDirSnapshotable(DistributedFileSystem hdfs, Path path) throws FalconException { try {// w w w . j a v a2 s. co m LOG.debug("HDFS Snapshot extension validating if dir {} is snapshotable.", path.toString()); SnapshottableDirectoryStatus[] snapshotableDirs = hdfs.getSnapshottableDirListing(); if (snapshotableDirs != null && snapshotableDirs.length > 0) { for (SnapshottableDirectoryStatus dir : snapshotableDirs) { if (dir.getFullPath().toString().equals(path.toString())) { return true; } } } return false; } catch (IOException e) { LOG.error("Unable to verify if dir {} is snapshot-able. {}", path.toString(), e.getMessage()); throw new FalconException("Unable to verify if dir " + path.toString() + " is snapshot-able", e); } }