prathik-onehouse opened a new pull request, #20912:
URL: https://github.com/apache/hudi/pull/20912

   ### Describe the issue this Pull Request addresses
   
   Closes #20911
   
   With `hoodie.write.auto.upgrade=false`, a writer whose write version differs 
from the table version is not refused: a higher write version is silently 
rewritten to the table version in the caller's config only, and a lower one is 
not checked. Writers with their own configs (Flink write tasks, the Hudi 
Streamer incremental source) then write a layout or checkpoint format the table 
version does not describe.
   
   ### Summary and Changelog
   
   `UpgradeDowngrade.needsUpgrade` now throws `HoodieUpgradeDowngradeException` 
when auto upgrade is disabled and the table version (6 and above) differs from 
the write version in either direction, instead of rewriting the write config. 
The message names the table and the remedies. `UpgradeDowngrade.run()` serves 
explicit upgrade and downgrade requests, so it now checks a new 
`needsExplicitUpgradeOrDowngrade` that ignores the flag; the CLI and the 
`upgrade_table` procedure upgrade instead of returning without doing anything. 
The `hoodie.write.auto.upgrade` documentation states the new behavior.
   
   Tests cover the refusal through Spark datasource writes, Hudi Streamer and a 
Flink pipeline, each asserting the table version, timeline and data are 
unchanged, plus the explicit `run()` upgrade with auto upgrade disabled. Tests 
that relied on the rewrite now set `hoodie.write.table.version` to the table 
version.
   
   ### Impact
   
   Writes, restore, savepoint restore and bootstrap with auto upgrade disabled 
and a write version that differs from the table version now fail before 
creating an instant (Flink fails at coordinator start) instead of proceeding. 
Explicit upgrades now run when auto upgrade is disabled.
   
   ### Risk Level
   
   medium
   
   Jobs that set only `hoodie.write.auto.upgrade=false` on a table below the 
current version relied on the rewrite and now have to set 
`hoodie.write.table.version` to the table version. A writer older than the 
table is refused too when auto upgrade is disabled, although 
`CommonClientUtils.areTableVersionsCompatible` accepts it: with auto upgrade 
off the writer is expected to work at the table version, and that case wrote 
the older layout into the newer table without any check. Standalone table 
service jobs do not go through this check, as before.
   
   ### Documentation Update
   
   Updated the `hoodie.write.auto.upgrade` config description to state that a 
mismatched write version fails when it is disabled.
   
   ### 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