fix(activation): preload httpfs + S3 secret before iceberg LOAD#647
Merged
Conversation
Iceberg-only tenant activation (no DuckLake) hangs ~60s at
LoadExtensions("iceberg") and trips the activate-tenant deadline. The
iceberg + DuckLake ("both") path through the same code completes the
iceberg LOAD in ~120ms.
Why the difference: "both" runs AttachDuckLake first, which auto-loads
httpfs and creates a TYPE S3 secret (ducklake_s3) for the warehouse data
plane. By the time AttachIcebergCatalog runs, iceberg's LOAD-time init
finds httpfs already loaded and an S3 secret on hand. The iceberg-only
path skips AttachDuckLake — so when LoadExtensions("iceberg") runs,
iceberg's init has no httpfs loaded and no S3 secret to discover, and
falls back to AWS-SDK credential discovery. That probes the EC2 instance
metadata service at 169.254.169.254, which the cluster-wide
duckgres-worker-egress policy explicitly denies (defense-in-depth so
workers can't escalate via node IRSA). The probe blocks until the
activate-tenant deadline kills the worker, with no Go log to surface it.
Replicate the DuckLake setup minimally in attachLakekeeperCatalog and
attachS3TablesIcebergCatalog: LoadExtensions("httpfs") (bundled, no-op
cost) and create the iceberg_sigv4 / Iceberg S3 secret BEFORE
LoadExtensions("iceberg"). With the secret already registered at LOAD
time, the extension takes the configured-credential path and skips IMDS
discovery.
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.
Problem
Iceberg-only tenant activation (no DuckLake) hangs ~60s at
LoadExtensions("iceberg")and trips the activate-tenant deadline. Iceberg + DuckLake ("both") activates through the same code in ~120ms.Why
Loki worker logs (
ben-ext-bothon the current build):vs
ben-ext-ice:The difference is what runs before
LoadExtensions("iceberg"):AttachDuckLakefirst. That auto-loadshttpfsand creates a TYPE S3 secret (ducklake_s3) for the DuckLake data plane. By the timeAttachIcebergCatalogruns, iceberg's LOAD-time init findshttpfsloaded and an S3 secret on hand.AttachDuckLake. WhenLoadExtensions("iceberg")runs there's nohttpfsloaded and no S3 secret to discover, so iceberg's init falls back to AWS-SDK credential discovery → IMDS probe at 169.254.169.254. The cluster-wideduckgres-worker-egressegressDenyblock on169.254.0.0/16(defense-in-depth so workers can't escalate via the node IRSA) drops the probe, which blocks until the activate-tenant deadline kills the worker — with no Go-level log, which is why the stall is invisible in plain worker output.Fix
Mirror the DuckLake setup minimally in both iceberg attach paths:
With a TYPE S3 secret already registered at LOAD time, iceberg's init takes the configured-credential path and skips IMDS discovery. Activation completes within the deadline.
Test plan (mw-dev after deploy)
ben-ext-ice/ben-cnpg-ice/ben-aur-iceall activate within the deadline.SELECT 1succeeds;CREATE TABLE iceberg.public.<t> / INSERT / SELECTround-trips.🤖 Generated with Claude Code