Cross-posted. This article’s canonical home is Data Lakehouse Hub.
When deletion vectors land while Spark’s RewriteDataFiles runs, compaction commits can fail, because every file group was planned from one starting snapshot. On Nov 24, 2026, Iceberg contributors leaned toward re-planning and validating each group against the latest snapshot, then retrying. They deferred adding a persisted compaction map to the spec.
If you run Apache Iceberg tables with steady deletes, you have probably seen this pattern in your logs. A compaction job runs for twenty minutes, rewrites a few hundred files, and then fails at commit with a validation error. A writer added a delete to one of the files the job rewrote. The job’s work is discarded. It retries, runs another twenty minutes, and hits the same thing. On a hot partition, it never finishes.
That’s not a misconfiguration. It’s a known gap between how compaction validates and what it actually changed. In the week of November 20, 2026, the Iceberg dev list discussed two ways to close it. One adds new structure to the specification. The other improves the implementation and holds off on spec changes. This article explains the conflict from first principles, lays out both proposals, and ends with what you can do about it today.
Why Compaction and Row-Level Deletes Collide
Start with what each operation does.
Compaction rewrites many small data files into fewer large ones. It reads rows from source files and writes the same rows into new output files. Logically, nothing changes. The table holds the same rows before and after. Only the physical layout moves.
Row-level deletes in Iceberg v3 use deletion vectors. A deletion vector is a bitmap attached to one data file. Each set bit marks a row position in that file as deleted. Deletion vectors live in Puffin files and point at their data file by path. Writers add them as part of DELETE, UPDATE, and MERGE operations in merge-on-read mode.
Now run both at once. Compaction starts and reads source file A. While it works, a writer commits a deletion vector for file A, marking position 1,042 as deleted. Compaction finishes and tries to commit. Its commit says “replace file A with output file X.” But the deletion vector points at A, by path and by position. File X has different positions. If the commit goes through, the delete is lost, because nothing points at the row’s new location in X.
So Iceberg’s validation does the safe thing and rejects the compaction commit. The RewriteFiles operation checks whether any delete files were added for the files it replaced since it started. If so, it fails.
Here’s the subtle part. The compaction didn’t change any row. It’s what Shawn Chang’s proposal calls “a logical no-op.” The conflict exists only because the delete is addressed by physical position, and compaction moves positions. Validation can’t tell “the layout moved” apart from “the rows changed,” so it treats both the same way.
Why It Gets Worse Under Load
A single failed compaction is annoying. A compaction that fails every time is a real operational problem, and the dynamics make that likely on exactly the tables that need compaction most.
Tables that receive frequent deletes are usually tables with frequent writes: change data capture targets, upsert-heavy fact tables, streaming tables with corrections. Those are also the tables that accumulate small files and delete files fastest. They need compaction often.
The probability that a compaction conflicts grows with two things: how long the compaction runs, and how often deletes touch the files it rewrites. Larger compactions run longer. Hotter partitions receive more deletes. So the compaction you most need is the one most likely to fail.
Then retries make it worse. Each failed attempt wastes the full rewrite. If the conflict window is twenty minutes and deletes arrive every few minutes, the retry fails too. Shawn Chang’s message describes the cost as work discarded over “minutes or hours,” which matches what operators report. Meanwhile, small files and delete files keep piling up, reads slow down, and the table drifts further from healthy.
How Spark’s RewriteDataFiles Plans Today
The re-plan proposal targets a specific part of the current design, so it helps to see how the Spark action works.
RewriteDataFiles starts by reading the table at one snapshot. It selects candidate files, groups them into file groups by partition and size, and plans every group from that same starting snapshot. Then it rewrites the groups, several at a time.
With partial progress turned on, it commits groups in batches as they finish, instead of one big commit at the end. That helps. A conflict in one batch doesn’t throw away the others.
The weakness that Amogh Jahagirdar pointed out on November 24 is the shared starting snapshot. Every group was planned against the snapshot from when the job began. A group that starts rewriting an hour into the job still validates against conflicts since that original snapshot. Any delete that landed in that hour, before the group even began, counts as a conflict. The group was doomed before it started.
Proposal One: A Compaction Map
On November 20, 2026, Shawn Chang opened a dev list thread proposing that compaction record how row positions moved. He developed the design with Chris, and it builds on a research paper, “Commutative Compaction,” by Douglas and Hellerstein, published at the FORMATS ‘26 workshop.
The core idea is simple to state. During a rewrite, compaction knows exactly where each row went. Row 1,042 of file A became row 87,310 of file X. Record that mapping. At commit time, if a deletion vector was added for A while compaction ran, translate it through the mapping into a deletion vector for X. Then commit both. The delete survives, and the compaction succeeds.
That turns a conflict into a merge. Compaction and deletes commute, which is the “commutative” in the paper’s title. The order they commit in stops mattering.
Shawn reported a working Spark implementation with tests and benchmarks, and said he’d open a pull request once the community agreed on direction. The full design lives in a linked design document. The thread’s opening message doesn’t spell out how the map is stored or how long it’s kept, which are the parts that decide whether it belongs in the specification.
That last point is where the debate centers. A mapping used only inside one compaction job, in memory, needs no spec change. A mapping persisted in table metadata, so that other writers or later operations can use it, is a spec change. Persisted maps also raise questions about size, retention, and which writers must understand them.
Proposal Two: Re-Plan, Validate, Retry per Group
Amogh Jahagirdar replied on November 24. He supported not adding a persisted compaction map to the spec yet. His reasoning was that it can be added later as an optional field and doesn’t need to block other work, and that the project should “push the implementations as much as possible before we add spec complexity.”
His alternative fixes the baseline problem first. Instead of planning every file group from the job’s starting snapshot, each group would:
- Re-plan against the latest snapshot, just before rewriting.
- Validate against that same snapshot at commit.
- Retry if a conflict still occurs.
The effect is to shrink each group’s conflict window from “since the job started” to “since this group started.” A group that begins an hour into the job only conflicts with deletes that arrive during its own few minutes of work. It keeps the same isolation guarantees as today, because validation still rejects real conflicts.
He also named where this approach runs out. When a file’s deletion vector changes so often that it almost always changes during any rewrite, re-planning doesn’t help. Hot-key change data capture workloads are the typical case. There, an in-memory position map, used within the job and not persisted, still earns its keep.
His suggested way forward was to measure. Compare today’s behavior, re-plan with retry, and the in-memory map on three metrics:
- commit success rate,
- wasted rewrite work,
- how much of the table gets compacted over time as the delete rate rises.
A Worked Timeline
The mechanics are easier to see as a timeline. Here’s one compaction run against a partition that receives a CDC merge every five minutes. The times are illustrative.
00:00. Compaction starts. It reads snapshot 100 and plans six file groups for the partition, each about 2 GiB of small files.
00:00 to 00:06. Group 1 rewrites. At 00:05, a CDC merge commits snapshot 101, adding deletion vectors to three files, one of which is in group 1.
00:06. Group 1 tries to commit. Validation checks for delete files added to its source files since snapshot 100. It finds the one from snapshot 101. The commit fails.
00:06 to 00:12. Group 2 rewrites. Its source files received no deletes in snapshot 101, but at 00:10 snapshot 102 adds a deletion vector to one of them.
00:12. Group 2 fails the same way.
00:12 to 00:36. Groups 3 through 6 run. Each one spans at least one CDC merge. Each one has a source file that the merges touched, because a partition receiving CDC traffic touches most of its files over half an hour. Most fail.
Now replay it with per-group re-planning. Group 3 starts at 00:12. It re-plans against the latest snapshot, 102, so the deletes from 101 and 102 are already part of its input. It rewrites those rows correctly, with the deleted rows dropped. Its conflict window is only its own six minutes. It fails only if the merge at 00:15 touches one of its files. Some groups still fail, but far fewer, and none of them fail because of deletes that landed before they started.
Now replay it with a position map. Group 1 finishes at 00:06 and finds the deletion vector from snapshot 101. Instead of failing, it translates the deleted positions through its map into a deletion vector for its output file and commits both. Every group succeeds, unless a deletion vector changes again during the translation and commit itself.
The timeline also shows the hot-key limit Amogh described. If a few files receive deletes in every merge, re-planning can’t outrun them. Every group that includes those files conflicts within its window. A map is the only approach that handles that case, which is why Amogh suggested the in-memory map as a complement, not a rival.
Does Copy-on-Write Avoid the Problem?
A fair question is whether switching delete mode avoids all of this. Iceberg supports two modes for row-level changes.
Merge-on-read writes deletion vectors and leaves data files alone. Reads apply the vectors. This is the mode that creates the conflict described here.
Copy-on-write rewrites the affected data files during the DELETE, UPDATE, or MERGE. No deletion vectors are created.
Copy-on-write changes the conflict but doesn’t remove it. Now the delete operation itself replaces data files. If compaction and a copy-on-write delete both rewrite the same source file, one of them must fail, because both claim to replace it. The losing side has to retry. And copy-on-write makes every delete expensive, because rewriting a 512 MB file to remove one row costs the whole file.
So copy-on-write moves the cost from compaction failures to slow, expensive writes. For tables with rare, large deletes, that’s often a good trade. For tables with frequent small deletes, which are exactly the tables with this problem, merge-on-read with deletion vectors is still the right mode. The fix belongs in compaction, which is why the dev list is working on it there.
Choosing a Strategy for Your Tables
Until engines ship the fixes, you can sort your tables into three groups and treat each differently.
Cold tables, rare deletes. Compaction rarely conflicts. Run large, efficient compactions on a schedule and don’t overthink it.
Warm tables, regular deletes in bursts. Conflicts happen when compaction overlaps a burst. Schedule compaction between bursts, turn on partial progress, and keep file groups moderate.
Hot tables, continuous deletes on many files. Conflicts are constant. Use small file groups, partial progress with many commits, and frequent short runs scoped to recent partitions. Consolidate delete files separately so reads stay fast even when data compaction loses. These are the tables that benefit most from re-planning when it ships, and the hot-key subset is where a position map earns its place.
Track which group each table sits in with the coverage query. Tables move between groups as workloads change, and a table that drifts from warm to hot needs its compaction schedule changed before its read latency tells you.
Comparing the Approaches
Here’s the trade-off as a table.
| Approach | Spec change | Conflict window | Handles hot keys | Complexity |
|---|---|---|---|---|
| Today: plan all groups from one snapshot | No | Whole job duration | No | Lowest |
| Re-plan and retry per group | No | One group’s rewrite time | Poorly | Low, implementation only |
| In-memory position map within the job | No | Effectively removed for translated deletes | Yes | Medium, implementation only |
| Persisted compaction map in table metadata | Yes | Removed, and usable by other operations | Yes | Highest, every implementation affected |
The rows read as a ladder. Each step solves more of the problem and costs more. Amogh’s position is to climb one step at a time and measure before reaching the top. The top step is the only one that touches the specification, which means every Iceberg implementation in every language eventually has to handle it.
Why the Spec Bar Is High
It’s worth understanding why Iceberg contributors resist spec changes, because the same instinct shows up in many other debates.
The Iceberg specification is implemented in Java, Python, Rust, Go, and C++, plus inside many commercial engines. A field added to table metadata has to be read, preserved, or at least safely ignored by all of them. If an older writer rewrites metadata and drops a field it doesn’t understand, any data that depended on that field is lost.
Optional fields help, which is why Amogh pointed out that a compaction map can arrive later as an optional field. But “optional” still means every implementation needs a defined behavior for it. Spec changes also go through format-version planning, votes, and long adoption tails. Implementation changes ship in a release.
So when an implementation change gets most of the benefit, the community tends to take it first. The spec change stays available for the cases measurement proves it’s needed.
Measuring Compaction Health on Your Own Tables
The three metrics Amogh proposed are useful well beyond this debate. They’re how you should evaluate compaction health on your own delete-heavy tables today.
Commit success rate. The share of compaction commits that succeed on the first attempt.
Wasted rewrite work. Bytes rewritten by attempts that failed to commit.
Compaction coverage over time. How much of the table sits in well-sized files with few delete files, tracked as the delete rate changes.
You can approximate the third from Iceberg metadata tables. This Spark SQL query reports file and delete-file health per partition:
-- Compaction coverage: data files, small files, and delete files per partition.
WITH data_files AS (
SELECT partition,
COUNT(*) AS data_files,
SUM(CASE WHEN file_size_in_bytes < 64 * 1024 * 1024 THEN 1 ELSE 0 END) AS small_files
FROM lake.sales.orders.data_files
GROUP BY partition
),
delete_files AS (
SELECT partition, COUNT(*) AS delete_files
FROM lake.sales.orders.delete_files
GROUP BY partition
)
SELECT d.partition, d.data_files, d.small_files,
COALESCE(x.delete_files, 0) AS delete_files
FROM data_files d
LEFT JOIN delete_files x ON d.partition = x.partition
ORDER BY delete_files DESC, small_files DESC
LIMIT 25;
The data_files metadata table lists current data files with their sizes, and the first common table expression counts all files and small files under 64 MiB per partition. The delete_files metadata table lists current delete files, including deletion vectors, and the second expression counts them per partition. The final query joins the two and sorts so partitions with the most delete files and small files come first. Run it daily and store the results. Partitions that stay at the top despite regular compaction are the ones losing to concurrent deletes.
For the first two metrics, use your compaction job’s logs and the snapshot history. Successful compactions appear as replace operations in the snapshots metadata table. Failed attempts don’t appear there at all, which is exactly why you need job-level logging to count them.
What Operators Can Do Today
The dev list discussion is about future fixes. Here’s what works with current releases.
Turn on partial progress. With partial-progress.enabled set to true, Spark commits file groups in batches instead of all at once. A conflict costs one batch, not the whole job. Set partial-progress.max-commits to control how many commits a run produces.
CALL lake.system.rewrite_data_files(
table => 'sales.orders',
where => 'order_date >= DATE ''2026-11-01''',
options => map(
'partial-progress.enabled', 'true',
'partial-progress.max-commits', '20',
'max-file-group-size-bytes', '10737418240',
'max-concurrent-file-group-rewrites', '8'
)
);
partial-progress.enabled commits groups as they finish. partial-progress.max-commits splits the run into up to 20 commits, so each one covers less work and a conflict wastes less. max-file-group-size-bytes caps each group at 10 GiB, which shortens each group’s rewrite time and so its exposure to deletes. max-concurrent-file-group-rewrites controls parallelism. The where clause scopes the run to recent partitions, where most small files live.
Make groups smaller on hot partitions. Smaller file groups finish faster and conflict less. You pay for it with more commits.
Separate hot and cold partitions. Compact cold partitions, where deletes are rare, in big efficient runs. Compact hot partitions in small, frequent runs. One job tuned for both does neither well.
Schedule around delete bursts. If deletes arrive in batches, such as a nightly CDC merge or a GDPR deletion job, compact between bursts instead of during them.
Convert and consolidate deletes first. Rewriting position deletes or converting equality deletes into deletion vectors keeps read cost down while you wait for data compaction to succeed. Several implementations now offer this, including iceberg-go 0.8.0.
Watch the retry setting. The commit.retry.num-retries table property controls how often a commit retries after a conflict at the metadata level. Retrying a compaction commit doesn’t fix a real delete conflict, because validation fails again. More retries help with pointer contention, not with this problem.
Failure Modes and Warning Signs
Compaction never completes on some partitions. Warning sign: the same partitions top the coverage query week after week. Cause: deletes land during every rewrite. Fix: smaller groups and partial progress now, and watch for re-plan support in your engine.
Wasted compute. Warning sign: compaction cost rises while table health doesn’t improve. Cause: repeated failed attempts. Fix: log attempts and bytes per attempt, and alert on a low first-attempt success rate.
Read latency creeping up on delete-heavy tables. Warning sign: slower merge-on-read queries over weeks. Cause: delete files accumulate because compaction keeps failing. Fix: consolidate delete files separately and prioritize those partitions.
Retry storms between compaction and writers. Warning sign: commit retries climb for both ingestion and compaction. Cause: both target the same partitions at the same time. Fix: schedule compaction away from ingestion peaks for those partitions.
Silent data loss from custom tools. Warning sign: deleted rows reappear after a rewrite by a homegrown tool. Cause: a rewrite that skipped validation. Fix: only rewrite through Iceberg’s RewriteFiles operation, which validates against concurrent deletes. iceberg-go 0.8.0 fixed a related bug where copy-on-write commits dropped concurrent deletes, which shows how easy this is to get wrong.
Questions to Ask Your Engine or Managed Service
Many teams don’t run compaction themselves. A managed service, a catalog with built-in maintenance, or an engine’s automatic optimization does it for them. The conflict described here still happens inside those services. Ask these questions to find out how each one handles it.
- Does compaction plan each file group from the latest snapshot, or from one snapshot per run? This tells you whether the service already does the re-plan fix.
- Does it commit file groups incrementally? Incremental commits limit wasted work per conflict.
- What happens when a rewrite conflicts with a new deletion vector? Fail and retry, skip the group, or translate the delete?
- Can I see compaction attempts, failures, and bytes rewritten per table? Without this, you can’t measure wasted work.
- Can I set different compaction policies for hot and cold partitions? One policy for a whole table works poorly on mixed workloads.
- Does it consolidate delete files separately from data compaction? That keeps reads fast when data compaction struggles.
A service that answers the first three clearly has thought about this problem. If the answers are vague, run the coverage query against tables it manages and see whether hot partitions stay healthy.
What to Watch Next
Three signals will tell you where this goes.
- A re-plan implementation in Spark’s rewrite action. If it lands, the most common conflict case improves without any spec change. Check release notes for changes to how file groups are planned.
- The compaction map pull request. Shawn said he’d open one once direction is agreed. Whether it arrives as an in-memory, job-scoped feature or as a spec proposal tells you which way the community leaned.
- Published measurements. The thread asked for numbers on commit success, wasted work, and coverage under rising delete rates. Those results decide whether a persisted map ever reaches the spec.
Conclusion
The conflict between compaction and concurrent deletion vectors comes from one fact. Deletion vectors address rows by physical position, and compaction moves positions without changing rows. Validation can’t tell layout changes from row changes, so it rejects the compaction.
Two fixes are on the table. A compaction map translates deletes through the rewrite and makes the conflict disappear, at the cost of new structure if it’s persisted in the spec. Re-planning each file group against the latest snapshot shrinks the conflict window with no spec change, and an in-memory map can cover the hot-key cases that remain. The dev list leaned toward the second path first, with measurement deciding whether the first is needed later.
Until either lands in your engine, use partial progress, smaller groups on hot partitions, separate schedules for hot and cold data, and the coverage query above to see whether compaction is winning.
For the broader concurrency picture, see what happens when two engines write the same Iceberg table. For the delete side, see the deletion vectors reference and deletion vectors for high-throughput streaming ingest. For the economics of keeping tables healthy, see Table Maintenance Stopped Being a Product.
Sources: Shawn Chang’s proposal, Nov 20, 2026 · Amogh Jahagirdar’s reply, Nov 24, 2026
Keep Going
If this piece was useful, I have written a lot more on Iceberg’s commit protocol and maintenance. Apache Iceberg: The Definitive Guide (O’Reilly) covers delete files, compaction, and concurrency control in depth. You can find every book I have written, across lakehouse architecture, Apache Iceberg, Apache Polaris, and AI, at books.alexmerced.com.