[enhancement](delete-handler) split Deletehandler#commitJob and add preconditions to intercept NPE(#24086)
This commit is contained in:
@ -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("'");
|
||||
|
||||
Reference in New Issue
Block a user