当前位置: 首页>>代码示例>>Java>>正文


Java SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME属性代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME属性的典型用法代码示例。如果您正苦于以下问题:Java SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME属性的具体用法?Java SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME怎么用?Java SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils的用法示例。


在下文中一共展示了SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSnapshotTempDirReload

@Test
public void testSnapshotTempDirReload() throws IOException {
  long period = Long.MAX_VALUE;
  // This doesn't refresh cache until we invoke it explicitly
  Path snapshotDir = new Path(SnapshotDescriptionUtils.getSnapshotsDir(rootDir),
      SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME);
  SnapshotFileCache cache = new SnapshotFileCache(fs, rootDir, period, 10000000,
      "test-snapshot-file-cache-refresh", new SnapshotFiles());

  // Add a new snapshot
  Path snapshot1 = new Path(snapshotDir, "snapshot1");
  Path file1 = new Path(new Path(new Path(snapshot1, "7e91021"), "fam"), "file1");
  fs.createNewFile(file1);
  assertTrue(cache.contains(file1.getName()));

  // Add another snapshot
  Path snapshot2 = new Path(snapshotDir, "snapshot2");
  Path file2 = new Path(new Path(new Path(snapshot2, "7e91021"), "fam2"), "file2");
  fs.createNewFile(file2);
  assertTrue(cache.contains(file2.getName()));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:TestSnapshotFileCache.java

示例2: getSnapshotsInProgress

@VisibleForTesting List<String> getSnapshotsInProgress() throws IOException {
  List<String> snapshotInProgress = Lists.newArrayList();
  // only add those files to the cache, but not to the known snapshots
  Path snapshotTmpDir = new Path(snapshotDir, SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME);
  // only add those files to the cache, but not to the known snapshots
  FileStatus[] running = FSUtils.listStatus(fs, snapshotTmpDir);
  if (running != null) {
    for (FileStatus run : running) {
      snapshotInProgress.addAll(fileInspector.filesUnderSnapshot(run.getPath()));
    }
  }
  return snapshotInProgress;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:SnapshotFileCache.java

示例3: getSnapshotsInProgress

@VisibleForTesting List<String> getSnapshotsInProgress(
  final SnapshotManager snapshotManager) throws IOException {
  List<String> snapshotInProgress = Lists.newArrayList();
  // only add those files to the cache, but not to the known snapshots
  Path snapshotTmpDir = new Path(snapshotDir, SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME);
  // only add those files to the cache, but not to the known snapshots
  FileStatus[] running = FSUtils.listStatus(fs, snapshotTmpDir);
  if (running != null) {
    for (FileStatus run : running) {
      ReentrantLock lock = null;
      if (snapshotManager != null) {
        lock = snapshotManager.getLocks().acquireLock(run.getPath().getName());
      }
      try {
        snapshotInProgress.addAll(fileInspector.filesUnderSnapshot(run.getPath()));
      } catch (CorruptedSnapshotException e) {
        // See HBASE-16464
        if (e.getCause() instanceof FileNotFoundException) {
          // If the snapshot is corrupt, we will delete it
          fs.delete(run.getPath(), true);
          LOG.warn("delete the " + run.getPath() + " due to exception:", e.getCause());
        } else {
          throw e;
        }
      } finally {
        if (lock != null) {
          lock.unlock();
        }
      }
    }
  }
  return snapshotInProgress;
}
 
开发者ID:apache,项目名称:hbase,代码行数:33,代码来源:SnapshotFileCache.java


注:本文中的org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。