Skip to content

Commit

Permalink
[enhancement](schema-change) Record detailed fail reason for schema c…
Browse files Browse the repository at this point in the history
…hange tasks (apache#39351) (apache#39502)

## Proposed changes

Expose the error msg from BE as the real fail reason recorded for schema
change tasks. To avoid too much memory usage, we just pick one among all
to record.
  • Loading branch information
TangSiyang2001 authored Aug 18, 2024
1 parent 787cf16 commit c71871d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ protected void runRunningJob() throws AlterCancelException {
if (task.getFailedTimes() > 0) {
task.setFinished(true);
AgentTaskQueue.removeTask(task.getBackendId(), TTaskType.ALTER, task.getSignature());
LOG.warn("schema change task failed: " + task.getErrorMsg());
LOG.warn("schema change task failed: {}", task.getErrorMsg());
List<Long> failedBackends = failedTabletBackends.get(task.getTabletId());
if (failedBackends == null) {
failedBackends = Lists.newArrayList();
Expand All @@ -533,8 +533,8 @@ protected void runRunningJob() throws AlterCancelException {
.getReplicaAllocation(task.getPartitionId()).getTotalReplicaNum();
int failedTaskCount = failedBackends.size();
if (expectSucceedTaskNum - failedTaskCount < expectSucceedTaskNum / 2 + 1) {
throw new AlterCancelException("schema change tasks failed on same tablet reach threshold "
+ failedTaskCount);
throw new AlterCancelException(
String.format("schema change tasks failed, error reason: %s", task.getErrorMsg()));
}
}
}
Expand Down

0 comments on commit c71871d

Please sign in to comment.