Skip to content

Core: Parallelize deletefileindex loading in MergingSnapshotProducer - #18156

Open
grantatspothero wants to merge 1 commit into
apache:mainfrom
grantatspothero:gn/parallelizeDeleteFileIndexLoading
Open

grantatspothero wants to merge 1 commit into
apache:mainfrom
grantatspothero:gn/parallelizeDeleteFileIndexLoading

Conversation

@grantatspothero

Copy link
Copy Markdown
Contributor

validateNoNewDeletesForDataFiles is expensive when there are many snapshots between the startingSnapshotId and the commit HEAD.

Parallelizes the deletefileindex building using the worker pool.

@github-actions github-actions Bot added the core label Sep 17, 2026
@grantatspothero
grantatspothero force-pushed the gn/parallelizeDeleteFileIndexLoading branch from e5b0cc1 to 4921ee5 Compare September 17, 2026 21:00
@grantatspothero grantatspothero changed the title Parallelize deletefileindex loading in MergingSnapshotProducer Core: Parallelize deletefileindex loading in MergingSnapshotProducer Sep 17, 2026
.caseSensitive(caseSensitive)
.specsById(ops().current().specsById());
.specsById(ops().current().specsById())
.planWith(workerPool());

@amogh-jahagirdar amogh-jahagirdar Sep 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is parallelizing delete manifest reads within a single DeleteFileIndex build (i.e. useful when there are many delete manifests added in a given snapshot).

But if we want to optimize the case where many snapshots were added, we would want to parallelize the creation of all these indices

.

I think optimizing for the latter is more useful because reducing validation latency is more useful for things like compaction jobs trying to keep up with streaming workloads where the number of delete manifests that should be produced per commit should be small to begin with (and even for big batch jobs, we'd be merging delete manifests etc) so parallelism at that level in validation probably isn't that useful.

@grantatspothero grantatspothero Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with you that parallelizing across snapshots is better.

I made this change because it is trivially correct and better than the existing implementation. Let me explore parallelizing across snapshots

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that came up is reentrancy of parallelizing tasks using the worker pool. See discussion here: #18076 (comment)

In this example, it means we cannot parallelize both across snapshots and within a snapshot due to reentrancy and deadlock. So you have to choose which level to parallelize at, and I think I agree with you parallelizing across snapshots is better.

Is this reentrancy issue something you have seen elsewhere in Iceberg?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants