diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotFileCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotFileCache.java index 358b4ea..9e3076f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotFileCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotFileCache.java @@ -232,7 +232,8 @@ public class SnapshotFileCache implements Stoppable { Map known = new HashMap<>(); // 3. check each of the snapshot directories - FileStatus[] snapshots = FSUtils.listStatus(fs, snapshotDir); + FileStatus[] snapshots = fs.listStatus(snapshotDir, + new SnapshotDescriptionUtils.CompletedSnaphotDirectoriesFilter(fs)); if (snapshots == null) { // remove all the remembered snapshots because we don't have any left if (LOG.isDebugEnabled() && this.snapshots.size() > 0) { @@ -246,22 +247,20 @@ public class SnapshotFileCache implements Stoppable { for (FileStatus snapshot : snapshots) { String name = snapshot.getPath().getName(); // its not the tmp dir, - if (!name.equals(SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME)) { - SnapshotDirectoryInfo files = this.snapshots.remove(name); - // 3.1.1 if we don't know about the snapshot or its been modified, we need to update the - // files the latter could occur where I create a snapshot, then delete it, and then make a - // new snapshot with the same name. We will need to update the cache the information from - // that new snapshot, even though it has the same name as the files referenced have - // probably changed. - if (files == null || files.hasBeenModified(snapshot.getModificationTime())) { - // get all files for the snapshot and create a new info - Collection storedFiles = fileInspector.filesUnderSnapshot(snapshot.getPath()); - files = new SnapshotDirectoryInfo(snapshot.getModificationTime(), storedFiles); - } - // 3.2 add all the files to cache - this.cache.addAll(files.getFiles()); - known.put(name, files); + SnapshotDirectoryInfo files = this.snapshots.remove(name); + // 3.1.1 if we don't know about the snapshot or its been modified, we need to update the + // files the latter could occur where I create a snapshot, then delete it, and then make a + // new snapshot with the same name. We will need to update the cache the information from + // that new snapshot, even though it has the same name as the files referenced have + // probably changed. + if (files == null || files.hasBeenModified(snapshot.getModificationTime())) { + // get all files for the snapshot and create a new info + Collection storedFiles = fileInspector.filesUnderSnapshot(snapshot.getPath()); + files = new SnapshotDirectoryInfo(snapshot.getModificationTime(), storedFiles); } + // 3.2 add all the files to cache + this.cache.addAll(files.getFiles()); + known.put(name, files); } // 4. set the snapshots we are tracking