yihua opened a new pull request, #19223:
URL: https://github.com/apache/hudi/pull/19223
### Describe the issue this Pull Request addresses
The hudi-common log-file read path (`BufferedRandomAccessFile`,
`HoodieLogFileReader`, and the log record scanners) has gaps in direct unit
coverage for a few important behaviors: buffered random access across buffer
boundaries, corrupt-block recovery through the low-level reader, and the
un-merged log record scanner callbacks and instant-range filtering. This PR
adds focused tests for those paths. It is test-only and does not change any
production code.
### Summary and Changelog
Adds read-path test coverage for the log format:
- `TestBufferedRandomAccessFile` (new, in `hudi-common`): a pure unit test
with `@TempDir` that writes and reads payloads larger than the internal 64K
buffer to exercise seek/read/write across buffer boundaries, ranged reads that
span a boundary, in-place overwrites via backward seek, `readFully` into an
array offset, and `getFilePointer`/`length`/EOF behavior.
- New cases added to `TestHoodieLogFormat` (in `hudi-hadoop-common`),
modeled on the existing suite's fixture mechanics (HDFS mini-cluster harness,
`getDataBlock`, delete/command blocks, magic-based corrupt-block append):
- `testUnMergedLogRecordScannerCallbacksWithDeletes`: writes a data block
plus a delete block, scans with `HoodieUnMergedLogRecordScanner`, and asserts
the record callback observes every appended record key and the deletion
callback observes every deleted key.
- `testUnMergedLogRecordScannerInstantRangeFiltering`: writes two data
blocks at different log-block instant times and asserts a closed instant range
surfaces only the in-range block.
- `testLogFileReaderReadsPastCorruptBlock`: writes a valid block, an
intentionally truncated block (bad declared length), and a valid trailing
block, then reads through `HoodieLogFileReader` asserting the sequence data /
corrupt / data and the exact record contents of the valid blocks.
No code was copied.
### Impact
None. Test-only change; no public API, user-facing behavior, or performance
impact.
### Risk Level
low
Test-only additions. Readers and scanners are closed in try/with or finally
blocks, unique paths and `@TempDir` guard isolation, and the new log-format
cases reuse the existing suite's HDFS harness and fixtures.
### Documentation Update
none
### Contributor's checklist
- [ ] Read through [contributor's
guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Enough context is provided in the sections above
- [ ] 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]