fix(controlplane): force DuckLake transpile mode in multitenant remote backend#550
Merged
fuziontech merged 1 commit intomainfrom May 7, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a multitenant control-plane issue where DuckLake-specific SQL transpilation was not being enabled (because DuckLake.MetadataStore is intentionally empty globally in MTCP), causing unsupported DDL like ALTER TABLE … ADD PRIMARY KEY to reach DuckDB/DuckLake workers and fail.
Changes:
- Add
server.Config.AlwaysDuckLaketo force DuckLake transpiler mode even when the global metadata store is empty. - Enable
AlwaysDuckLakeautomatically in the control plane whenworker_backend=remote. - Extend
TestTranspile_DDL_NoOpsto cover additionalALTER TABLE ... ADD {PRIMARY KEY|UNIQUE|FOREIGN KEY}forms (including the Fivetran-prefixed variant).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
transpiler/transpiler_test.go |
Expands DDL no-op test cases to include bare constraint-add forms seen in real client traffic. |
server/server.go |
Introduces AlwaysDuckLake configuration flag on the server config struct. |
server/conn.go |
Forces transpiler DuckLake mode when either a metadata store is configured or AlwaysDuckLake is set. |
controlplane/control.go |
Sets AlwaysDuckLake=true automatically for remote (multitenant) worker backend mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
…e backend Sessions on the multitenant control plane are always backed by DuckLake workers, but the per-org metadata store comes from configstore so the global server.Config.DuckLake.MetadataStore stays empty. The transpiler was gated on that field alone, so the DDL transform never registered in MTCP — meaning Fivetran's ALTER TABLE ... ADD PRIMARY KEY (and ON CONFLICT, DuckLake-aware pg_catalog/info_schema rewrites) flowed straight through to the worker, which rejects them with "Adding indexes or constraints is not supported in DuckLake". Add server.Config.AlwaysDuckLake and set it from the remote-backend control plane. Tests cover the bare ADD PRIMARY KEY / UNIQUE / FK forms (the existing test only exercised the named-constraint path). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
765acf1 to
b35fb1a
Compare
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
server.Config.DuckLake.MetadataStore(per-org stores live in configstore), so the transpiler was running withDuckLakeMode: false. The DDL transform never registered, and Fivetran'sALTER TABLE … ADD PRIMARY KEY ("id")flowed straight through to the worker, which rejected it withNot implemented Error: Adding indexes or constraints is not supported in DuckLake.server.Config.AlwaysDuckLakeand set it from the remote-backend control plane so DuckLake-aware transforms (DDL stripping, ON CONFLICT, pg_catalog/information_schema rewrites) run on every session.TestTranspile_DDL_NoOpswith the bareADD PRIMARY KEY/ADD UNIQUE/ADD FOREIGN KEYforms; the existing case only covered the named-constraint variant.Why this only bit MTCP and not single-tenant
Single-tenant deployments set
DUCKGRES_DUCKLAKE_METADATA_STOREglobally, soDuckLakeModewas already true. MTCP doesn't (each org has its own store), so the gate was always false there.Test plan
go test ./transpiler/... ./server/... ./controlplane/...go build ./...andgo build -tags kubernetes ./...posthog_data_import— confirmALTER TABLE … ADD PRIMARY KEYnow no-ops instead of erroring.🤖 Generated with Claude Code