From issues-return-420573-archive-asf-public=cust-asf.ponee.io@hbase.apache.org Thu Jan 16 00:34:51 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 39CAF18065E for ; Thu, 16 Jan 2020 01:34:51 +0100 (CET) Received: (qmail 41701 invoked by uid 500); 16 Jan 2020 00:34:50 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 41689 invoked by uid 99); 16 Jan 2020 00:34:50 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jan 2020 00:34:50 +0000 From: GitBox To: issues@hbase.apache.org Subject: [GitHub] [hbase] Apache9 commented on a change in pull request #1022: HBASE-23680 RegionProcedureStore missing cleaning of hfile archive Message-ID: <157913489038.13240.15606016233356830690.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Thu, 16 Jan 2020 00:34:50 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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