Core: Deleted rows reappear and filtered writes miss rows when binary or fixed partition summaries were written before 1.11.0
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #19056 de @karubian — cerrado sin fusionar
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with ManifestEvaluator, ManifestFileUtil.canContainAny, and the linked scan-planning call sites; the issue names these as places that trust manifest partition bounds. Compare each manifest's partition summary with its live entries, using the SQL query in the issue as a diagnostic starting point. Determine whether the repair belongs in RepairTable or rewrite_manifests, then verify repaired summaries cover their entries and filtered reads and writes preserve deleted rows.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Apache Iceberg version
1.12.0 (latest release)
Query engine
Spark
Please describe the bug 🐞
On a table partitioned by a binary or fixed column, Iceberg Java before 1.11.0 can write a manifest list partition summary whose bounds leave out the manifest's own partition values, #15128. #15127 fixed new writes in 1.11.0, but a snapshot keeps a manifest and its summary until a commit rewrites that manifest, and current releases still skip manifests by those bounds. #15128 shows a filtered read missing rows. On a delete manifest, a filtered scan plans the data file without its deletes, so deleted rows come back, and a filtered write can make that permanent.
On Spark 3.5.3 with a Hadoop catalog, the setup on Iceberg 1.10.1, then the session restarted on 1.12.0 on the same warehouse:
-- Iceberg 1.10.1
CREATE TABLE t (id bigint NOT NULL, data binary) USING iceberg PARTITIONED BY (data)
TBLPROPERTIES ('format-version' = '2', 'write.delete.mode' = 'merge-on-read');
INSERT INTO t VALUES (1, X'e3bcd1'), (2, X'e3bcd1');
INSERT INTO t VALUES (3, X'bcd1'), (4, X'bcd1');
DELETE FROM t WHERE id IN (1, 3); -- one delete manifest, summary [bcd1, e3bcd1]
DELETE FROM t WHERE data = X'bcd1'; -- a metadata delete rewrites it, summary [bcd1, bcd1d1]
-- Iceberg 1.12.0, same warehouse
SELECT id FROM t; -- 2
SELECT id FROM t WHERE data = X'e3bcd1'; -- 1, 2
UPDATE t SET id = id + 100 WHERE data = X'e3bcd1' AND id = 2; -- copy-on-write
SELECT id FROM t; -- 1, 102
The update's scan did not apply the delete, so it copied row 1 into the new data file, and row 1 is back for every reader; the commit then drops the delete as older than every live data file. With the setup on 1.12.0 every statement gives the right rows; a build of main, 2bd60a0, gives the same results as 1.12.0. Also on 1.12.0:
- On this table, a copy-on-write
DELETEorMERGEwith a condition ondataandrewrite_data_fileswithwhere => "data = X'e3bcd1'"andoptions => map('rewrite-all', 'true')bring row 1 back too, and a merge-on-readUPDATEwrites it back as row 101. An unfilteredrewrite_data_fileswithrewrite-allapplies the delete. - On the same table in format version 3, where 1.10.1 wrote the wrong summary in about half the runs, by the order of the deletion vectors in the manifest, the filtered read returns row 1, the filtered
rewrite_data_filesand copy-on-writeUPDATE,DELETEandMERGEbring it back, and a merge-on-readUPDATE,DELETEorMERGEadds a second deletion vector for the data file, after which unfiltered reads andrewrite_data_filesfail withCan't index multiple DVs, the state of #17206, reached here by one write with no concurrent writer. - In the data manifest shape of #15128, a filtered
DELETEorUPDATEsucceeds and changes nothing,MERGE ... WHEN NOT MATCHED THEN INSERTadds a duplicate row, andwriteTo(t).overwrite(...)or a dynamicINSERT OVERWRITEof the partition keeps the old rows. - PyIceberg 0.12.0 reads the v2 table and the data manifest table the same wrong way: the summaries are wrong for every reader that prunes by them.
Which tables: every release tested from 1.4.3 to 1.10.2 wrote such summaries for binary partitions, and 1.9.2 to 1.10.2 for fixed ones; on earlier releases the test could not commit a fixed partition value. String and uuid partitions, tested as controls, kept right summaries. A recorded bound takes the bytes of the next entry read when that value is no longer, so whether a summary goes wrong depends on the order and lengths of the values. Any commit that copies entries into a new manifest can write one: a metadata delete, an overwrite, a commit that removes files, or a manifest merge, which appends and row deltas do once a table has enough manifests. The partition fields at risk are identity on a binary or fixed column and truncate on a binary column; bucket on a binary column has int bounds and is not affected.
The summaries alone cannot tell a wrong bound from a right one; the entries can. This lists the live entries outside their manifest's bounds for a table whose first partition field is the binary one:
SET spark.sql.optimizer.nestedSchemaPruning.enabled = false; -- the manifests table cannot project one summary field
SELECT m.content, base64(e.data_file.partition.data) AS value,
m.partition_summaries[0].lower_bound AS lower, m.partition_summaries[0].upper_bound AS upper
FROM (SELECT input_file_name() AS manifest, status, data_file FROM t.entries) e
JOIN t.manifests m ON e.manifest = m.path
WHERE e.status < 2
AND (e.data_file.partition.data < unbase64(m.partition_summaries[0].lower_bound)
OR e.data_file.partition.data > unbase64(m.partition_summaries[0].upper_bound));
It flags the v2, v3 and data manifest tables written on 1.10.1, and none written on 1.12.0. It must not filter on the partition column, since metadata tables prune by the same summaries.
Where Iceberg Java trusts the bounds, which Manifest Lists requires to cover the manifest's values and Scan Planning lets readers skip by:
ManifestEvaluator, behind scan planning of data and delete manifests, DeleteFileIndex and BaseDistributedDataScan, metadata tables including thedata_fileslookup of #19035, row filter deletes and conflict validation.- ManifestFileUtil.canContainAny, behind partition drops and deletes of files that do not name their manifest, ManifestFilterManager.
Repair today, on 1.11.0 or later: rewrite_manifests writes right summaries for the manifests it rewrites, within the chosen spec. It skips a manifest that is the only one of its content when the target size asks for one manifest, RewriteManifestsSparkAction, as in this table. With writers paused, one run with commit.manifest.target-size-bytes set one byte below the smallest manifest's length rewrote the lone manifests of the v2 and data manifest tables with right summaries; then restore the property, since every commit reads it, and run rewrite_manifests again to merge what the first run split. The target applies to every content, so on a table whose manifests differ widely in size the first run can split the larger content into many manifests until the second run. The core RewriteManifests keeps delete manifests in its clustering rewrite. Repairing summaries cannot undo an incorrect data rewrite or restore deletes removed by its commit, and a v3 table with two deletion vectors for one data file needs a rollback.
I'd propose two changes that keep manifest pruning on healthy tables. rewrite_position_delete_files should look up the live data files of a partition without filtering on binary and fixed partition fields, since it drops the deletes of a live data file without any filter on the partition column, #19035; #19036 does this for binary and fixed fields. And a repair should check each manifest's partition summary against its entries, rewrite the manifests whose summary leaves out their values, and report them. It could be a mode of the RepairTable action from #17399, whose Spark implementation in #17622 repairs only file metrics, or a rewrite_manifests option that rewrites every manifest of each spec and content. A repair gives every reader, PyIceberg included, right summaries from the snapshot it commits, as long as the table's writers are on 1.11.0 or later; after the run above, the filtered read on 1.12.0 returned the right row. Until a table is repaired, filtered scans and writes on it keep the wrong results above; engines that plan with Iceberg Java, such as Flink and Trino, and equality deletes go through the same code, though they were not run here. Stopping ManifestEvaluator and ManifestFileUtil.canContainAny from comparing values with binary and fixed bounds fixes every case above, but drops manifest pruning on those fields for every table, healthy ones too, so I closed #19056. Would RepairTable or rewrite_manifests be the better home for the repair?
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- Lenguaje dominante
- Java
- Estrellas
- 9.4k
- Forks
- 3.7k
- Merge medio
- 2 d 15 h
- PR fusionados (30 d)
- 169
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/iceberg
-
Spark: Test INSERT targets with computed IDENTIFIER expressionsPosiblemente ocupada @shivadarshan-devadiga la tomó hace 8 días. Abiertoimprovement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
[Core] TestAvroPartitionStatsHandler fails on Windows due to unclosed partition statistics scanPosiblemente ocupada @Ankitkj1999 la tomó hace 10 días. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Flink: JdbcLockFactory concurrent lock-table creation can fail with "table already exists" and restart the jobPosiblemente ocupada @adiranjan25 la tomó hace 17 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/iceberg#18797 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tablesPosiblemente ocupada @yusufyildiz34 la tomó hace 29 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/iceberg#18632 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToListPosiblemente ocupada @mohamed-elbrik la tomó hace 34 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/iceberg
Issues similares
-
hermes-queue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
chrisalunlloyd2-sudo/mindpalace#430 ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
unitycatalog/unitycatalog#2363 ·
Los mantenedores suelen responder en 1 día
-
area: editor P3 type: feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
halisonworks/mod-codeling#290 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
CVE-2026-63402 i18nextAbiertoarea/dependencies area/dependencies/js backport/26.6 backport/26.8 kind/cve severity/medium source/scan-dependencies status/triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días