Apache9 commented on code in PR #6552:
URL: https://github.com/apache/hbase/pull/6552#discussion_r1894927449


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/StoreFileListFile.java:
##########
@@ -86,6 +86,8 @@ class StoreFileListFile {
 
   static final Pattern TRACK_FILE_PATTERN = Pattern.compile("^f(1|2)\\.\\d+$");

Review Comment:
   What about changing this regex to make \\d+ optional? Like 
`^f(1|2)\\(.\\d+)*$`? And then we use the Matcher's group method to extract the 
timestamp, if it does not present, we just set it to 0 or -1, so it will placed 
at the last when comparing with the files written by newer version.
   In this way we do not need to rename the file since rename coud fail and we 
also need to deal with it...



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/StoreFileListFile.java:
##########
@@ -174,7 +176,13 @@ private NavigableMap<Long, List<Path>> listFiles() throws 
IOException {
         LOG.warn("Found invalid track file {}, which is not a file", file);
         continue;
       }
-      if (!TRACK_FILE_PATTERN.matcher(file.getName()).matches()) {
+      if (TRACK_FILE_OLD_PATTERN.matcher(file.getName()).matches()) {
+        Path newFile = new Path(trackFileDir,
+          file.getName() + TRACK_FILE_SEPARATOR + System.currentTimeMillis());
+        LOG.info("Found invalid track file {}, Rename to {}", file, newFile);
+        fs.rename(file, newFile);

Review Comment:
   As mentioned in the above comment, here if the rename fails, we need to to 
deal with it...



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