Add control plane / data plane architecture#146
Merged
fuziontech merged 3 commits intomainfrom Feb 6, 2026
Merged
Conversation
…ents Implement a multi-process architecture that splits duckgres into a control plane (connection management, routing) and data plane (pool of long-lived DuckDB worker processes). This enables zero-downtime deployments, cross-session DuckDB cache reuse, and rolling worker updates. Key components: - gRPC-based worker management (Configure, Health, Drain, Shutdown) - Unix socket FD passing via SCM_RIGHTS for TCP connection handoff - Least-connections load balancing across worker pool - Graceful control plane handover via listener FD transfer - Rolling worker updates triggered by SIGUSR2 - Health check loop with automatic worker restart New CLI modes: --mode control-plane | worker | standalone (default) Standalone mode (existing behavior) is completely unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
Author
Code reviewFound 2 issues:
Lines 151 to 196 in db091d4 Contrast with the monitoring goroutine in Lines 130 to 141 in db091d4 Consumers that block on Lines 353 to 361 in db091d4 Lines 443 to 448 in db091d4
duckgres/controlplane/worker.go Lines 465 to 476 in db091d4 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
ConnectExistingWorker never closed the done channel, causing ShutdownAll and RollingUpdate to always hit their timeout for handed-over workers. Add a health-check monitoring goroutine. CancelQuery killed the entire session instead of just the running query. Use the per-session minServer.CancelQuery() to cancel only the in-flight query, matching standalone mode behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
247e114 to
55830ca
Compare
- Add _ = prefix to all unchecked .Close() return values (errcheck) - Remove unused nextWorker field from WorkerPool (unused) - Remove unused activeQueriesMu field from Worker (unused) - Remove unused loadExtensions/attachDuckLake method wrappers (unused) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55830ca to
9b4c408
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
Architecture
New packages
controlplane/- Control plane, worker pool, handover, worker processcontrolplane/proto/- gRPC service definition (6 RPCs: Configure, AcceptConnection, CancelQuery, Drain, Health, Shutdown)controlplane/fdpass/- Unix socket FD passing via SCM_RIGHTSModified packages
server/- ExtractedCreateDBConnection,LoadExtensions,AttachDuckLakeas standalone functions; addedexports.gofor cross-package access to protocol functionsmain.go- Added--modeflag routing (standalone/control-plane/worker)Usage
Test plan
go buildsucceedsgo test ./...)go test ./controlplane/fdpass/)\dt,\d, queries, COPY, prepared statements🤖 Generated with Claude Code