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.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to