Skip to content

HIVE-30304: Iceberg V3: a DV writer loads the existing deletion vectors of its data files one at a time - #7014

Open
deniskuzZ wants to merge 1 commit into
apache:masterfrom
deniskuzZ:iceberg-dv-preload-previous-deletes
Open

deniskuzZ wants to merge 1 commit into
apache:masterfrom
deniskuzZ:iceberg-dv-preload-previous-deletes

Conversation

@deniskuzZ

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

iceberg.mr.previous.deletes.load.thread.pool.size (InputFormatConfig, default 1 = the serial path, as before): with more
threads, a V3 DV writer loads the existing deletion vectors of its data files on a pool of its own ahead of its merge,
which still takes them one data file at a time. BoundedPreloader holds at most two per thread ahead, in the order the
merge takes them (the DV writer's hash map of paths, mirrored); a data file not loaded ahead is loaded when merged, so
what is held stays bounded in any order.

Why are the changes needed?

Before it merges, a DV writer loads the existing deletion vectors of each data file it writes deletes for, one file
after another on the task thread (BaseDVFileWriter.close through the engine's loader; Spark and Trino do the same); a
writer that covers thousands of data files spends minutes on this after the scan has finished.
1TRC, 40 x r5d.4xlarge, MERGE into the V3 table, 8 threads vs 1, the same DVs and bytes in each pair:

  • 16 writers rewriting 1,966 existing DVs: DV tail after the scan 20.1 -> 4.7 s, MERGE DAG 32.8 -> 17.7 s (-46 %, one run
    each; against an earlier session's serial run -36 %);
  • 2 writers rewriting 16,254 existing DVs: DV tail 141 s, MERGE DAG 1,521 s with 8 threads; the serial path took 920 s /
    2,412 s on an earlier image (-85 % / -37 %).
    The bound costs nothing measurable: an unbounded preload had the same 2-writer tail (136 s) and DAG (+0.6 %). Deleted
    rows verified (742,998 and 5,319,699); each 8-thread writer logged its threads, the serial runs logged no preload.

Does this PR introduce any user-facing change?

A new configuration, iceberg.mr.previous.deletes.load.thread.pool.size, default 1 (no change in behaviour).

How was this patch tested?

  • TestBoundedPreloader (4): the bound, another order of use, an unexpected key, a failed load.
  • TestHiveIcebergDeleteWriter (20, 6 skipped as before): the DV writer with 1 and 4 threads.
  • TestHiveIcebergDeletionVectors (36).
  • Mutations: an unbounded window fails 2 of TestBoundedPreloader's bound tests; dropping the preloaded indexes fails
    the two 4-thread DV writer tests.

🤖 Generated with Claude Code

…rs of its data files one at a time

- iceberg.mr.previous.deletes.load.thread.pool.size (default 1, as before): with more, the DV writer loads the previous
  deletes of its data files on a pool of its own ahead of its merge, which takes them one data file at a time
- BoundedPreloader: at most two per thread held ahead, in the order the merge takes them (the DV writer's hash map of
  paths, mirrored); a data file not loaded ahead is loaded when merged, so what is held stays bounded in any order
- Impact (1TRC, 40 x r5d.4xlarge, V3 MERGE, 1 -> 8 threads, same DVs and bytes per pair): 16 writers rewriting 1,966
  DVs: DV tail after the scan 20.1 -> 4.7 s, DAG 32.8 -> 17.7 s (-46 %, one run each); 2 writers rewriting 16,254 DVs:
  tail 141 s, DAG 1,521 s with 8 threads (serial on an earlier image: 920 s / 2,412 s); unbounded preload: same tail
- TestBoundedPreloader: bound, another order, an unexpected key, a failed load; TestHiveIcebergDeleteWriter with 1 and 4
  threads (a preloaded index dropped fails the 4-thread runs, an unbounded window the bound tests)
@sonarqubecloud

sonarqubecloud Bot commented Dec 5, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants