fhan688 opened a new pull request, #19804:
URL: https://github.com/apache/hudi/pull/19804
### Describe the issue this Pull Request addresses
Closes #19196.
The legacy log record scanner reads delete blocks through the no-argument
`HoodieDeleteBlock#getRecordsToDelete()` API. This bypasses
`HoodieReaderContext` and prevents the scanner from correctly reading native
delete log blocks, whose records must be materialized through the
reader-context API.
### Summary and Changelog
This PR refactors legacy log scanners to read delete records through
`HoodieReaderContext`.
- Lazily initializes an Avro `HoodieReaderContext` when the first delete
block is processed.
- Configures the reader context with table merge properties, instant
range, schema handler, table path, and latest commit time.
- Reads delete records through
`HoodieDeleteBlock#getRecordsToDelete(HoodieReaderContext)`.
- Passes the physical partition path separately when processing
`BufferedRecord` delete records.
- Updates merged log scanning while preserving delete ordering semantics:
- A delete with a higher ordering value wins.
- A delete with a lower ordering value does not overwrite a newer data
record.
- Updates unmerged log scanning so deletion callbacks retain the correct
physical partition path.
- Deprecates the no-argument `getRecordsToDelete()` APIs while retaining
them for compatibility and block serialization.
- Adds coverage for:
- Merged native data and native delete log scanning.
- Delete ordering semantics.
- Data-record metric preservation.
- Unmerged legacy delete callbacks.
- Mixed legacy data and native delete log scanning.
### Impact
There are no storage-format, configuration, or user-facing behavior
changes.
The existing no-argument delete-record APIs remain available but are now
deprecated. Reader-context initialization is lazy and only occurs when a delete
block is processed.
The protected delete-processing hook used by the legacy scanner
implementations now operates on `BufferedRecord` and receives the physical
partition path explicitly.
### Risk Level
Low.
The change is scoped to delete-block processing in legacy merged and
unmerged log scanners. Existing compatibility APIs and serialization paths are
preserved.
The merged, unmerged, and mixed-format delete paths are covered by
regression tests. Module compilation and Checkstyle validation also pass.
### Documentation Update
None. This is an internal refactoring without new configuration or
user-facing behavior.
### 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]