Hi all, Thanks, Huaxin, for laying out the three kinds of DV conflicts.
For Phase 2, concurrent compaction against DELETE/UPDATE, I explored a way to do this without persisting a map. EJ mentioned that Delta resolves these conflicts in both directions <https://github.com/delta-io/delta/issues/7360>, and uses row tracking for rewrites that reorder rows. I tried the same approach on Iceberg using v3 row lineage, and I think it can cover Phase 2 without a spec change. V3 already requires a rewrite to copy each row's _row_id into the new file. So when a compaction replaces a file, a DELETE planned against the old file can find its rows again by ID. It reads _row_id from the files the compaction added, writes DVs for those files, and validates again from the compaction's snapshot. I wrote a small Spark 4.2 test against main <https://github.com/anuragmantri/iceberg/blob/row-lineage-translation-poc/spark/v4.2/spark/src/test/java/org/apache/iceberg/spark/actions/TestRowLineageDeleteTranslation.java> to check this. It works after bin-pack, sort and z-order compactions. I haven't measured performance yet, though. Translation would run before the checks in #17754 <https://github.com/apache/iceberg/pull/17754> and #18603 <https://github.com/apache/iceberg/pull/18603>, so those still apply to the compaction's output files. On Amogh's suggestion, +1 to re-plan and retry each file group in Spark first. It's an implementation change that can start right away. The row-lineage work is independent of it, though. Re-plan and retry shrinks the compaction's window, but it can't help when a delete lands during a rewrite, and it doesn't help a DML that commits after a compaction. Both of those still need translation, so the two can be done in parallel. For this proposal, here is what I suggest we proceed with: - For Phase 1, when the compaction commits second, we use an in-memory map for bin-pack, and maybe row lineage for sort, z-order and sorted tables, where a map doesn't stay small. - For Phase 2, when the DML commits second, the DML translates its DVs by _row_id during RowDelta validation, with no spec change. If that isn't fast enough, we can look at persisting the maps and changing the spec. - We measure both with the metrics Amogh listed, and add DML commit success rate and wasted DML work. I connected with Shwan about this. If you all agree with this plan, we can update the design doc. Thanks, Anurag >
