codope opened a new pull request, #19464:
URL: https://github.com/apache/hudi/pull/19464

   ### Describe the issue this Pull Request addresses
   
   Follow-up to #18988. `completeClustering` fires the write commit callback 
with
   `clusteringInstant.getAction()`, but that is the **inflight** instant, 
captured before the
   transition and immutable. On timeline v2 its action is `clustering`, while
   `transitionClusterInflightToComplete` records the completed instant as 
`replacecommit`. So on table
   version 8+ the callback reports an action that does not exist on the 
completed timeline. On the 0.x
   layout the two coincide, which is why it went unnoticed.
   
   ### Summary and Changelog
   
   Report the action the commit lands under, not the one it was scheduled under.
   
   - `ClusteringUtils.transitionClusteringOrReplaceInflightToComplete` now 
returns the completed
     `HoodieInstant`. Both delegates already returned it; the util discarded it.
   - `BaseHoodieTableServiceClient#completeClustering` and
     `HoodieFlinkTableServiceClient#completeClustering` pass that instant's 
action to the callback.
     This keeps the completed action defined only in the timeline 
implementation, so it cannot drift.
     The sibling call sites are already correct: compaction fires 
`COMMIT_ACTION`, log compaction
     `DELTA_COMMIT_ACTION`.
   - 
`TestHoodieJavaClientOnMergeOnReadStorage#testWriteCommitCallbackFiresOnClustering`
 asserted
     `REPLACE_COMMIT_ACTION || CLUSTERING_ACTION`, which accepted the wrong 
value and could not catch
     this; tightened to `assertEquals`, mirroring the compaction test.
   - 
`TestHoodieFlinkTableServiceClient#testCompleteClusteringCommitsAndCleansMarkers`
 statically mocks
     `ClusteringUtils`, so the transition is stubbed to return a completed 
instant, and the test now
     also asserts the Flink path reports `replacecommit` — that fire previously 
had no coverage.
   
   ### Impact
   
   Consumers of `HoodieWriteCommitCallback` on table version 8+ see 
`replacecommit` instead of
   `clustering` for clustering commits — the value the timeline records, and 
the value already reported
   on older table versions.
   
   `transitionClusteringOrReplaceInflightToComplete` changes from `void` to 
returning `HoodieInstant`.
   It is not annotated public API and has two callers, both in this PR, so this 
is source-compatible
   in-tree; a pre-compiled out-of-tree caller would need recompiling.
   
   ### Risk Level
   
   low — no change to when or whether the callback fires, or to what is written 
to the timeline.
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   


-- 
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]

Reply via email to