Apache9 commented on a change in pull request #209: HBASE-21070 Fix 
SnapshotFileCache for HBase backed by S3
URL: https://github.com/apache/hbase/pull/209#discussion_r280065452
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotFileCache.java
 ##########
 @@ -214,49 +214,55 @@ public void triggerCacheRefreshForTesting() {
 
   private synchronized void refreshCache() throws IOException {
     // get the status of the snapshots directory and check if it is has changes
-    FileStatus dirStatus;
-    try {
-      dirStatus = fs.getFileStatus(snapshotDir);
-    } catch (FileNotFoundException e) {
-      if (this.cache.size() > 0) {
-        LOG.error("Snapshot directory: " + snapshotDir + " doesn't exist");
+    // We need to check the internal folder as Object Stores do not always 
update
+    // the parent directory's modification time.
+    FileStatus[] snapshotsOnDisk = FSUtils.listStatus(fs, snapshotDir);
+    if (snapshotsOnDisk == null) {
+      // remove all the remembered snapshots because we don't have any left
+      if (LOG.isDebugEnabled() && this.snapshots.size() > 0) {
+        LOG.debug("No snapshots on-disk under: {}, cache empty", snapshotDir);
       }
+      this.snapshots.clear();
+      this.cache.clear();
       return;
     }
 
+    int containsTmpDir = 0;
+    long subDirLastModifiedTime = Long.MIN_VALUE;
 
 Review comment:
   OK, good, this is also what I plan to do for HBASE-22190...

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to