Hi Shawn, Chris,

+1 on the direction. Some background on how Delta handles the same problem,
which may help with the persisted version Grant and Pachu are asking for.
I've been working on row-level concurrency for OSS Delta [1], including
compaction-vs-DML remapping in both directions (fork PRs, not yet upstream)
[2]. That work writes the same tags Databricks does, and I tested it with
Databricks Runtime 16.4 committing to the same table concurrently. The
Databricks behavior below is from my own tests on DBR 16.4 and 18.2.

1. Delta resolves both directions. Databricks documents that on
deletion-vector tables, UPDATE/DELETE/MERGE and OPTIMIZE "cannot conflict
... unless ZORDER BY is used" [3]. A DML that loses to a compaction is
remapped too, not only the compaction. That's Case B: the one an in-memory
map can't cover, and the common shape when a streaming writer deletes while
another engine compacts.
2. The persisted map is small. For compaction, each source file's remove
action carries compactedInto (the output file) and compactionInfo (the row
offset in the output and the source's physical row count). The losing side
replays a DV onto the output by offset, skipping the positions in the
source's own DV, which the same commit removes. That's a few numbers per
source, independent of how many rows are deleted, and resolution took about
150 ms. The Iceberg equivalent would be (source file, source start, row
count, output file, output start), with one entry per output-file boundary.
Explicit gaps are only needed for rows dropped by equality deletes during
the scan.
3. Where it lives: Delta keeps it on the tombstone, not in a side file. The
Iceberg equivalent is the source file's DELETED entry in the compaction
snapshot's manifest. RowDelta already reads that entry when it fails with
"Cannot commit, missing data files"
(MergingSnapshotProducer.validateDataFilesExist). So Case B finds the map
with no extra reads, the map commits atomically with the rewrite, and it
expires with the snapshot. It needs a manifest-entry field, which may fit
the v4 entry design.
4. On Pachu's point about sort and z-order: equality deletes commute with
those rewrites too, while a position map grows toward one run per row under
a sort. Databricks doesn't use a bigger map there; it uses row tracking.
With row tracking on, liquid clustering OPTIMIZE (including real
reclustering and OPTIMIZE FULL) reconciled with concurrent
DELETE/UPDATE/MERGE in both directions. With it off, every such race
aborted. That path is slower: about 2-3 s versus ~150 ms. Iceberg v3
already requires row lineage, and a rewrite must copy each moved row's
_row_id into the new file (spec, Row Lineage), so the same approach needs
no opt-in. A position map for order-preserving rewrites plus a _row_id
lookup for sort/z-order would let DVs cover what equality deletes commute
with today.

I'd be glad to work on the DML side: translating a RowDelta's DVs through
the persisted map during validation. It builds on #17754 and #18603, and
it's on the #18020 roadmap [4].

Thanks,
EJ

[1] https://github.com/delta-io/delta/issues/7360
[2] https://github.com/sezruby/delta/pull/9 (compaction loses),
https://github.com/sezruby/delta/pull/11 (DML loses),
https://github.com/sezruby/delta/pull/12 (persisting the source composition)
[3]
https://docs.databricks.com/aws/en/optimizations/isolation/row-level-concurrency
[4] https://github.com/apache/iceberg/issues/18020

On Fri, Nov 20, 2026 at 2:21 PM Pachu Shrinivas <
[email protected]> wrote:

> +1 - we have customers that rely on the commutative property of equality
> deletes for their CDC ingest & compaction workflows - the compaction maps
> idea is quite neat and I fully support adding it (something equivalent) to
> the iceberg spec. I'm concerned that if v4 deprecates equality deletes with
> such a solution it will prevent several customers from being to upgrade. We
> don't want a python2 vs python3 situation on our hands!
>
> Thanks,
> Pachu
>
> On Fri, Nov 20, 2026 at 3:41 PM Grant Nicholas <
> [email protected]> wrote:
>
>> Your doc mentions how equality deletes commute with compaction while
>> deletion vectors do not. I'm highlighting that with v4 deprecating equality
>> deletes, Iceberg loses the ability to issue deletes with minimal contention
>> against compaction. This especially affects low latency DELETE/UPSERT
>> workloads in Iceberg.
>>
>> I support persisted compaction maps before fully deprecating equality
>> deletes.
>>
>> On Fri, Nov 20, 2026 at 1:16 PM Anurag Mantripragada via dev <
>> [email protected]> wrote:
>>
>>> Hi Shawn,
>>>
>>> This is great. I have been working on a similar proposal based on
>>> Chris's compaction maps
>>> <https://cdouglas.github.io/posts/2026/08/compaction-maps> idea.
>>> Compaction conflicts have been a major pain point for our large customers,
>>> so I am glad we are addressing this.
>>>
>>> I will share my feedback on the design doc soon.
>>>
>>> ~ Anurag
>>>
>>>
>>> On Fri, Nov 20, 2026 at 11:03 AM Shawn Chang <[email protected]>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> Today a compaction fails to commit if any other transaction added a
>>>> position delete to one of the files it rewrote while it was running. The
>>>> rewrite is a logical no-op, but RewriteFiles validation can't tell a layout
>>>> change from a row change, so minutes or hours of work are discarded and
>>>> retried due to conflicts. Under steady write + delete traffic on hot
>>>> partitions this happens repeatedly.
>>>>
>>>> I'd like to propose an improvement: the rewrite records how row
>>>> positions moved from source to output files, and at commit time translates
>>>> any concurrently committed deletion vectors onto the output files instead
>>>> of failing.
>>>>
>>>> The idea comes from Commutative Compaction (Douglas & Hellerstein,
>>>> FORMATS '26)[1]; Chris and I have been working through the design together.
>>>> I have a working Spark implementation with tests and benchmarks and would
>>>> like to open a PR once there is agreement on the direction.
>>>>
>>>> More details in the doc:
>>>> https://docs.google.com/document/d/1-8T316SMGNWIGzgid5hn0K6xj7hDDMRquleyuQrj3m8
>>>>
>>>> Would appreciate any feedback on the approach!
>>>>
>>>> Thanks,
>>>> Shawn
>>>>
>>>> [1] https://dl.acm.org/doi/10.1145/3802514.3809174
>>>>
>>>

Reply via email to