You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/10/21 14:04:43 UTC
[GitHub] [hive] pvargacl commented on a change in pull request #1583: HIVE-24275: [DRAFT] adding support for delayed cleanup of obsolete files/dirs
pvargacl commented on a change in pull request #1583:
URL: https://github.com/apache/hive/pull/1583#discussion_r509315841
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Cleaner.java
##########
@@ -244,7 +249,32 @@ private void removeFiles(String location, ValidWriteIdList writeIdList, Compacti
obsoleteDirs.addAll(dir.getAbortedDirectories());
List<Path> filesToDelete = new ArrayList<>(obsoleteDirs.size());
StringBuilder extraDebugInfo = new StringBuilder("[");
+ boolean delayedCleanupEnabled = conf.getBoolVar(HiveConf.ConfVars.HIVE_COMPACTOR_DELAYED_CLEANUP_ENABLED);
+
for (Path stat : obsoleteDirs) {
+ if (delayedCleanupEnabled) {
+ String filename = stat.toString();
+ if (filename.startsWith(AcidUtils.BASE_PREFIX)) {
+ long writeId = AcidUtils.ParsedBase.parseBase(stat).getWriteId();
+ if (ci.type == CompactionType.MINOR) {
+ LOG.info("Skipping base dir " + stat + " as this cleanup is for minor compaction"
+ + ", compaction id " + ci.id);
+ continue;
+ } else if (writeId > writeIdList.getHighWatermark()) {
+ LOG.info("Skipping base dir " + stat + " deletion as WriteId of this base dir is"
+ + " greater than highWaterMark for compaction id " + ci.id);
+ continue;
+ }
+ }
+ else if (filename.startsWith(AcidUtils.DELTA_PREFIX) || filename.startsWith(AcidUtils.DELETE_DELTA_PREFIX)) {
+ AcidUtils.ParsedDelta delta = AcidUtils.parsedDelta(stat, fs);
Review comment:
There is a ParsedDeltaLight in AcidUtils, that is a cheaper way to parse out the maxWriteId. This parsedDelta method will issue a FS call to check if the delta is in raw format
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org