Repository navigation
Fix crash on invalid Iceberg manifest-list entries - #122829
Conversation
|
Workflow [PR], commit [0f11646] Summary: ✅
AI ReviewSummaryThis PR hardens one Iceberg manifest-list crash path by rejecting non-record Avro roots and validating several required fields before copying them into a rewritten manifest list. The remaining blocker is that the carry-forward path still copies the rest of each Findings❌ Blockers
Tests
Final VerdictChanges requested. The crash is fixed for one malformed-root case, but the carry-forward rewrite path can still emit invalid manifest lists because optional and versioned fields are copied without re-encoding against the destination schema. LLVM Coverage ReportMeasured on commit 0f11646.
Changed lines: Changed C/C++ lines covered: 35/58 (60.34%) · Uncovered code |
| Iceberg::f_added_snapshot_id, | ||
| static_cast<int>(old_added_snapshot_id_entry.type())); | ||
|
|
||
| new_entry.field(f_added_snapshot_id) = old_added_snapshot_id_entry.value<Int64>(); |
There was a problem hiding this comment.
The carry-forward path still bypasses the target manifest-list schema for every field copied through add_field_to_datum. avro::GenericRecord assignment does not validate the source GenericDatum against new_entry's field schema, and avro::GenericWriter serializes according to the copied datum's own isUnion() / type() rather than the destination field type.
That breaks a real compatibility path we already support: StatelessMetadataFileGetter explicitly handles tables whose Iceberg format-version was upgraded externally from v1 to v2 while older v1 manifest lists are still referenced. In that case added_files_count / existing_* / deleted_* / *_rows_count arrive here as ["null", T] unions, but this code copies them straight into a v2 record that declares plain int / long, so the rewritten manifest list is emitted with the old union branch tag and becomes invalid. The same blind copy also propagates malformed content / sequence_number / partitions payloads instead of rejecting them, so the "validate invalid manifest-list entries during writes" contract is still open for those fields.
Please re-materialize carried-forward fields against new_entry's schema instead of copying GenericDatum wholesale, e.g. with a schema-aware helper in the style of setVersionedField that unwraps nullable unions and throws on any source type that cannot be represented by the target field.
There was a problem hiding this comment.
A separate issue in the same file, can be fixed later.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes5 object files changed (+29.03 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units8 translation units recompiled, 34 s compile time in total, 8 of them have a recent master baseline. |
Backport #122829 to 26.9: Fix crash on invalid Iceberg manifest-list entries
Backport #122829 to 26.8: Fix crash on invalid Iceberg manifest-list entries
Backport #122829 to 26.7: Fix crash on invalid Iceberg manifest-list entries
…fest-list entries
Cherry pick #122829 to 26.3: Fix crash on invalid Iceberg manifest-list entries
Backport #122829 to 26.3: Fix crash on invalid Iceberg manifest-list entries
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix validation of Iceberg manifest-list entries during writes.
Workflow [PR]
Sync PR [sync-upstream/pr/122829]
Version info
26.10.1.1047-master(included in26.10and later)26.9.7.8,26.8.15.15,26.7.19.6,26.3.40.9