Skip to content

refactor(api)!: extract custom append compaction into AppendFileCompaction - #585

Merged
lucasfang merged 2 commits into
apache:mainfrom
lxy-9602:refactor-compact-file
Nov 23, 2026
Merged

lucasfang merged 2 commits into
apache:mainfrom
lxy-9602:refactor-compact-file

Conversation

@lxy-9602

@lxy-9602 lxy-9602 commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Purpose

Linked issue: close #571

Move custom file compaction out of the public FileStoreWrite interface into AppendFileCompaction::Execute.

Each call creates a dedicated batch writer, restores the latest snapshot, compacts the selected files, and closes the writer before returning commit messages. Callers commit or abort these messages through FileStoreCommit.

Reuse the existing append writer and compaction manager while removing the state flags and guards that prevent mixing custom compaction with regular writes.

Tests

  • Migrate custom compaction tests to the new API.
  • Cover invalid inputs and unsupported table configurations.
  • Verify returned files survive writer closure and can be aborted.
  • Verify a subsequent call restores newly committed files, merges two files, and produces messages that can be committed.
  • Retain integration coverage for non-contiguous inputs, deletion vectors, fully deleted files, and query results after commit.

API and Format

Replace public FileStoreWrite::CompactFiles with AppendFileCompaction::Execute. Existing callers must migrate to the new synchronous API.

No storage format or protocol changes.

Documentation

Update the write API reference and custom compaction guide with the new API and lifecycle.

Clarify that compactions within the same partition/bucket must be serialized when deletion vectors are enabled. Without deletion vectors, compactions with disjoint inputs may run concurrently.

Generative AI tooling

Generated-by: OpenAI Codex (GPT-6)

@lxy-9602 lxy-9602 changed the title refactor(api)!: extract custom append compaction into AppendFileCompa… refactor(api)!: extract custom append compaction into AppendFileCompaction Nov 21, 2026
@lucasfang

Copy link
Copy Markdown
Member

[P2] Preserve catalog metadata access in the new compaction API

The previous API allowed callers to create a writer with WithCatalog() and compact a specific set of files through CompactFiles(). The new entry point creates its own context without a catalog and provides no way to pass one. For an append table whose current schema is available only through the catalog, writer creation now fails with not found latest schema in branch main. The existing Compact() API cannot replace this functionality because it does not accept a file selection. Could we accept a catalog/identifier or an existing context here to preserve this use case?

@lucasfang lucasfang 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.

LGTM

@lucasfang
lucasfang merged commit 0f1e24e into apache:main Nov 23, 2026
18 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.

[Feature] Support custom compaction for bucketed append tables

2 participants