Repository navigation
[Data][1/4] Iceberg Checkpoint: only read committed parquet on checkpoint restore - #66387
Conversation
Signed-off-by: Schuyler Mortimer <[email protected]>
ef4fdd0 to
0146017
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the checkpoint loading mechanism to only read committed parquet files, explicitly excluding pending checkpoints and non-parquet files during restoration. Additionally, it introduces a delete_on_execution_success option to LoadCheckpointCallback to allow deferring checkpoint cleanup upon successful execution. Unit tests have been added to verify these behaviors. There are no review comments, so I have no feedback to provide.
| self, | ||
| config: CheckpointConfig, | ||
| *, | ||
| delete_on_execution_success: bool = True, |
There was a problem hiding this comment.
What is the need for this flag? The intuition behind it?
Nothing in this PR or the rest of the stack sets delete_on_execution_success. #66505 skips adding the callback for Iceberg instead of passing it.
Could we drop it for now, along with test_checkpoint_callback_can_defer_success_cleanup, and add it when something needs it?
| ], | ||
| ids=["local", "s3"], | ||
| ) | ||
| def test_load_checkpoint_excludes_pending_files( |
There was a problem hiding this comment.
Nice test! Could we add one more version where the checkpoint files sit in hive like sub-folders (like date=2024-01-01/) and a partition filter is set? Put both committed and pending files in there.
That checks two things this PR changes:
- sub-folders get searched
- the partition filter still works now that we pass
read_parqueta list of files instead of a folder
abhishekverma-ray
left a comment
There was a problem hiding this comment.
LGTM. Left two non-blocking suggestions, please take a look.
…oint restore (ray-project#66387) ## Description During checkpoint restoration, instead of passing the entire checkpoint directory, which may contain pending files, pass only the committed `.parquet`. ## Related issues Related to ray-project#59870 ## Additional information This isn't directly part of supporting iceberg checkpointing, but was teased out of the implementation / added first, so it can be merged without concern of iceberg-related items. Stack: - ray-project#66387 (you are here) - ray-project#66503 - ray-project#66504 - ray-project#66505 Signed-off-by: Schuyler Mortimer <[email protected]>
…and partial row masks (#66733) Follow-up to 1/4 (#66732, merged). 3/4 (#66736) builds on this. ## Why are these changes needed? A resumed generated-ID job has to know what's already done, in terms the DSv2 read path understands: **read units** (files and Parquet row groups). This PR turns the committed generated IDs into exactly that, so the planner in 3/4 (#66736) can skip it: listing drops the done units, and a step after the read drops the done rows of partly done row groups. ## What changes - **`GeneratedIdColumnCheckpointManager.load_generated_id_checkpoint()`** returns a `GeneratedIdCheckpoint`, kept in Arrow so it stays small on the driver and cheap to send to tasks: - `done_unit_ids`: an Arrow string array. A file's path when every row group of the file is committed, otherwise `"<path>#rg<N>"` per committed row group. Ids come from DSv2's `_row_group_unit_id`, so they match what the listing hook `excluded_read_unit_ids` (#66398) expects. - `partial_masks`: an Arrow table, one row per row group with only some rows committed: `unit_id` and a boolean `partial_mask` indexed by `row_id`. These are small: only row groups in flight when a job stopped are partly done. - **Compaction:** committed IDs are grouped per file with Ray Data (`groupby(path_prefix, file_name).map_groups`) into one row per done or partly done read unit: `unit_id` plus `partial_mask` (null when done). A file whose row groups are all done is a single row with its path. Masks stay numpy end to end. Duplicate IDs, from rows written more than once, are counted once, so a partly done row group never looks done. - **Refactor:** `CheckpointManager.load_checkpoint` is split so the shared steps live in `_load_checkpoint_block`: clean pending checkpoints, list committed files only (#66387), read, preprocess, one block. The `id_column` path's behavior is unchanged. The generated-ID manager's `load_checkpoint` (the numpy array path) raises, because struct IDs can't go there. - The checkpoint read opts out of the generated ID column (from 1/4). - **CI:** `checkpoint/generated_id.py` joins `ci/lint/pyrefly-excluded-files.txt`. Its `pyarrow.compute` calls (`pc.struct_field` and friends) are generated at runtime, so pyrefly reports them as missing; other pyarrow-heavy checkpoint files (`checkpoint_filter.py`, `interfaces.py`) are excluded for the same reason. Nothing calls the new load yet; 3/4 does. ## Related issue number N/A. Not a duplicate (see 1/4). ## Checks - [x] I've signed off every commit (DCO). - [x] I've run pre-commit on all changed files: clean. The API-annotation check reports nothing unannotated. - [x] AI assistance (Claude Code) was used for the development of this PR. I, Abhishek Verma, am the human submitter signing off on it: I have reviewed every changed line, run the tests below locally, and can defend the change end-to-end. - Testing: - `pytest python/ray/data/tests/unit/test_generated_id_checkpoint.py`: 9 passed. Covers done vs. partial row groups, duplicates counted once, whole file named when all row groups are done, and compacted paths matching the source path exactly (bare file name, absolute path, and a backslash Windows-style path) and IDs outside a row group never marking it done. - `pytest python/ray/data/tests/test_checkpoint.py` (on current master): 92 passed, 1 failed (the same pre-existing local moto-S3 flake as 1/4). New: loading real checkpoint files with pending files ignored and the generated-ID config active during the load; empty checkpoint. - pyrefly (CI's file set and flags) on the changed files: 0 errors. API parameter coverage check: nothing newly undocumented. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Abhishek Verma <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Description
During checkpoint restoration, instead of passing the entire checkpoint directory, which may contain pending files, pass only the committed
.parquet.Related issues
Related to #59870
Additional information
This isn't directly part of supporting iceberg checkpointing, but was teased out of the implementation / added first, so it can be merged without concern of iceberg-related items.
Stack: