當前位置: 首頁>>代碼示例>>Java>>正文


Java FileSystem.deleteSnapshot方法代碼示例

本文整理匯總了Java中org.apache.hadoop.fs.FileSystem.deleteSnapshot方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSystem.deleteSnapshot方法的具體用法?Java FileSystem.deleteSnapshot怎麽用?Java FileSystem.deleteSnapshot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.fs.FileSystem的用法示例。


在下文中一共展示了FileSystem.deleteSnapshot方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deleteSnapshot

import org.apache.hadoop.fs.FileSystem; //導入方法依賴的package包/類
/**
 * 此方法用於刪除文件快照
 *
 * @param fileSystemInfo
 *            文件係統信息
 * @param path
 *            文件路徑
 * @param snapshotName
 *            快照名稱
 */
public static void deleteSnapshot(FileSystemInfo fileSystemInfo, String path, String snapshotName) {
	FileSystem fs = getFileSystem(fileSystemInfo);
	Path uri = new Path(path);
	try {
		pathNotExistCheck(path, fs, uri);
		pathNotDirectoryCheck(path, fs, uri);
		fs.deleteSnapshot(uri, snapshotName);
	} catch (IOException e) {
		e.printStackTrace();
	} finally {
		closeFileSystem(fs);
	}
}
 
開發者ID:zhangjunfang,項目名稱:alluxio,代碼行數:24,代碼來源:HdfsAndAlluxioUtils_update.java

示例2: cleanUpLocations

import org.apache.hadoop.fs.FileSystem; //導入方法依賴的package包/類
@Override
public void cleanUpLocations() {
  if (snapshotPath != null) {
    try {
      LOG.debug("Deleting source data snapshot: {}, {}", sourceDataPath, eventId);
      FileSystem sourceFileSystem = fileSystemFactory.get(sourceDataPath, sourceHiveConf);
      sourceFileSystem.deleteSnapshot(sourceDataPath, eventId);
    } catch (IOException e) {
      LOG.error("Unable to delete source data snapshot: {}, {}", sourceDataPath, eventId, e);
    }
  }
}
 
開發者ID:HotelsDotCom,項目名稱:circus-train,代碼行數:13,代碼來源:HdfsSnapshotLocationManager.java

示例3: testWebHdfsDeleteSnapshot

import org.apache.hadoop.fs.FileSystem; //導入方法依賴的package包/類
/**
 * Test snapshot deletion through WebHdfs
 */
@Test
public void testWebHdfsDeleteSnapshot() throws Exception {
  MiniDFSCluster cluster = null;
  final Configuration conf = WebHdfsTestUtil.createConf();
  try {
    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();
    cluster.waitActive();
    final DistributedFileSystem dfs = cluster.getFileSystem();
    final FileSystem webHdfs = WebHdfsTestUtil.getWebHdfsFileSystem(conf,
        WebHdfsFileSystem.SCHEME);

    final Path foo = new Path("/foo");
    dfs.mkdirs(foo);
    dfs.allowSnapshot(foo);

    webHdfs.createSnapshot(foo, "s1");
    final Path spath = webHdfs.createSnapshot(foo, null);
    Assert.assertTrue(webHdfs.exists(spath));
    final Path s1path = SnapshotTestHelper.getSnapshotRoot(foo, "s1");
    Assert.assertTrue(webHdfs.exists(s1path));

    // delete the two snapshots
    webHdfs.deleteSnapshot(foo, "s1");
    Assert.assertFalse(webHdfs.exists(s1path));
    webHdfs.deleteSnapshot(foo, spath.getName());
    Assert.assertFalse(webHdfs.exists(spath));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:36,代碼來源:TestWebHDFS.java

示例4: testWebHdfsRenameSnapshot

import org.apache.hadoop.fs.FileSystem; //導入方法依賴的package包/類
/**
 * Test snapshot rename through WebHdfs
 */
@Test
public void testWebHdfsRenameSnapshot() throws Exception {
  MiniDFSCluster cluster = null;
  final Configuration conf = WebHdfsTestUtil.createConf();
  try {
    cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();
    cluster.waitActive();
    final DistributedFileSystem dfs = cluster.getFileSystem();
    final FileSystem webHdfs = WebHdfsTestUtil.getWebHdfsFileSystem(conf,
        WebHdfsFileSystem.SCHEME);

    final Path foo = new Path("/foo");
    dfs.mkdirs(foo);
    dfs.allowSnapshot(foo);

    webHdfs.createSnapshot(foo, "s1");
    final Path s1path = SnapshotTestHelper.getSnapshotRoot(foo, "s1");
    Assert.assertTrue(webHdfs.exists(s1path));

    // rename s1 to s2
    webHdfs.renameSnapshot(foo, "s1", "s2");
    Assert.assertFalse(webHdfs.exists(s1path));
    final Path s2path = SnapshotTestHelper.getSnapshotRoot(foo, "s2");
    Assert.assertTrue(webHdfs.exists(s2path));

    webHdfs.deleteSnapshot(foo, "s2");
    Assert.assertFalse(webHdfs.exists(s2path));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:37,代碼來源:TestWebHDFS.java


注:本文中的org.apache.hadoop.fs.FileSystem.deleteSnapshot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。