This is an automated email from the ASF dual-hosted git repository. xxubai pushed a commit to branch 0.9.x in repository https://gitbox.apache.org/repos/asf/amoro.git
commit fed7feba8adffcc158a3f5b99fc6b22f1ada7831 Author: Jiwon Park <[email protected]> AuthorDate: Thu Jul 30 15:21:11 2026 +0900 [AMORO-4297][AMS] Persist failure reasons in task quota history (#4298) fix: persist task quota failure reasons Signed-off-by: Jiwon Park <[email protected]> (cherry picked from commit b7bf0d39de9bb085446f1b06da2cb1810ac5cb26) --- .../amoro/server/optimizing/TaskRuntime.java | 1 + .../amoro/server/optimizing/TestTaskRuntime.java | 38 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/TaskRuntime.java b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/TaskRuntime.java index fc7e67877..dc7fc99d5 100644 --- a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/TaskRuntime.java +++ b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/TaskRuntime.java @@ -408,6 +408,7 @@ public class TaskRuntime<T extends StagedTaskDescriptor<?, ?, ?>> extends Stated this.taskId = task.getTaskId().getTaskId(); this.tableId = task.getTableId(); this.retryNum = task.getRetry(); + this.failReason = task.getFailReason(); } public long getStartTime() { diff --git a/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/TestTaskRuntime.java b/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/TestTaskRuntime.java new file mode 100644 index 000000000..aee7e122e --- /dev/null +++ b/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/TestTaskRuntime.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.amoro.server.optimizing; + +import org.apache.amoro.api.OptimizingTaskId; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +public class TestTaskRuntime { + + @Test + void taskQuotaCopiesFailReason() { + TaskRuntime<?> task = Mockito.mock(TaskRuntime.class); + Mockito.when(task.getTaskId()).thenReturn(new OptimizingTaskId(1L, 1)); + Mockito.when(task.getFailReason()).thenReturn("task failed"); + + TaskRuntime.TaskQuota quota = new TaskRuntime.TaskQuota(task); + + Assertions.assertEquals("task failed", quota.getFailReason()); + } +}
