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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new d87b852e18b [enhancement](delete-handler) split 
Deletehandler#commitJob and add preconditions to intercept NPE(#24086)
d87b852e18b is described below

commit d87b852e18b94234ac4f86de3bae41500ef7cbfe
Author: Siyang Tang <82279870+tangsiyang2...@users.noreply.github.com>
AuthorDate: Wed Sep 13 14:34:12 2023 +0800

    [enhancement](delete-handler) split Deletehandler#commitJob and add 
preconditions to intercept NPE(#24086)
---
 .../src/main/java/org/apache/doris/load/DeleteHandler.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java
index 494fbd5db33..13f65baf1b4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java
@@ -500,14 +500,20 @@ public class DeleteHandler implements Writable {
         TransactionStatus status = null;
         try {
             unprotectedCommitJob(job, db, table, timeoutMs);
-            status = Env.getCurrentGlobalTransactionMgr()
-                    .getTransactionState(db.getId(), 
job.getTransactionId()).getTransactionStatus();
+            GlobalTransactionMgr transactionMgr = 
Env.getCurrentGlobalTransactionMgr();
+            long dbId = db.getId();
+            long transactionId = job.getTransactionId();
+            TransactionState transactionState = 
transactionMgr.getTransactionState(dbId, transactionId);
+            Preconditions.checkNotNull(transactionState,
+                    "got null txn state with: dbId=%s, txnId=%s", dbId, 
transactionId);
+            status = transactionState.getTransactionStatus();
         } catch (UserException e) {
             if (cancelJob(job, CancelType.COMMIT_FAIL, e.getMessage())) {
                 throw new DdlException(e.getMessage(), e);
             }
         }
 
+        Preconditions.checkNotNull(status, "got null txn status, jobId=%s", 
job.getId());
         StringBuilder sb = new StringBuilder();
         sb.append("{'label':'").append(job.getLabel()).append("', 
'status':'").append(status.name());
         sb.append("', 'txnId':'").append(job.getTransactionId()).append("'");


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

Reply via email to