Repository navigation
Conversation
…anager and et-monitor - jobhistory: align the PostgreSQL searchWithIdOrderAsc with the mapper method, add the missing PostgreSQL maxID, and select MAX(id) in maxID so it returns a single row - manager: restore deleteResourceByTicketId to delete by ticketId - et-monitor: iterate idList in updateIncompleteJobStatusGivenIDList close apache#5497
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Fix the mapper statements described in #5497. They no longer match their Java mapper methods, so the calls fail at runtime:
DefaultQueryCacheManager.refreshUndoneTask) fails on every run on PostgreSQL, becausesearchWithIdOrderAscstill uses the old parameters andmaxIDis missing. On MySQL it fails whenever it falls back tomaxIDwhile more than one job is in the window (TooManyResultsException).deleteResourceByTicketIdcontains a copied SELECT that uses parameters the method doesn't have.updateIncompleteJobStatusGivenIDListiterateslistinstead ofidList.Only mapper XML and tests change; no Java code, configuration or DDL.
Related issues/PRs
Related issues: close #5497
Related pr: #5483 (master needs its
linkis-modulecompile fix to build)Brief change log
mapper/postgresql/JobHistoryMapper.xml: rewritesearchWithIdOrderAscto match the method. It now usesstartDate,endDate,startIdandstatusand returns ids withLIMIT 2, like the MySQL statement, and keeps the existingORDER BY id. Add the missingmaxID.mapper/mysql/JobHistoryMapper.xml:maxIDselectsMAX(id)instead of every id in the window.ResourceManagerMapper.xml: restoredeleteResourceByTicketIdtodelete from linkis_cg_manager_linkis_resources where ticketId = #{ticketId}, the SQL of the@Deleteannotation it replaced in [ResourceManagerMapper ]The sql annotation form is optimized to XML #3618.JobHistoryMapper.xml:<foreach collection="idList">.JobHistoryMapperUndoneTaskTestrunssearchWithIdOrderAsc(PostgreSQL) andmaxID(MySQL and PostgreSQL) through the mapper interface on H2. It uses a plain MyBatis session because the Spring DAO tests only load the MySQL mappers.ResourceManagerMapperTest#deleteResourceByTicketIdalso checks that resources of other tickets are kept.Tests
The CI builds skip tests, so I ran them locally on JDK 8 against master plus the compile fix from #5483:
JobHistoryMapperUndoneTaskTest(3 cases)Parameter 'id' not found,TooManyResultsException,Invalid bound statement (not found): ...maxIDResourceManagerMapperTest(15)deleteResourceByTicketId:Parameter 'resourceType' not foundA few notes on running these:
<skip>true</skip>), so I ranResourceManagerMapperTestwith the skip removed locally.NodeManagerMapperTestin the same module has 10 unrelated errors both before and after this change, because its test schema has noticketIdcolumn.-Dorg.springframework.boot.logging.LoggingSystem=nonefor the test JVM, because of an unrelated Logback/Log4j2 conflict on the test classpath.I also ran the changed statements on PostgreSQL 16 with the PostgreSQL mappers loaded. On master
refreshUndoneTask()throws. With this change it setsundoneTaskMinIdto the oldest unfinished job, or to the newest job id when nothing is unfinished.deleteResourceByTicketIdandupdateIncompleteJobStatusGivenIDListgive the same results on PostgreSQL as on H2.Build Backend, Code Format Check, Sql Script Check and the third-party dependency check currently fail on master for reasons unrelated to this change (see #5483).
spotless:checkreports no violations in the files changed here, andapache-rat:checkpasses.Checklist