[enhancement](schema-change) Record detailed fail reason for schema change tasks (#39351) (#39501)

## 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.
This commit is contained in:
Siyang Tang
2024-08-18 13:51:06 +08:00
committed by GitHub
parent e01d051acf
commit c0cbb2362c

View File

@ -516,7 +516,7 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
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();
@ -527,8 +527,8 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
.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()));
}
}
}