Example usage for org.apache.hadoop.fs FileSystem createSnapshot

List of usage examples for org.apache.hadoop.fs FileSystem createSnapshot

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FileSystem createSnapshot.

Prototype

public Path createSnapshot(Path path, String snapshotName) throws IOException 

Source Link

Document

Create a snapshot.

Usage

From source file:org.apache.falcon.snapshots.replication.HdfsSnapshotReplicator.java

License:Apache License

private static void createSnapshotInFileSystem(String dirName, String snapshotName, FileSystem fs)
        throws FalconException {
    try {// w  ww  .  ja v a 2s.com
        LOG.info("Creating snapshot {} in directory {}", snapshotName, dirName);
        fs.createSnapshot(new Path(dirName), snapshotName);
    } catch (IOException e) {
        LOG.warn("Unable to create snapshot {} in filesystem {}. Exception is {}", snapshotName,
                fs.getConf().get(HadoopClientFactory.FS_DEFAULT_NAME_KEY), e.getMessage());
        throw new FalconException("Unable to create snapshot " + snapshotName, e);
    }
}