hutiefang76 opened a new pull request, #4362: URL: https://github.com/apache/streampark/pull/4362
## What changes were proposed in this pull request This PR fixes `FlinkSavepointServiceImpl#getLatest` when duplicate `latest = true` savepoint records exist for the same application. The previous query used `one()`, so MyBatis-Plus called `selectOne()` and threw `TooManyResultsException` if historical data contained more than one latest savepoint. This can make checkpoint polling repeatedly log errors, as reported in #4339. The query now orders by `triggerTime` and `id` descending and limits the result to one row, so it returns the newest latest savepoint deterministically. ## Brief change log - Order latest savepoint lookup by `triggerTime` and `id` descending. - Limit the lookup to one row before calling `one()`. - Add a regression test for duplicate `latest = true` savepoint records. ## Verifying this change - Red test before the fix: `FlinkSavepointServiceTest#testGetLatestReturnsNewestSavepointWhenDuplicateLatestRecordsExist` failed with `TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2`. - After the fix: `JAVA_HOME=$(/usr/libexec/java_home -v 17) ./mvnw -pl streampark-console/streampark-console-service -am -Dtest=FlinkSavepointServiceTest -Dsurefire.failIfNoSpecifiedTests=false test` - Result: `Tests run: 4, Failures: 0, Errors: 0, Skipped: 0`. Closes #4339. -- 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]
