Skip to content

fix(activation): preload httpfs + S3 secret before iceberg LOAD#647

Merged
benben merged 1 commit into
mainfrom
ben/iceberg-only-preload-httpfs
Jun 1, 2026
Merged

fix(activation): preload httpfs + S3 secret before iceberg LOAD#647
benben merged 1 commit into
mainfrom
ben/iceberg-only-preload-httpfs

Conversation

@benben
Copy link
Copy Markdown
Member

@benben benben commented Jun 1, 2026

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-both on the current build):

step=count-catalogs                 elapsed=107ns
step=load-iceberg-extension         elapsed=1.4ms
"Loaded extension." extension=iceberg          ←  ~121ms after step start
step=create-s3-data-secret          elapsed=122ms
…
"Attached Iceberg catalog successfully."

vs ben-ext-ice:

step=count-catalogs                 elapsed=164ns
step=load-iceberg-extension         elapsed=2.0ms
… (no further activity for ~60s) …
"Shutting down DuckDB service..."

The difference is what runs before LoadExtensions("iceberg"):

  • "both" runs AttachDuckLake first. That auto-loads httpfs and creates a TYPE S3 secret (ducklake_s3) for the DuckLake data plane. By the time AttachIcebergCatalog runs, iceberg's LOAD-time init finds httpfs loaded and an S3 secret on hand.
  • iceberg-only skips AttachDuckLake. When LoadExtensions("iceberg") runs there's no httpfs loaded 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-wide duckgres-worker-egress egressDeny block on 169.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:

LoadExtensions(db, []string{"httpfs"})           // bundled, ~ms
db.Exec(iceberg.BuildIcebergSecretStmt(...))     // TYPE S3 secret
LoadExtensions(db, []string{"iceberg"})          // now skips IMDS, ~120ms

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-ice all activate within the deadline.
  • Iceberg-only SELECT 1 succeeds; CREATE TABLE iceberg.public.<t> / INSERT / SELECT round-trips.
  • "both" combos remain green.

🤖 Generated with Claude Code

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.
@benben benben merged commit 144d343 into main Jun 1, 2026
22 checks passed
@benben benben deleted the ben/iceberg-only-preload-httpfs branch June 1, 2026 13:55
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.

1 participant