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

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

                Author: ASF GitHub Bot
            Created on: 03/Jan/23 09:57
            Start Date: 03/Jan/23 09:57
    Worklog Time Spent: 10m 
      Work Description: deniskuzZ commented on code in PR #3822:
URL: https://github.com/apache/hive/pull/3822#discussion_r1060425386


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreUtils.java:
##########
@@ -1143,15 +1143,26 @@ public static TableName getTableNameFor(Table table) {
   /**
    * Because TABLE_NO_AUTO_COMPACT was originally assumed to be 
NO_AUTO_COMPACT and then was moved
    * to no_auto_compact, we need to check it in both cases.
+   * Check the database level no_auto_compact , if present it is given 
priority else table level no_auto_compact is considered.
    */
-  public static boolean isNoAutoCompactSet(Map<String, String> parameters) {
-    String noAutoCompact =
-            parameters.get(hive_metastoreConstants.TABLE_NO_AUTO_COMPACT);
+  public static boolean isNoAutoCompactSet(Map<String, String> dbParameters, 
Map<String, String> tblParameters) {
+    String dbNoAutoCompact = getNoAutoCompact(dbParameters);
+    if (dbNoAutoCompact == null) {
+      LOG.debug("Using table configuration '" + 
hive_metastoreConstants.TABLE_NO_AUTO_COMPACT + "' for compaction");
+      String noAutoCompact = getNoAutoCompact(tblParameters);
+      return noAutoCompact != null && noAutoCompact.equalsIgnoreCase("true");
+    }
+    LOG.debug("Using database configuration '" + 
hive_metastoreConstants.TABLE_NO_AUTO_COMPACT + "' for compaction");
+    return dbNoAutoCompact.equalsIgnoreCase("true");
+  }
+
+  // Get no_auto_compact property by checking in both lower and upper cases
+  private static String getNoAutoCompact(Map<String, String> parameters) {

Review Comment:
   can we return boolean right away?





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

    Worklog Id:     (was: 836569)
    Time Spent: 1h 50m  (was: 1h 40m)

> Create a new configuration to override "no compaction" for tables
> -----------------------------------------------------------------
>
>                 Key: HIVE-26793
>                 URL: https://issues.apache.org/jira/browse/HIVE-26793
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Kokila N
>            Assignee: Kokila N
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently a simple user can create a table with 
> {color:#6a8759}no_auto_compaction=true{color} table property and create an 
> aborted write transaction writing to this table. This way a malicious user 
> can prevent cleaning up data for the aborted transaction, creating 
> performance degradation.
> This configuration should be allowed to overridden on a database level: 
> adding {color:#6a8759}no_auto_compaction=false{color} should override the 
> table level setting forcing the initiator to schedule compaction for all 
> tables.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to