This is an automated email from the ASF dual-hosted git repository.
dkuzmenko 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 7dc821d HIVE-26051: Non blocking ALTER MATERIALIZED VIEW REWRITE
(Denys Kuzmenko, reviewed by Krisztian Kasa)
7dc821d is described below
commit 7dc821dfad7718630d90a2afe9c08b3eb7d15c7a
Author: Denys Kuzmenko <[email protected]>
AuthorDate: Wed Mar 23 09:07:31 2022 +0100
HIVE-26051: Non blocking ALTER MATERIALIZED VIEW REWRITE (Denys Kuzmenko,
reviewed by Krisztian Kasa)
Closes #3109
---
.../alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java | 3 ++-
ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java | 2 +-
ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java
b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java
index 6e479df..0dd0c4f 100644
---
a/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java
+++
b/ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/alter/rewrite/AlterMaterializedViewRewriteAnalyzer.java
@@ -85,7 +85,8 @@ public class AlterMaterializedViewRewriteAnalyzer extends
BaseSemanticAnalyzer {
}
inputs.add(new ReadEntity(materializedViewTable));
- outputs.add(new WriteEntity(materializedViewTable,
WriteEntity.WriteType.DDL_EXCLUSIVE));
+ outputs.add(new WriteEntity(materializedViewTable,
AcidUtils.isLocklessReadsSupported(materializedViewTable, conf) ?
+ WriteEntity.WriteType.DDL_EXCL_WRITE :
WriteEntity.WriteType.DDL_EXCLUSIVE));
// Create task for alterMVRewriteDesc
DDLWork work = new DDLWork(getInputs(), getOutputs(), desc);
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java
b/ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java
index 21ae79a..0ea01fc 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/hooks/WriteEntity.java
@@ -205,7 +205,7 @@ public class WriteEntity extends Entity implements
Serializable {
* @param op Operation type from the alter table description
* @return the write type this should use.
*/
- public static WriteType determineAlterTableWriteType(AlterTableType op,
Table table, Configuration conf) {
+ public static WriteType determineAlterTableWriteType(AlterTableType op,
Table table, HiveConf conf) {
switch (op) {
case RENAME_COLUMN:
case CLUSTERED_BY:
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
index ebf2d79..4d755cb 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
@@ -409,7 +409,7 @@ public class AcidUtils {
+ String.format(DELTA_DIGITS, visibilityTxnId);
}
- public static boolean isLocklessReadsSupported(Table table, Configuration
conf) {
+ public static boolean isLocklessReadsSupported(Table table, HiveConf conf) {
return HiveConf.getBoolVar(conf,
HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED)
&& AcidUtils.isTransactionalTable(table);
}