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



##########
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 is hard to say. The CorruptedSnapshotException will only be thrown 
out when it reads a corrupted .snapshotinfo file. There are two cases, one is 
normal, which .snapshotinfo is being written and it reads incomplete one; the 
other is that it is a real corrupted .snapshotinfo. The original code assumes 
the first case (maybe in reality, there are more first cases than the second 
one). Change it to info level? The exception has the following info
   ```
   throw new CorruptedSnapshotException("Couldn't read snapshot info from:" + 
snapshotInfo, e);
   ```
   It is the path of .snapshotinfo, it has snapshot name embedded in the path 
(does not have table name). Let me see if table name can be added.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to