hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hbase] Apache9 commented on a change in pull request #1022: HBASE-23680 RegionProcedureStore missing cleaning of hfile archive
Date Thu, 16 Jan 2020 00:34:50 GMT
Apache9 commented on a change in pull request #1022: HBASE-23680 RegionProcedureStore missing
cleaning of hfile archive
URL: https://github.com/apache/hbase/pull/1022#discussion_r367178351
 
 

 ##########
 File path: hbase-server/src/main/java/org/apache/hadoop/hbase/procedure2/store/region/RegionFlusherAndCompactor.java
 ##########
 @@ -136,9 +156,43 @@ static void setupConf(Configuration conf) {
       flushPerChanges, flushIntervalMs);
   }
 
+  private boolean isHFileDeleteable(FileStatus status) {
+    long currentTime = EnvironmentEdgeManager.currentTime();
+    long time = status.getModificationTime();
+    long life = currentTime - time;
+    if (LOG.isTraceEnabled()) {
+      LOG.trace("HFile life: {}ms, ttl: {}ms, current: {}, from: {}", life, compactedHFileTTLMs,
+        currentTime, time);
+    }
+    if (life < 0) {
+      LOG.warn("Found a hfile ({}) newer than current time ({} < {}), probably a clock
skew",
+        status.getPath(), currentTime, time);
+      return false;
+    }
+    return life > compactedHFileTTLMs;
+  }
+
+  void cleanupCompactedHFiles() throws IOException {
+    HStore store = Iterables.getOnlyElement(region.getStores());
+    // our HFiles are on the WAL file system, but the global HFile archive directory is on
the
+    // root(HFile) file system, we can not move between two different file systems. So here
we have
+    // to implement our own TTL cleaner.
+    Path archiveDir = HFileArchiveUtil.getStoreArchivePath(conf, region.getRegionInfo(),
+      store.getColumnFamilyDescriptor().getName());
+    FileSystem fs = archiveDir.getFileSystem(conf);
+
+    for (FileStatus status : fs.listStatus(archiveDir)) {
+      if (isHFileDeleteable(status)) {
 
 Review comment:
   Maybe a bit overkill? AFAIK, the only suitable HFileCleaner for this region is the TTL
one, others like Links or Back Ref are not needed. Just saying. If you think this is the correct
way then I could pass the ChoreService in and create a cleaner chain for cleaning the hfiles.

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


With regards,
Apache Git Services

Mime
View raw message