[KYUUBI #7389] Fix wrong parameter binding order in JDBCMetadataStore#transformMetadataState#7390
Closed
wangzhigang1999 wants to merge 1 commit intoapache:masterfrom
Closed
Conversation
…formMetadataState The SQL placeholders expect (targetState, identifier, fromState) but the code passed (fromState, identifier, targetState), causing the UPDATE to set state back to fromState and match on targetState instead. This made cancelUnscheduledBatch silently fail.
Member
|
a stupid mistake ... thanks for fixing |
pan3793
approved these changes
Apr 9, 2026
pan3793
pushed a commit
that referenced
this pull request
Apr 9, 2026
…#transformMetadataState Closes #7389 The SQL placeholders expect (targetState, identifier, fromState) but the code passed (fromState, identifier, targetState), causing the UPDATE to set state back to fromState and match on targetState instead. This made cancelUnscheduledBatch silently fail. ### Why are the changes needed? In `JDBCMetadataStore#transformMetadataState`, the SQL is: ```sql UPDATE metadata SET state = ? WHERE identifier = ? AND state = ? ``` The placeholders expect `(targetState, identifier, fromState)`, but the code passes `(fromState, identifier, targetState)`: ```scala withUpdateCount(connection, query, fromState, identifier, targetState) ``` This causes `cancelUnscheduledBatch("INITIALIZED" -> "CANCELED")` to execute: ```sql UPDATE metadata SET state = 'INITIALIZED' WHERE identifier = ? AND state = 'CANCELED' ``` Which matches no rows and silently returns `false`. The bug has existed since v1.8.0 ([KYUUBI #4790]). ### How was this patch tested? Added a unit test `transformMetadataState should transition state correctly` in `JDBCMetadataStoreSuite` that: 1. Inserts a metadata record with `state = "INITIALIZED"` 2. Calls `transformMetadataState(id, "INITIALIZED", "CANCELED")` 3. Asserts the method returns `true` 4. Asserts the persisted state is `"CANCELED"` ### Was this patch authored or co-authored using generative AI tooling? No. Closes #7390 from wangzhigang1999/fix/transformMetadataState-param-order. Closes #7389 e3142a5 [wangzhigang] [KYUUBI] Fix wrong parameter binding order in JDBCMetadataStore#transformMetadataState Authored-by: wangzhigang <wzg443064@alibaba-inc.com> Signed-off-by: Cheng Pan <chengpan@apache.org> (cherry picked from commit bb67bd6) Signed-off-by: Cheng Pan <chengpan@apache.org>
pan3793
pushed a commit
that referenced
this pull request
Apr 9, 2026
…#transformMetadataState Closes #7389 The SQL placeholders expect (targetState, identifier, fromState) but the code passed (fromState, identifier, targetState), causing the UPDATE to set state back to fromState and match on targetState instead. This made cancelUnscheduledBatch silently fail. ### Why are the changes needed? In `JDBCMetadataStore#transformMetadataState`, the SQL is: ```sql UPDATE metadata SET state = ? WHERE identifier = ? AND state = ? ``` The placeholders expect `(targetState, identifier, fromState)`, but the code passes `(fromState, identifier, targetState)`: ```scala withUpdateCount(connection, query, fromState, identifier, targetState) ``` This causes `cancelUnscheduledBatch("INITIALIZED" -> "CANCELED")` to execute: ```sql UPDATE metadata SET state = 'INITIALIZED' WHERE identifier = ? AND state = 'CANCELED' ``` Which matches no rows and silently returns `false`. The bug has existed since v1.8.0 ([KYUUBI #4790]). ### How was this patch tested? Added a unit test `transformMetadataState should transition state correctly` in `JDBCMetadataStoreSuite` that: 1. Inserts a metadata record with `state = "INITIALIZED"` 2. Calls `transformMetadataState(id, "INITIALIZED", "CANCELED")` 3. Asserts the method returns `true` 4. Asserts the persisted state is `"CANCELED"` ### Was this patch authored or co-authored using generative AI tooling? No. Closes #7390 from wangzhigang1999/fix/transformMetadataState-param-order. Closes #7389 e3142a5 [wangzhigang] [KYUUBI] Fix wrong parameter binding order in JDBCMetadataStore#transformMetadataState Authored-by: wangzhigang <wzg443064@alibaba-inc.com> Signed-off-by: Cheng Pan <chengpan@apache.org> (cherry picked from commit bb67bd6) Signed-off-by: Cheng Pan <chengpan@apache.org>
Member
|
thanks, merged to master/1.11.2/1.10.4 |
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.
Closes #7389
The SQL placeholders expect (targetState, identifier, fromState) but the code passed (fromState, identifier, targetState), causing the UPDATE to set state back to fromState and match on targetState instead. This made cancelUnscheduledBatch silently fail.
Why are the changes needed?
In
JDBCMetadataStore#transformMetadataState, the SQL is:The placeholders expect
(targetState, identifier, fromState), but the code passes(fromState, identifier, targetState):This causes
cancelUnscheduledBatch("INITIALIZED" -> "CANCELED")to execute:Which matches no rows and silently returns
false. The bug has existed since v1.8.0 ([KYUUBI #4790]).How was this patch tested?
Added a unit test
transformMetadataState should transition state correctlyinJDBCMetadataStoreSuitethat:state = "INITIALIZED"transformMetadataState(id, "INITIALIZED", "CANCELED")true"CANCELED"Was this patch authored or co-authored using generative AI tooling?
No.