本文整理汇总了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()));
}
示例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;
}
示例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;
}