huaxiangsun commented on a change in pull request #1791:
URL: https://github.com/apache/hbase/pull/1791#discussion_r431469964



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotFileCache.java
##########
@@ -251,6 +260,25 @@ private void refreshCache() throws IOException {
     this.snapshots.putAll(newSnapshots);
   }
 
+  @VisibleForTesting
+  List<String> getSnapshotsInProgress() throws IOException {
+    List<String> snapshotInProgress = Lists.newArrayList();
+    // only add those files to the cache, but not to the known snapshots
+    FileStatus[] snapshotsInProgress = CommonFSUtils.listStatus(fs,
+      new Path(snapshotDir, SnapshotDescriptionUtils.SNAPSHOT_TMP_DIR_NAME));
+
+    if (!ArrayUtils.isEmpty(snapshotsInProgress)) {
+      for (FileStatus snapshot : snapshotsInProgress) {
+        try {
+          
snapshotInProgress.addAll(fileInspector.filesUnderSnapshot(snapshot.getPath()));
+        } catch (CorruptedSnapshotException cse) {
+          LOG.debug("Corrupted in-progress snapshot file exception, ignored.", 
cse);

Review comment:
       It will be hard to put table name here. For an example, in the context 
of ExportSnapshot job, at the destination cluster, the .snapshotinfo is written 
to tmp directory first. There is no table existing yet, table may be cloned 
from snapshot after ExportSnapshot job is done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to