Skip to content

deps: move the compactor to iceberg-go v0.8.0 - #173

Merged
vyruss merged 6 commits into
mainfrom
deps/iceberg-go-0.8
Dec 4, 2026
Merged

vyruss merged 6 commits into
mainfrom
deps/iceberg-go-0.8

Conversation

@vyruss

@vyruss vyruss commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Moves the compactor's Go module (cmd/compactor) to iceberg-go v0.8.0, arrow-go v18.9.0 and pgx v5.13.0, the pgx version the archiver already uses. iceberg-go v0.8.0 does two jobs that the compactor did with its own code, so that code is removed:

  • cmd/compactor/flatwalk.go listed the table directory for orphan cleanup with one flat object list, because iceberg-go v0.7.0's directory walk failed with readdir: not implemented when an object sat at a directory path. The compactor now calls iceberg-go's maintenance.DeleteOrphanFiles, whose walk handles that object and lists under the table directory with a trailing slash, as vended credentials require.
  • The read-sort-write code in cmd/compactor/compact.go read each group of a table with coldfront.sort-key into memory, sorted it on that column and wrote it back. The compactor now passes a sort order to iceberg-go's table.ExecuteCompactionGroup (table.WithCompactionSortOrder), which sorts each group ascending with nulls last and keeps equal keys in read order, as the removed code did.

The compactor's non-test Go code loses 283 lines and gains 24.

Two behaviours change:

  • --orphans refuses a table whose gc.enabled property is false, as --expire-snapshots already does. ColdFront does not set the property.
  • A compaction or expiry commit that Lakekeeper rejects as conflicting is retried up to four times, where iceberg-go v0.7.0 did not retry.

The pull request also adds the changelog entry and a test for #170, a compaction that rewrites a data file larger than 128 MiB.

Checklist

  • The pull request links a tracking issue.
  • ./run-ci-local.sh passes (gofmt, golangci-lint, shellcheck, hadolint,
    actionlint, build, pg_regress, journey).
  • The change includes unit tests, written before the code, or the Testing
    section explains why it has none.
  • The change includes regression tests in extension/coldfront/test/, or
    the Testing section explains why it has none.
  • The Testing section notes any impact on the integration tests
    (ci/journey.sh and the CI matrix).
  • The change updates README.md and docs/, or the Notes for Reviewers
    explain why it needs no update.
  • The change adds no secrets, and the Risk section covers its security
    impact.
  • A bakery, mesh, or distributed change updates the TLA+ model and re-runs
    TLC (docs/formal/).
  • Author's AI review completed and findings addressed.
  • Commit messages are short and imperative.

Testing

  • Unit tests in cmd/compactor, each written before the code it covers:
    • Orphan cleanup runs against an S3 endpoint that the test serves. The endpoint holds an object at the data directory's path as well as objects under it, and it refuses a list outside the table directory. On iceberg-go v0.7.0 the test fails without the removed walk, and through that walk it finds the same two orphan files.
    • A data file that scan planning splits into several tasks is compacted at two target sizes, and every row stays. On iceberg-go v0.7.0 without the fix: rewrite data files with deleted rows in the compactor #170 fix, the test loses rows at one target and fails with delete data file paths must be unique at the other.
  • The existing sorted-rewrite tests pass unchanged on iceberg-go's sort.
  • ci/journey.sh runs compaction, the sorted rewrite, snapshot expiry and orphan deletion against Lakekeeper, and its stories pass unchanged. The orphan dry run in TC-133 reports the same candidate files on both versions. The vended backend runs orphan deletion under SeaweedFS STS credentials.
  • No pg_regress test: the extension is unchanged.

Risk

  • The pull request's checks run the new orphan walk against SeaweedFS only. GitHub runs the aws-vended and azure-vended lanes, which run it against AWS S3 and Azure ADLS Gen2, on main alone, so they first run it on the merge commit.

How to Revert

Revert the merge commit and rebuild the compactor. cmd/compactor/go.mod returns to iceberg-go v0.7.0. Tables that this version compacted stay valid, because each run commits an ordinary Iceberg rewrite or expiry snapshot.

Notes for Reviewers

  • The compactor's claim, commit and release sequence is unchanged, so the TLA+ model is unchanged and TLC was not re-run.
  • iceberg-go v0.8.0 plans a split data file as one task, but the compactor keeps its own whole-file pass. The groups that the compactor adds for files that delete files name need the pass, and iceberg-go v0.8.0 refuses a group task that does not cover its whole file.
  • README.md needs no update: it names no iceberg-go version.

@vyruss
vyruss requested a review from a team as a code owner December 3, 2026 15:00
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The compactor now uses the Iceberg compaction executor for sorted and unsorted groups. Orphan cleanup now uses the table maintenance package. Tests cover split-file row preservation and S3 orphan discovery.

Changes: Compactor updates

Layer / File(s) Summary
Group rewrite and row preservation
cmd/compactor/compact.go, cmd/compactor/compact_test.go, cmd/compactor/go.mod, cmd/compactor/merge_test.go, docs/architecture_vectors.md, docs/changelog.md
rewrite passes target file size to ExecuteCompactionGroup for all groups and adds an ascending identity sort order with nulls last for sorted tables. The custom sorted-group pipeline was removed. A test checks that compaction plans each file once and preserves every row from a split file. Dependency versions and compaction documentation were also updated.
Orphan cleanup
cmd/compactor/main.go, cmd/compactor/maintain.go, cmd/compactor/maintain_test.go, cmd/compactor/flatwalk.go, cmd/compactor/flatwalk_test.go, docs/changelog.md
Orphan processing passes the loaded table directly to deleteOrphans, which calls maintenance.DeleteOrphanFiles. The flat-walk implementation and its tests were removed. A dry-run S3 test expects two unreferenced objects. The changelog records the orphan-cleanup behavior for tables with gc.enabled=false.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other · Severity of issue fixed: Medium

Suggested reviewers: bonesmoses, susan-pgedge

Merge Risk: Minimal · up to 8b747 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: moving the compactor module to iceberg-go v0.8.0. The changeset updates cmd/compactor/go.mod to that version and replaces custom orphan-walk and sort code with iceberg…
Description check Passed The description states the purpose of the change. It names the iceberg-go, arrow-go, and pgx version bumps, the removal of flatwalk.go and the custom sort pipeline, the new orphan and compaction calls…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: moving the compactor module to iceberg-go v0.8.0. The changeset updates cmd/compactor/go.mod to that version and replaces custom orphan-walk and sort code with iceberg-go APIs, so the title matches the primary change.

Full details: Description check

Explanation

The description states the purpose of the change. It names the iceberg-go, arrow-go, and pgx version bumps, the removal of flatwalk.go and the custom sort pipeline, the new orphan and compaction calls, the gc.enabled check, the retry behaviour, and the added test for a file larger than 128 MiB. These match the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7013479 and 8b747a5.

Files ignored due to path filters: 1

  • cmd/compactor/go.sum is excluded by !**/*.sum
Files selected for processing: 11

  • cmd/compactor/compact.go
  • cmd/compactor/compact_test.go
  • cmd/compactor/flatwalk.go
  • cmd/compactor/flatwalk_test.go
  • cmd/compactor/go.mod
  • cmd/compactor/main.go
  • cmd/compactor/maintain.go
  • cmd/compactor/maintain_test.go
  • cmd/compactor/merge_test.go
  • docs/architecture_vectors.md
  • docs/changelog.md
Files with no reviewable changes: 3

  • cmd/compactor/flatwalk.go
  • cmd/compactor/flatwalk_test.go
  • cmd/compactor/main.go

Included review availability: This review used your included allowance. 7 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -25 complexity · 0 duplication

Metric Results
Complexity -25
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@bonesmoses bonesmoses left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical, but I recommend adding a note to the changelog that compaction or snapshot expiry has a new retry loop.

Otherwise approved.

@vyruss
vyruss merged commit b94a2a8 into main Dec 4, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants