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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 10be08cece3edeada94d744442c200657eb1ca46
Author: xueweizhang <zxw520bl...@163.com>
AuthorDate: Sun Feb 26 11:20:41 2023 +0800

    [fix](stream_load) can abort 2pc stream load when table dropped #17088
    
    when stream load with 2pc, the table was droped before commit, it will get 
error commit or abort, trasaction can not finish.
    if commit or abort ,will get error:
    {
    "status": "ANALYSIS_ERROR",
    "msg": "errCode = 7, detailMessage = unknown table, tableId=52579"
    }
    after this pr, i can abort success.
---
 .../java/org/apache/doris/service/FrontendServiceImpl.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java 
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index cadc707bec..a2bfe74b78 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -761,14 +761,20 @@ public class FrontendServiceImpl implements 
FrontendService.Iface {
             throw new UserException("transaction [" + request.getTxnId() + "] 
not found");
         }
         List<Long> tableIdList = transactionState.getTableIdList();
-        List<Table> tableList = 
database.getTablesOnIdOrderOrThrowException(tableIdList);
+        String txnOperation = request.getOperation().trim();
+        List<Table> tableList = new ArrayList<>();
+        // if table was dropped, stream load must can abort.
+        if (txnOperation.equalsIgnoreCase("abort")) {
+            tableList = database.getTablesOnIdOrderIfExist(tableIdList);
+        } else {
+            tableList = 
database.getTablesOnIdOrderOrThrowException(tableIdList);
+        }
         for (Table table : tableList) {
             // check auth
             checkPasswordAndPrivs(cluster, request.getUser(), 
request.getPasswd(), request.getDb(), table.getName(),
                     request.getUserIp(), PrivPredicate.LOAD);
         }
 
-        String txnOperation = request.getOperation().trim();
         if (txnOperation.equalsIgnoreCase("commit")) {
             Env.getCurrentGlobalTransactionMgr()
                     .commitTransaction2PC(database, tableList, 
request.getTxnId(), 5000);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to