shrinidhi-arista commented on code in PR #8233:
URL: https://github.com/apache/hbase/pull/8233#discussion_r3372882956


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/HFileLinkCleaner.java:
##########
@@ -79,7 +79,17 @@ public boolean isFileDeletable(FileStatus fStat) {
           }
           hfilePath =
             
HFileLink.getHFileFromBackReference(CommonFSUtils.getRootDir(getConf()), 
filePath);
-          return !fs.exists(hfilePath);
+          if (fs.exists(hfilePath)) {
+            return false;
+          }
+          // Also protect HFileLink Reference files created by
+          // RestoreSnapshotHelper.restoreReferenceFile(). These are named
+          // <hfileLinkName>.<encodedRegion> and live in the same directory as 
the
+          // zero-byte HFileLink. The zero-byte file does not exist (only the 
Reference

Review Comment:
   Updated the comment to make it more clear. What I mean is that when 
RestoreSnapshotHelper.restoreReferenceFile() clones a snapshot that contains a 
merged region, instead of creating zero-byte Hfile link of the form 
<table>=<region>-<hfile> , it creates a reference of the form 
<table>=<region>-<hfile>.<encodedRegion> (that that points through an HfileLink 
) in the same directory. fs.exists() only checks for the zero-byte HfileLink 
and not the reference and hence that check is not sufficient to protect the 
references.



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to