refactor(server): move DuckLakeConfig + migration into server/ducklake#480
Merged
fuziontech merged 1 commit intomainfrom May 1, 2026
Merged
refactor(server): move DuckLakeConfig + migration into server/ducklake#480fuziontech merged 1 commit intomainfrom
fuziontech merged 1 commit intomainfrom
Conversation
This was referenced Apr 30, 2026
…e package
Step 1.5 of the binary-split plan. The migration / backup helpers in
server/ducklake_migration.go are already DuckDB-free at the import level
(they use pgx against the tenant metadata Postgres) but they live in the
same package as server.go, which imports duckdb-go. The control plane is
forced to transitively link libduckdb just to call CheckMigrationVersion.
This PR carves the DuckLake-specific code into a new server/ducklake
package with no duckdb-go dependency:
- server/ducklake/config.go — Config struct (was server.DuckLakeConfig)
- server/ducklake/migration.go — migration check, backup, ATTACH builders
- server/ducklake/migration_test.go — moved tests + the delta-catalog tests
that were under server/ducklake_test.go
Public symbols are renamed to drop the now-redundant DuckLake prefix:
server.DefaultDuckLakeSpecVersion → ducklake.DefaultSpecVersion
server.CheckAndBackupDuckLakeMigration → ducklake.CheckAndBackupMigration
server.CheckDuckLakeMigrationVersion → ducklake.CheckMigrationVersion
server.BackupDuckLakeMetadata → ducklake.BackupMetadata
server.DefaultDeltaCatalogPath → ducklake.DefaultDeltaCatalogPath
A few previously private helpers are now exported because they cross the
new package boundary:
ensureDuckLakeMigrationCheck → ducklake.EnsureMigrationCheck
duckLakeMigrationNeeded → ducklake.MigrationNeeded
duckLakeMigrationCheckedVersion → ducklake.MigrationCheckedVersion
buildDuckLakeAttachStmt → ducklake.BuildAttachStmt
buildDeltaCatalogAttachStmt → ducklake.BuildDeltaAttachStmt
deltaCatalogPath → ducklake.DeltaCatalogPath
A new ducklake.MigrationCheckError accessor replaces a direct read of the
private migrationState map from server.go's AttachDuckLake path.
To avoid touching the dozens of references to server.DuckLakeConfig across
the repo in this PR, server keeps a `type DuckLakeConfig = ducklake.Config`
alias and re-exports DefaultDuckLakeSpecVersion as a const. Callers that
already needed to be updated (control plane, config_resolution, server's
internal callers in server.go / checkpoint.go / querylog.go) now use
ducklake.* directly. Remaining server.DuckLakeConfig usages are in struct
field types only — those will move to ducklake.Config in PR #2 as part of
the larger server/ split.
Verified:
- go build ./... — clean
- go build -tags kubernetes ./... — clean
- go test -short ./server/ducklake/... ./server/... ./controlplane/... ./
— all green (pre-existing testcontainer failures in admin/ unrelated)
- go list -deps ./server/ducklake | grep duckdb — empty (no duckdb-go)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fbe9491 to
dd4d1e2
Compare
5 tasks
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DuckLakeConfigand the entireducklake_migration.gofile out ofserver/and into a newserver/ducklake/package with zeroduckdb-godependencygo list -deps ./server/ducklake | grep duckdbreturns emptyDuckLakeprefix; some previously-private helpers exported because they cross the new package boundarytype DuckLakeConfig = ducklake.Configleft inserver/so the dozens ofserver.DuckLakeConfigfield types compile unchangedWhy
The migration check uses
pgxagainst the tenant's metadata Postgres — no DuckDB execution at all. But because the migration code lived in the same Go package asserver.go(which importsduckdb-go), the control plane was forced to transitively link libduckdb just to callCheckMigrationVersion/BackupMetadata. Carving out theducklakesubpackage gives the CP a callable migration API without DuckDB linkage.Renames
Public, drops
DuckLakeprefix (the package name now supplies the context):server.DefaultDuckLakeSpecVersionducklake.DefaultSpecVersionserver.CheckAndBackupDuckLakeMigrationducklake.CheckAndBackupMigrationserver.CheckDuckLakeMigrationVersionducklake.CheckMigrationVersionserver.BackupDuckLakeMetadataducklake.BackupMetadataserver.DefaultDeltaCatalogPathducklake.DefaultDeltaCatalogPathNewly exported (cross the package boundary):
ensureDuckLakeMigrationCheckducklake.EnsureMigrationCheckduckLakeMigrationNeededducklake.MigrationNeededduckLakeMigrationCheckedVersionducklake.MigrationCheckedVersionbuildDuckLakeAttachStmtducklake.BuildAttachStmtbuildDeltaCatalogAttachStmtducklake.BuildDeltaAttachStmtdeltaCatalogPathducklake.DeltaCatalogPathNew:
ducklake.MigrationCheckError(connStr) errorreplaces a direct read of the privatemigrationStatesync.Map fromserver.go'sAttachDuckLake.Compatibility shim
server/server.gokeeps two aliases to avoid touching everyserver.DuckLakeConfigreference in this PR:The remaining
server.DuckLakeConfigreferences are struct field types (e.g.cfg.DuckLake DuckLakeConfig) — those will be migrated toducklake.Configas part of PR #2's largerserver/split. The alias is purely a transitional measure.Test plan
go build ./...cleango build -tags kubernetes ./...cleango test -short ./server/ducklake/... ./server/... ./controlplane/... ./— all greengo test -short -tags kubernetes ./controlplane/...— green except pre-existing testcontainer Postgres failures incontrolplane/admin/(unrelated, requires Docker)go list -deps ./server/ducklake | grep duckdbreturns empty (the load-bearing check)Stack
arrowmapserver/ducklakeserver/split intoserver/wire,server/exec,server/flight; rewireserver.DuckLakeConfigcallers toducklake.Configdirectly; add CI guard that fails the build ifcmd/duckgres-controlplaneever linksduckdb-gocmd/duckgres-controlplaneandcmd/duckgres-worker🤖 Generated with Claude Code