You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2022/08/08 23:37:08 UTC

[impala] 11/27: IMPALA-11335: allocate WriteId before taking locks during INSERT to ACID tables

This is an automated email from the ASF dual-hosted git repository.

stigahuang pushed a commit to branch branch-4.1.1
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 8a04e0d3d5d925b4d3ca9d3a2ec1e43a57700627
Author: Csaba Ringhofer <cs...@cloudera.com>
AuthorDate: Thu Jun 2 15:01:57 2022 +0200

    IMPALA-11335: allocate WriteId before taking locks during INSERT to ACID tables
    
    It turned out that in case of INSERT HMS uses the writeId during lock
    creation to save it and use it to cleanup aborted / timeouted
    transactions. See the Jira for more details.
    
    Testing:
    - It is tricky to test this, so no new test was added. Hive should
      check whether there is already a new writeId for a table during
      lock creation and return an error if not - this would ensure
      that the correct behavior of Impala is tested.
    
    Change-Id: Ic13b8822662474a0d2d4d1a31f12745159c758f4
    Reviewed-on: http://gerrit.cloudera.org:8080/18583
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
    Reviewed-by: Zoltan Borok-Nagy <bo...@cloudera.com>
---
 fe/src/main/java/org/apache/impala/service/Frontend.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fe/src/main/java/org/apache/impala/service/Frontend.java b/fe/src/main/java/org/apache/impala/service/Frontend.java
index d1208519c..5324e55d1 100644
--- a/fe/src/main/java/org/apache/impala/service/Frontend.java
+++ b/fe/src/main/java/org/apache/impala/service/Frontend.java
@@ -2065,10 +2065,10 @@ public class Frontend {
               staticPartitionTarget = FeCatalogUtils.getPartitionName(
                   insertStmt.getPartitionKeyValues());
             }
-            createLockForInsert(txnId, tables, targetTable, insertStmt.isOverwrite(),
-                staticPartitionTarget, queryOptions);
             long writeId = allocateWriteId(queryCtx, targetTable);
             insertStmt.setWriteId(writeId);
+            createLockForInsert(txnId, tables, targetTable, insertStmt.isOverwrite(),
+                staticPartitionTarget, queryOptions);
 
             planCtx.compilationState_.setWriteId(writeId);
           } else {