busbey 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_r366946800
########## 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: Then we should instantiate our own hfile cleaner delegate chain. Defualt it to the TTL delegate and we can skip a custom impl here as well. ---------------------------------------------------------------- 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 With regards, Apache Git Services