Skip to content

[0.9.x][Hotfix] Force ReachableFileCleanup when snapshots exist outside main ancestry (backport #4231)#4241

Open
j1wonpark wants to merge 1 commit into
apache:0.9.xfrom
j1wonpark:backport-4231-0.9.x
Open

[0.9.x][Hotfix] Force ReachableFileCleanup when snapshots exist outside main ancestry (backport #4231)#4241
j1wonpark wants to merge 1 commit into
apache:0.9.xfrom
j1wonpark:backport-4231-0.9.x

Conversation

@j1wonpark
Copy link
Copy Markdown
Contributor

Backport of #4231 to 0.9.x

This is a clean cherry-pick of #4231 (d8f37934) onto the 0.9.x release branch.

Why are the changes needed?

#4231 is a data-loss fix. Iceberg's auto-selected IncrementalFileCleanup
can silently truncate its ancestor walk when a parent snapshot is missing, and
delete data files that the current snapshot still references. This PR forces the
safe ReachableFileCleanup only when snapshots exist outside the main ancestry;
healthy tables are unchanged.

The fix is currently on master only. Since 0.9.0 is still in the release-candidate
stage, including this fix in the release avoids shipping a known data-loss path.

Brief change log

  • Force ReachableFileCleanup in IcebergTableMaintainer when snapshots exist
    outside the main ancestry (ReachableFileCleanupBridge exposes the safe path).
  • Add TestExpireSnapshotsKeepReferencedFiles covering the regression.

Verification

cc the 0.9.0 release manager — flagging for inclusion in the next RC.

Original PR: #4231

… ancestry (apache#4231)

[optimizer] Force reachable cleanup when snapshots exist outside main ancestry

Iceberg's auto-selected IncrementalFileCleanup can silently truncate its
ancestor walk when a parent snapshot is missing, deleting data files the
current snapshot still references. Force the safe ReachableFileCleanup only
when snapshots exist outside the main ancestry; healthy tables are unchanged.

Signed-off-by: Jiwon Park <jpark92@outlook.kr>
(cherry picked from commit d8f3793)
@github-actions github-actions Bot added the module:ams-server Ams server module label Jun 2, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.90%. Comparing base (19d6a71) to head (d0c29a9).
⚠️ Report is 9 commits behind head on 0.9.x.

Files with missing lines Patch % Lines
...ats/iceberg/maintainer/IcebergTableMaintainer.java 0.00% 19 Missing ⚠️
...org/apache/iceberg/ReachableFileCleanupBridge.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              0.9.x    #4241      +/-   ##
============================================
+ Coverage     29.80%   29.90%   +0.09%     
- Complexity     4285     4319      +34     
============================================
  Files           677      678       +1     
  Lines         54988    55052      +64     
  Branches       7012     7032      +20     
============================================
+ Hits          16391    16465      +74     
+ Misses        37376    37354      -22     
- Partials       1221     1233      +12     
Flag Coverage Δ
core 29.90% <0.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@j1wonpark
Copy link
Copy Markdown
Contributor Author

j1wonpark commented Jun 2, 2026

@czy006 @xxubai could you please take a look at this backport?

#4231 is a data-loss fix that is currently on master only. The cherry-pick is clean (no conflicts) and the code/tests are identical to the already-merged #4231.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ams-server Ams server module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants