[Bug]: After 0.9, disabling self-optimizing leaves process RUNNING instead of CLOSED
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by reading TableRuntimeRefreshExecutor.handleConfigChanged, DefaultOptimizingService.cancelProcess, and TableController.cancelOptimizingProcess, then trace how process state and process_failed_count are persisted in table_process. Reproduce disabling self-optimizing and cancelling an orphan RUNNING process, and add or run tests for both flows. Done means the DB row closes even when the in-memory process is absent, failed cancellation is not reported as HTTP 200, and user/config closure is not counted as a process failure.
Written by the indexing model from the issue text.
Description
What happened?
After upgrading AMS from 0.8.x to 0.9.x, disabling self-optimizing no longer closes the current optimizing process.
In 0.8.x, after self-optimizing.enabled=false the process became CLOSED. In 0.9.x the row stays RUNNING in table_process (often for days), the dashboard keeps showing RUNNING, and Dashboard Cancel does not change it.
We also see amoro_table_optimizing_process_failed_count_total increase in the same window. close() / failed commit both call completeProcess(false), so turning optimizing off is counted as a process failure. There is no metric that means “CLOSED by user/config” vs “FAILED commit”.
Expected
- Setting
self-optimizing.enabled=falseshould persist the current process asCLOSED(same as 0.8 / AMORO-2250), including when the in-memoryOptimizingProcessis already gone. - Cancel should close by
processIdfrom DB. If it cannot close, the HTTP API should not return 200. - Close/cancel should not increment
process_failed_count(or should use a separate reason/metric).
Affects Versions
0.9.0-incubating (regression vs 0.8.x)
What table formats are you seeing the problem on?
Iceberg
What engines are you seeing the problem on?
AMS, Spark
How to reproduce
- Iceberg table with a MINOR process in
RUNNING. - From Spark (Copy-on-Write upsert job):
ALTER TABLE catalog.db.table SET TBLPROPERTIES ('self-optimizing.enabled' = 'false');
- Optionally run Spark CoW upsert on the same table (common production pattern: disable optimizing, then rewrite).
- Check AMS DB / Optimizing page:
SELECT process_id, status, process_type, create_time, finish_time
FROM table_process
WHERE table_id = ? AND status = 'RUNNING';
The process stays RUNNING (finish_time NULL). Repeating this daily accumulates many orphan RUNNING rows (we had 15+ on one table). status='CLOSED' / 'FAILED' can be empty.
- Open the process on the Optimizing page and click Cancel. UI still shows RUNNING. HTTP cancel returns 200.
Relevant log output
When Spark already rewrote the same files and AMS later tries to commit the leftover process:
org.apache.amoro.exception.OptimizingCommitException: unexpected commit error
Caused by: org.apache.iceberg.exceptions.ValidationException: Missing required files to delete: ...
at org.apache.iceberg.ManifestFilterManager.validateRequiredDeletes
at org.apache.amoro.server.optimizing.UnKeyedTableCommit.rewriteFiles
at org.apache.amoro.server.optimizing.OptimizingQueue$TableOptimizingProcess.commit
That path increments `process_failed_count`. A successful in-memory `close(false)` also increments it via `persistAndSetCompleted(false)`.
Anything else
This looks like a 0.9 process-framework regression of #2250 (disable self-optimizing should close the running process). 0.9 moved history to table_process and only closes the in-memory process:
TableRuntimeRefreshExecutor.handleConfigChangedcloses only when config flips true→false andgetOptimizingProcess() != null. Later refreshes do not retry. If the in-memory process is already null, the DB row stays RUNNING.DefaultOptimizingService.cancelProcessreturnsfalsewhengetOptimizingProcess()is null or the processId does not match.TableController.cancelOptimizingProcessstill returns HTTP 200.
This is different from #4172 (all tasks SUCCESS, stuck before COMMITTING). Here the process is an orphan RUNNING after disable/cancel, and failed_count treats close as failure.
Suggested direction (no code in this issue, just for maintainers):
- When
self-optimizing.enabled=false, close all RUNNING processes for that table from DB, not only the in-memory one; retry on every refresh while disabled. cancelProcess(processId)should persist-close thetable_processrow if the in-memory process is missing; HTTP should fail when cancel did not happen.completeProcess(false)after user/config close should not incrementprocess_failed_count.
Are you willing to submit a PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 397
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 18
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/amoro
-
[CI] Core CI doesn't run for changes to amoro-format-lance (and amoro-web)Possibly taken @MarkAlex1234 claimed this 6 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
fix: low-contrast secondary text color in global theme tokenMay be free again A pull request for this issue was closed without being merged. Openstale
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
apache/amoro#4157 · 1 comment ·
Maintainers usually reply within 2 days
-
fix: mock api server enabled in production build masks real error/loading uxMay be free again A pull request for this issue was closed without being merged. Openstale
Difficulty 1/5 Under an hour Newbie friendliness 78/100
apache/amoro#4155 · 1 comment ·
Maintainers usually reply within 2 days
-
type:bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Maintainers usually reply within 2 days
-
[Bug]: AMS Spark type rendering loses Iceberg timestamp-without-zone semanticsPossibly taken @hutiefang76 claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/java-sdk#1174 · 1 reaction ·
Maintainers usually reply within 2 days
-
module: core
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bigbluebutton/bigbluebutton#26028 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
MetricsHub/metricshub-community#1390 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/rocketmq-dashboard#6331 ·
Maintainers usually reply within 5 days
-
status: team-only type: dependency-upgrade
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
spring-projects/spring-boot#52143 · 1 comment ·
Maintainers usually reply within 1 day