cshuo opened a new pull request, #21089: URL: https://github.com/apache/hudi/pull/21089
### Describe the issue this Pull Request addresses With `read.source-v2.enabled=true`, opening each ordinary split reloads `hoodie.properties`. Pre-v8 log readers can also list the timeline to determine which blocks are committed. After another discovery round or a restart, the table may have changed since that split was planned. Closes #21051. ### Summary and Changelog - Capture `TableState` from the bounded planning view or each nonempty streaming discovery batch. Include committed instants when pre-v8 logs need them and schema history when schema-on-read needs it. - Store a snapshot ID in each split. A reader requests each missing snapshot once and shares it across its ordinary and CDC splits. Consecutive batches with identical serialized state reuse the same ID. - Checkpoint the snapshot payloads in the enumerator. A restored reader waits for its matching state before opening a split at the saved offset. The enumerator can retire a payload after a successful checkpoint covers completion of its last split. ### Impact An earlier local MiniCluster comparison used two reader subtasks, one snapshot and 240 COW rows per scan. Increasing the split count from 4 to 24 raised reader-side `hoodie.properties` opens from 4 to 24 on the baseline. With the patch, both split counts recorded zero reader opens in bounded and streaming mode. Reader-side COW timeline listings were already zero on the baseline. This does not remove the existing schema fallback for Parquet files older than the captured schema history. Planning recorded two properties opens and one timeline listing per scan in both versions. Subsequent discovery recorded two opens and zero listings for bounded reads, and three opens and one listing for streaming reads. | Mode | Splits | First row, baseline → patched (ms) | Scan rate, baseline → patched (rows/s) | | --- | ---: | ---: | ---: | | Bounded | 4 | 2359.58 → 2284.18 | 11914 → 11855 | | Bounded | 24 | 176.66 → 177.90 | 1583 → 1544 | | Streaming | 4 | 170.33 → 168.65 | 12626 → 12330 | | Streaming | 24 | 154.42 → 176.92 | 1593 → 1714 | Each version ran once in a separate JVM during development. The first bounded scan includes cold startup. Latency and throughput varied in both directions. ### Risk Level Medium. Restoring the wrong snapshot could change which log blocks or historical columns a reader sees. Tests cover pre-v8 inflight blocks, CDC and its fallback reader, a column rename over old Parquet files with both readers, and streaming startup before table creation. The restore test consumes one row, discovers another batch with changed table properties, then checkpoints and restores both the reader and enumerator. It checks the resumed offset and the exact rows emitted across recovery. Local verification: Flink 1.20, JDK 11, UTC. All 332 tests in 15 targeted suites passed, with none skipped. The suite includes the bounded/streaming MiniCluster I/O checks at both split counts. ### Documentation Update None. ### Contributor's checklist - [ ] 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]
