johntomcat7408-cmyk opened a new issue, #4303:
URL: https://github.com/apache/amoro/issues/4303
## What happened?
`TestDefaultOptimizingService.testPollTaskThreeTimes` failed intermittently
in the Hadoop 3 / JDK 17 / Spark 3.5 CI job while validating PR #4284.
The test expects the final `pollTask` call to return `null`, but it returned
the same `OptimizingTask` after the optimizer was considered expired and the
task was put back into the retry queue.
This failure is unrelated to the staged table creation changes in PR #4284.
The REST catalog tests changed by that PR passed in the same job, and the
parent `master` commit passed the equivalent JDK 17 job.
Expected behavior: tests that do not exercise optimizer expiration should
keep the test optimizer alive deterministically and should not fail because of
CI scheduling delays.
## Affects Versions
`master` at/after `b7bf0d39d`; observed while testing PR #4284 at
`3844f9ed73f2c3a33802fefe5e6559e806bd6efd`.
## What table formats are you seeing the problem on?
Iceberg test fixture; the failure is in AMS optimizer test infrastructure
rather than format-specific behavior.
## What engines are you seeing the problem on?
AMS / Optimizer
## How to reproduce
The failure is intermittent and currently observed once in the full Hadoop 3
CI matrix:
1. Use JDK 17 and Spark 3.5.
2. Run the Hadoop 3 build/test workflow, or repeatedly run:
`./mvnw -pl amoro-ams -am
-Dtest=TestDefaultOptimizingService#testPollTaskThreeTimes test`
3. Under sufficient CI scheduling or lock contention, the background
`Toucher` may not complete a heartbeat before the 800 ms test timeout.
4. The optimizer keeper expires the optimizer and requeues its task; the
assertion at line 236 then receives a task instead of `null`.
Failed job:
https://github.com/apache/amoro/actions/runs/30520803888/job/90800567957
Successful equivalent job on the parent `master` commit:
https://github.com/apache/amoro/actions/runs/30519308937
## Relevant log output
```text
[ERROR] TestDefaultOptimizingService.testPollTaskThreeTimes
expected: <null> but was: <OptimizingTask(...)>
at
org.apache.amoro.server.TestDefaultOptimizingService.testPollTaskThreeTimes(TestDefaultOptimizingService.java:236)
INFO DefaultOptimizingService: Optimizer ... has been expired, unregister it
INFO DefaultOptimizingService: Task ... is suspending, since its optimizer
is expired, put it to retry queue
```
## Analysis
The test setup currently uses:
- `OPTIMIZER_HB_TIMEOUT = 800 ms` in `AMSServiceTestBase`.
- A background `Toucher` that sleeps 300 ms between heartbeat attempts.
That margin is vulnerable to CI thread scheduling and database/lock delays.
Once the heartbeat misses the 800 ms window, the production retry-on-expiration
behavior is valid, but it invalidates this test's assumption that the optimizer
remains alive throughout the final blocking poll.
This issue tracks stabilization of the test fixture or timing control; it
does not assert a production regression yet. A rerun of the failed CI job is
requested to determine whether the failure reproduces.
## Are you willing to submit a PR?
Yes, after confirming the failure or agreeing on the preferred deterministic
test approach.
## Code of Conduct
I agree to follow this project's Code of Conduct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]