wombatu-kun opened a new pull request, #20348:
URL: https://github.com/apache/hudi/pull/20348

   ### Describe the issue this Pull Request addresses
   
   Closes #20347
   
   The 9 to 8 downgrade copied several ordering fields as they are into 
`hoodie.table.precombine.field`, which Hudi 1.0.x and 0.x read as a single 
field name, so the release it targets could not upsert into the downgraded 
table.
   
   ### Summary and Changelog
   
   - `UpgradeDowngrade.run` refuses a downgrade from version 9 or above to 
below 9 of a table ordered on several fields, before the rollback, the 
compaction and the metadata table downgrade. The message names the fields, says 
why 1.0.x and 0.x cannot read them, and points to keeping the table at version 
9 or recreating it with a single ordering field.
   - `NineToEightDowngradeHandler` holds the check and applies it itself too. 
It checks the fields the downgrade would write, so `MySqlDebeziumAvroPayload` 
tables still go back to their single `_event_seq`, and it now writes the parsed 
field, so a stray separator as in `ts,` no longer lands in the legacy key.
   - `TestNineToEightDowngradeHandler` covers the refusal, a single field, 
`ts,` and the MySQL Debezium mapping. `TestUpgradeDowngradeOrchestration` 
refuses a 10 to 8 downgrade before any step and lets 10 to 9 with two fields 
and 10 to 8 for MySQL Debezium proceed. `TestUpgradeDowngrade` refuses the 
version 9 MOR fixture ordered on `ts,name` at versions 8 and 6 and checks that 
the data and metadata tables keep their version, timeline, ordering fields and 
log files.
   
   ### Impact
   
   A downgrade below version 9 of a table ordered on several fields now fails 
with `Cannot downgrade to table version 8: hoodie.table.ordering.fields=ts,name 
orders records on several fields, which Hudi 1.0.x and 0.x cannot read. ...` 
and leaves the table as it was. Before, it reported success and left 
`hoodie.table.precombine.field=ts,name`, a field that 1.0.2 upserts and MOR 
merges look for and do not find. Every other downgrade behaves as before. The 
`downgrade_table` procedure turns the failure into a `false` result and logs 
the message.
   
   ### Risk Level
   
   low
   
   The check only rejects downgrades whose result was unusable, and it runs 
before anything changes. Verified: the refusal tests fail on master with 
`Expected org.apache.hudi.exception.HoodieUpgradeDowngradeException to be 
thrown, but nothing was thrown.`, and the downgrade on master writes 
`hoodie.table.precombine.field=ts,name`, which Hudi 1.0.2 and 0.15.0 resolve as 
their precombine field.
   
   ### 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