You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/10/01 08:38:00 UTC

[jira] [Work logged] (HIVE-20137) Truncate for Transactional tables should use base_x

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

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

                Author: ASF GitHub Bot
            Created on: 01/Oct/20 08:37
            Start Date: 01/Oct/20 08:37
    Worklog Time Spent: 10m 
      Work Description: deniskuzZ commented on a change in pull request #1532:
URL: https://github.com/apache/hive/pull/1532#discussion_r498072413



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/misc/truncate/TruncateTableAnalyzer.java
##########
@@ -112,23 +113,27 @@ private void checkTruncateEligibility(ASTNode ast, ASTNode root, String tableNam
 
   private void addTruncateTableOutputs(ASTNode root, Table table, Map<String, String> partitionSpec)
       throws SemanticException {
+    boolean shared = AcidUtils.isTransactionalTable(table) &&

Review comment:
       could we rename local var to truncateFiles or something (same as below)

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
##########
@@ -3357,6 +3355,52 @@ private void truncateTableInternal(String dbName, String tableName, List<String>
       }
     }
 
+    /**
+     * Add an empty baseDir with a truncate metadatafile
+     * @param location
+     * @param writeId
+     * @param fs
+     * @throws Exception
+     */
+    private void addTruncateBaseFile(Path location, long writeId, FileSystem fs) throws Exception {
+      Path basePath = new Path(location, AcidConstants.baseDir(writeId));
+      fs.mkdirs(basePath);
+      // We can not leave the folder empty, otherwise it will be skipped at some file listing in AcidUtils
+      // No need for a data file, a simple metadata is enough

Review comment:
       Do you think it would make sense to move metaFile creation under MetaDataFile class, not sure however it should be under AcidConstants?

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
##########
@@ -114,16 +114,16 @@
 public class AcidUtils {
   // This key will be put in the conf file when planning an acid operation
   public static final String CONF_ACID_KEY = "hive.doing.acid";
-  public static final String BASE_PREFIX = "base_";
+  public static final String BASE_PREFIX = AcidConstants.BASE_PREFIX;

Review comment:
       could we remove those and reference constants from AcidConstants directly




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

    Worklog Id:     (was: 493344)
    Time Spent: 0.5h  (was: 20m)

> Truncate for Transactional tables should use base_x
> ---------------------------------------------------
>
>                 Key: HIVE-20137
>                 URL: https://issues.apache.org/jira/browse/HIVE-20137
>             Project: Hive
>          Issue Type: Improvement
>          Components: Transactions
>    Affects Versions: 3.0.0
>            Reporter: Eugene Koifman
>            Assignee: Peter Varga
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> This is a follow up to HIVE-19387.
> Once we have a lock that blocks writers but not readers (HIVE-19369), it would make sense to make truncate create a new base_x, where is x is a writeId in current txn - the same as Insert Overwrite does.
> This would mean it can work w/o interfering with existing writers.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)