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

   ### Describe the issue this Pull Request addresses
   
   Closes #19561
   
   ### Summary and Changelog
   
   Table creation passed `TIMELINE_HISTORY_PATH.defaultValue()` (`history`) 
into `setArchiveLogFolder(...)` regardless of the table version being created.
   
   A table below version 8 uses timeline layout version 1, and 
`TimelinePathProviderV1.getTimelineHistoryPath()` resolves the archived 
timeline through `hoodie.archivelog.folder`. Forcing that config to the layout 
version 2 value meant such a table archived into `.hoodie/archived`'s sibling 
`.hoodie/history`, diverging from the conventional location.
   
   Changes:
   
   - Remove the hardcoded value from the table creation paths so 
`TableBuilder.build()` supplies `ARCHIVELOG_FOLDER.defaultValue()`, and pass 
through only a value the user configured. Five call sites: `StreamSync`, 
`BootstrapExecutor`, `BootstrapExecutorUtils`, `HoodieSparkSqlWriter` (both 
table creation branches), and the Flink `StreamerUtil`.
   - `HoodieSparkSqlWriter` switches from `getStringOrDefault` to `getString` 
so an unset config reaches the builder as null rather than as the layout 
version 2 default.
   - Add `TestStreamSync` coverage across table versions 6, 7, 8 and 9, 
asserting both the persisted config and the resolved archive path, plus a case 
pinning that an explicitly configured `hoodie.timeline.history.path` is still 
honoured.
   
   The metadata table already handled this correctly through 
`HoodieBackedTableMetadataWriterTableVersionSix`, which returns 
`ARCHIVELOG_FOLDER.defaultValue()`; it is unchanged.
   
   The active timeline is unaffected: `TimelinePathProviderV1` hardcodes 
`.hoodie` and never consults `hoodie.timeline.path`.
   
   ### Impact
   
   Newly created tables below version 8 archive into `.hoodie/archived`, 
matching the conventional location and the metadata table.
   
   Tables at version 8 and above now record `hoodie.archivelog.folder=archived` 
where these paths previously wrote `history`. That config has exactly one 
reader in the codebase, `TimelinePathProviderV1`, which is unreachable at 
layout version 2, so it is inert for those tables. It becomes meaningful again 
after a downgrade to version 7 or below, where the new value is the correct 
one: `EightToSevenDowngradeHandler` writes the converted archived timeline to a 
hardcoded `.hoodie/archived`, so a table carrying `history` previously ended up 
pointing at an empty directory after downgrade.
   
   Existing tables are not modified. Any created below version 8 keep `history` 
in their properties and continue to resolve consistently, since the persisted 
value is what is read.
   
   No public API change.
   
   ### Risk Level
   
   low
   
   The changed config has a single production reader, selected only for 
timeline layout version 1, so behaviour at layout version 2 is unchanged in 
effect. Verified with unit tests across four table versions, and by confirming 
that reverting the change reproduces the original symptom (`expected: 
<archived> but was: <history>` at table version 6).
   
   ### Documentation Update
   
   none
   
   No config is added and no default value changes; this removes a hardcoded 
override that bypassed an existing default.
   
   ### 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