This is an automated email from the ASF dual-hosted git repository.
czy006 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 96a4d781a [hotfix][Optimizer] Recognize CLOSED optimizing processes
(#4331)
96a4d781a is described below
commit 96a4d781aac60c4080b3f4a41322848e2308649a
Author: ConradJam <[email protected]>
AuthorDate: Sat Aug 22 12:02:59 2026 +0800
[hotfix][Optimizer] Recognize CLOSED optimizing processes (#4331)
[hotfix][Optimizer] Make isClosed() recognize the CLOSED status
close() sets ProcessStatus.CLOSED while isClosed() only compared
against KILLED - a status never assigned in this class - so the
predicate was permanently false and acceptResult's
OptimizingClosedException guard against late results on a closed
process could never fire (downstream isProcessing conditions happened
to contain the fallout).
Check both CLOSED and KILLED. Reachability analysis in the fix record:
close(false) cancels tasks so late completes fail earlier with
IllegalTaskStateException, and the partial-commit path legitimately
accepts late results; no public-API path drives the guard today, so
this lands as an intent fix verified by the full queue regression
(47/47) rather than a behavioral red test.
Fix record: docs/fix-records/2026-08-16-fix-22-is-closed-status-mismatch.md
---
.../java/org/apache/amoro/server/optimizing/OptimizingQueue.java | 5 ++++-
.../java/org/apache/amoro/server/optimizing/TestOptimizingQueue.java | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git
a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java
b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java
index 178bebaa3..2627078b5 100644
---
a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java
+++
b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java
@@ -775,7 +775,10 @@ public class OptimizingQueue extends PersistentBase {
@Override
public boolean isClosed() {
- return status == ProcessStatus.KILLED;
+ // close() sets CLOSED (KILLED is reserved for kill flows); checking
only KILLED made
+ // this predicate permanently false, so the acceptResult guard against
late results on a
+ // closed process could never fire.
+ return status == ProcessStatus.CLOSED || status == ProcessStatus.KILLED;
}
@Override
diff --git
a/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/TestOptimizingQueue.java
b/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/TestOptimizingQueue.java
index 3955e335e..37e2c6300 100644
---
a/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/TestOptimizingQueue.java
+++
b/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/TestOptimizingQueue.java
@@ -858,6 +858,8 @@ public class TestOptimizingQueue extends AMSTableTestBase {
// Close process without success (simulates group change / forced
termination)
process.close(false);
+ Assert.assertTrue(process.isClosed());
+
// lastOptimizedSnapshotId and lastOptimizedChangeSnapshotId should NOT be
updated
Assert.assertEquals(snapshotIdBeforePlanning,
tableRuntime.getLastOptimizedSnapshotId());
Assert.assertEquals(