This is an automated email from the ASF dual-hosted git repository.
klcopp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 38d3395ae3 HIVE-26116: Fix handling of compaction requests originating
from aborted dynamic partition queries in Initiator (Laszlo Vegh, reviewed by
Peter Vary and Karen Coppage)
38d3395ae3 is described below
commit 38d3395ae35d6422e17d592ee02fda3269cf5c80
Author: veghlaci05 <[email protected]>
AuthorDate: Wed Apr 6 10:01:11 2022 +0200
HIVE-26116: Fix handling of compaction requests originating from aborted
dynamic partition queries in Initiator (Laszlo Vegh, reviewed by Peter Vary and
Karen Coppage)
Closes #3177.
---
.../org/apache/hadoop/hive/ql/txn/compactor/Initiator.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java
b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java
index 325492fd07..0e5abf74e1 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java
@@ -70,6 +70,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.LongSummaryStatistics;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutionException;
@@ -320,10 +321,18 @@ public class Initiator extends MetaStoreCompactorThread {
if (compactions.getCompacts() == null) {
return false;
}
+
+ //In case of an aborted Dynamic partition insert, the created entry in the
compaction queue does not contain
+ //a partition name even for partitioned tables. As a result it can happen
that the ShowCompactResponse contains
+ //an element without partition name for partitioned tables. Therefore, it
is necessary to null check the partition
+ //name of the ShowCompactResponseElement even if the
CompactionInfo.partName is not null. These special compaction
+ //requests are skipped by the worker, and only cleaner will pick them up,
so we should allow to schedule a 'normal'
+ //compaction for partitions of those tables which has special (DP abort)
entry with undefined partition name.
List<ShowCompactResponseElement> filteredElements =
compactions.getCompacts().stream()
.filter(e -> e.getDbname().equals(ci.dbname)
&& e.getTablename().equals(ci.tableName)
- && (e.getPartitionname() == null && ci.partName == null ||
e.getPartitionname().equals(ci.partName)))
+ && (e.getPartitionname() == null && ci.partName == null ||
+ (Objects.equals(e.getPartitionname(),ci.partName))))
.collect(Collectors.toList());
// Figure out if there are any currently running compactions on the same
table or partition.
@@ -602,8 +611,8 @@ public class Initiator extends MetaStoreCompactorThread {
txnHandler.markFailed(ci);
} catch (MetaException ex) {
LOG.error("Caught exception while marking compaction as failed.", e);
- return false;
}
+ return false;
}
return true;
}