hutiefang76 opened a new issue, #4400:
URL: https://github.com/apache/amoro/issues/4400
## What happened?
When a table has `self-optimizing.quota=0`,
`OptimizingUtil.buildTableOptimizeInfo` computes a zero quota limit and
converts a NaN occupation ratio to BigDecimal, which throws
NumberFormatException. A negative property can also produce a negative
displayed quota. The scheduler already clamps this proportional quota limit to
at least one in DefaultTableRuntime and OptimizingQueue, while the Dashboard
calculation does not.
## Affects Versions
master at 9442f8c0fe86f3199c77c21b730e1d9cf6cfe984.
## What table formats are you seeing the problem on?
AMS optimizing table-group view; the quota calculation is independent of
table format.
## What engines are you seeing the problem on?
AMS.
## How to reproduce
1. Set the table property `self-optimizing.quota` to `0` on a table assigned
to an optimizer group.
2. Request the group's table list: `GET
/api/ams/v1/optimize/optimizerGroups/{optimizerGroup}/tables?page=1&pageSize=20`.
3. The list-building path reaches buildTableOptimizeInfo with the zero quota
and throws during BigDecimal conversion. With a negative quota it can return a
negative limit instead.
The focused controller-model tests reproduce the calculation using a real
TableRuntimeMeta and the real TableConfigurations parser. The full HTTP flow
has not been exercised locally.
## Expected behavior / proposed approach
Use the same minimum quota limit as the existing scheduler calculation. Keep
positive proportional and absolute quota semantics unchanged. Add lightweight
JUnit 5 cases for zero, negative, proportional and absolute values, and a
running task's occupation.
## Relevant log output
Zero-quota regression before the fix: NumberFormatException while converting
NaN in OptimizingUtil.buildTableOptimizeInfo. Negative-quota regression:
expected 1.0, actual -2.0. The corrected calculation passes both cases.
## Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
## Code of Conduct
- [x] I agree to follow this project's Code of Conduct.
## AI assistance
Code was assisted by DeepSeek v4 Flash via Reasonix 1.39.4; submission text
was assisted by Codex. The patch and local test results were reviewed.
--
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]