Repository navigation
Support bearer-token authentication in BuilderRWBufferFromHTTP (attempt 2) - #115400
Conversation
…pt 2) Clone of #110313 on a fresh branch off current master — same changes, reconciled onto master. Opened because the original PR's sync pair got wedged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Workflow [PR], commit [3491b04] Summary: ✅
AI ReviewSummaryThis PR adds bearer-token support to PR Metadata
Findings
Final VerdictLLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 73/96 (76.04%) · Uncovered code |
| const std::string & method, | ||
| std::function<void(std::ostream &)> out_stream_callaback) | ||
| { | ||
| validateBearerToken(context, bearer_token); |
There was a problem hiding this comment.
This changes behavior for already-persisted Unity/Paimon databases, not just new CREATE DATABASE statements. Their bearer token is stored in metadata (catalog_credential for Unity, catalog_credential/PaimonToken in bearer mode), so an attached database that previously worked can now start throwing BAD_ARGUMENTS on first use if the synthetic Authorization header trips http_forbid_headers. ClickHouse usually keeps this kind of validation on the CREATE/ALTER path specifically to avoid retroactively rejecting old metadata; if this hardening is intended, it needs either a compatibility gate or a create-time validation path for newly created objects.
| auto context = DB::Context::createCopy(getContext().context); | ||
| context->makeQueryContext(); | ||
|
|
||
| /// Every bearer-token catalog path (Unity, and Paimon via HTTPBasedCatalogUtils) runs this |
There was a problem hiding this comment.
These tests still do not exercise the main regression the patch claims to fix. OneLakeCatalog already validated a pre-obtained token before this PR, and validateBearerToken only checks the helper in isolation. The changed contract is in BuilderRWBufferFromHTTP::createWithBearerToken: reusing one builder for multiple requests must not leak the previous Authorization header, and bearer/basic precedence must stay stable. Without a request-level test that reuses one builder across two calls, that behavior is still unproven and easy to regress silently.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units50 translation units recompiled, 328 s compile time in total, 50 of them have a recent master baseline. |
|
📊 Cloud Performance Report ✅ AI verdict: This PR only reworks DataLake REST-catalog bearer-token authentication (Unity/Paimon/OneLake) and the HTTP read buffer's Authorization handling — none of which is on the ClickBench query-execution path. The two flagged queries (Q30 +22.7%, Q31 +21.6%) both show essentially flat CPU time with the increase confined to wall clock, the signature of page-cache/IO variance rather than real extra work. The deterministic gate already held both within master's current-era variance band, and that call is correct and consistent with the diff. No action needed on these numbers. clickbenchFlagged queries (2 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
Recreated from #110313 with the same changes.
BuilderRWBufferFromHTTPhad no way to authenticate with a bearer token: callers spliced anAuthorization: Bearerentry into the header list themselves and had to remember not to pass HTTP Basic credentials at the same time, because both occupy the same header.createnow takes the credential directly, in three overloads: Basic credentials, a bearer token, or both — with a non-empty token taking precedence, so the either/or rule lives in one place instead of in every caller.createalso appends the bearer header to a local copy of the header list rather than mutating the builder, so a builder can be reused without carrying over a stale token.Every bearer-token call site of the class is migrated to the new overloads:
HTTPBasedCatalogUtilsandUnityCatalog: built the header by hand and passed never-used HTTP Basic credentials alongside; now callcreatewith the token.RestCatalog,OneLakeCatalog,BigLakeCatalog:getAuthHeadersnow returns anAuthHeaders(a bearer token plus extra headers). The bearer goes tocreate; only genuine extra headers (a user-suppliedauth_header,x-goog-user-project,User-Agent) stay in the header list.OneLakeCatalog's pre-obtained token also moved from a spliced header to the bearer.PaimonRestCatalog: thebearertoken provider (thedlfrequest-signing branch keeps its own signed headers).Out of scope — different transport (plain Poco requests or S3-client headers), not
BuilderRWBufferFromHTTP:OpenAIProvider,CloudJWTProvider, ArrowFlightAuthMiddleware, GCSdiskSettings.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Workflow [PR]
Sync PR [sync-upstream/pr/110313]
Version info
26.8.1.1702(included in26.8and later)