[ 
https://issues.apache.org/jira/browse/HIVE-26149?focusedWorklogId=761628&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-761628
 ]

ASF GitHub Bot logged work on HIVE-26149:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Apr/22 07:50
            Start Date: 25/Apr/22 07:50
    Worklog Time Spent: 10m 
      Work Description: pvary commented on code in PR #3220:
URL: https://github.com/apache/hive/pull/3220#discussion_r857347623


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/database/drop/DropDatabaseAnalyzer.java:
##########
@@ -49,28 +52,37 @@ public void analyzeInternal(ASTNode root) throws 
SemanticException {
     String databaseName = unescapeIdentifier(root.getChild(0).getText());
     boolean ifExists = root.getFirstChildWithType(HiveParser.TOK_IFEXISTS) != 
null;
     boolean cascade = root.getFirstChildWithType(HiveParser.TOK_CASCADE) != 
null;
+    boolean isSoftDelete = HiveConf.getBoolVar(conf, 
HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED);
 
     Database database = getDatabase(databaseName, !ifExists);
     if (database == null) {
       return;
     }
-
     // if cascade=true, then we need to authorize the drop table action as 
well, and add the tables to the outputs
+    boolean allTablesWithSuffix = false;
     if (cascade) {
       try {
-        for (Table table : db.getAllTableObjects(databaseName)) {
+        List<Table> tables = db.getAllTableObjects(databaseName);
+        allTablesWithSuffix = tables.stream().allMatch(
+            table -> AcidUtils.isTableSoftDeleteEnabled(table, conf));
+        for (Table table : tables) {
           // We want no lock here, as the database lock will cover the tables,
           // and putting a lock will actually cause us to deadlock on 
ourselves.
-          outputs.add(new WriteEntity(table, 
WriteEntity.WriteType.DDL_NO_LOCK));
+          outputs.add(
+            new WriteEntity(table, isSoftDelete && !allTablesWithSuffix ?

Review Comment:
   Nit: Could we create boolean variables with descriptive names? It is hard to 
follow what happens here.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 761628)
    Time Spent: 20m  (was: 10m)

> Non blocking DROP DATABASE implementation
> -----------------------------------------
>
>                 Key: HIVE-26149
>                 URL: https://issues.apache.org/jira/browse/HIVE-26149
>             Project: Hive
>          Issue Type: Task
>            Reporter: Denys Kuzmenko
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to