Skip to content

Commit

Permalink
[Enhancement] Show last task failure in result of show routine load
Browse files Browse the repository at this point in the history
… (backport #35806) (#36131)

Co-authored-by: ricky <[email protected]>
  • Loading branch information
mergify[bot] and rickif authored Nov 30, 2023
1 parent ff1d611 commit c4561a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -479,7 +481,8 @@ public long getDbId() {
}

public void setOtherMsg(String otherMsg) {
this.otherMsg = Strings.nullToEmpty(otherMsg);
this.otherMsg = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+ ": " + Strings.nullToEmpty(otherMsg);
}

public String getDbFullName() throws MetaNotFoundException {
Expand Down Expand Up @@ -1088,6 +1091,7 @@ public void afterAborted(TransactionState txnState, boolean txnOperated, String
}
routineLoadTaskInfo.afterAborted(txnState, txnOperated, txnStatusChangeReasonString);
++abortedTaskNum;
setOtherMsg(txnStatusChangeReasonString);
TransactionState.TxnStatusChangeReason txnStatusChangeReason = null;
if (txnStatusChangeReasonString != null) {
txnStatusChangeReason =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void writeUnlock() {

Assert.assertEquals(RoutineLoadJob.JobState.RUNNING, routineLoadJob.getState());
Assert.assertEquals(new Long(1), Deencapsulation.getField(routineLoadJob, "abortedTaskNum"));
Assert.assertTrue(routineLoadJob.getOtherMsg(), routineLoadJob.getOtherMsg().endsWith(txnStatusChangeReasonString));
}

@Test
Expand Down

0 comments on commit c4561a4

Please sign in to comment.