Skip to content

[SNOW-3249917] JDBC removal Step 11a (part 2): Replicate HttpUtil, swap callers#1144

Merged
sfc-gh-ggeng merged 3 commits intomasterfrom
jdbc-removal-step11a-httputil
Apr 7, 2026
Merged

[SNOW-3249917] JDBC removal Step 11a (part 2): Replicate HttpUtil, swap callers#1144
sfc-gh-ggeng merged 3 commits intomasterfrom
jdbc-removal-step11a-httputil

Conversation

@sfc-gh-ggeng
Copy link
Copy Markdown
Contributor

@sfc-gh-ggeng sfc-gh-ggeng commented Apr 6, 2026

Summary

Replicate JDBC's HttpUtil as JdbcHttpUtil (avoids name collision with ingest's existing HttpUtil), swap all callers, and replicate SFTrustManager + dependencies so OCSP verification works from the start.

17 files changed, +3810/-52

New files — HTTP infrastructure

  • JdbcHttpUtil (1146 lines) — replicated from JDBC's HttpUtil. HTTP client creation, proxy configuration, request execution
  • SnowflakeMutableProxyRoutePlanner — proxy route planner for Apache HttpClient
  • AttributeEnhancingHttpRequestRetryHandler — HTTP request retry handler with context attributes

New files — OCSP trust manager + dependencies

  • SFTrustManager (1689 lines) — SSL trust manager for OCSP certificate verification
  • FileCacheManager — OCSP response cache
  • OCSPTelemetryData — OCSP telemetry events
  • Constants — shared constants
  • HexUtil — hex encoding utility

Caller swaps

  • RestRequest: swap FQN net.snowflake.client.core.HttpUtilJdbcHttpUtil
  • TelemetryClient: replace HttpUtil.executeGeneralRequest()JdbcHttpUtil
  • SnowflakeGCSClient: replace HttpUtil.getHttpClient*() and RestRequest FQN refs → replicated versions
  • SnowflakeAzureClient: swap setSessionlessProxyForAzure static import → JdbcHttpUtil

Updated files

  • FileUtil — additional methods needed by FileCacheManager
  • IngestSSLConnectionSocketFactory — use replicated SFTrustManager
  • S3HttpUtil — use replicated utilities
  • StorageClientUtil — add systemGetEnv method

Stacked on #1143.

Replication Verification Diff Report

All classes are line-by-line replications of JDBC v3.25.1 sources. Common permitted mechanical differences across all files:

  • Package declaration changed to net.snowflake.ingest.streaming.internal.fileTransferAgent
  • SFLogger/SFLoggerFactory → ingest's replicated versions in log subpackage
  • @SnowflakeJdbcInternalApi annotations removed
  • Same-package types — imports removed
  • Replication header comments added

AttributeEnhancingHttpRequestRetryHandler

JDBC source : net/snowflake/client/core/AttributeEnhancingHttpRequestRetryHandler.java @ v3.25.1

Unexpected differences: NONE

JdbcHttpUtil (JDBC: HttpUtil)

JDBC source : net/snowflake/client/core/HttpUtil.java @ v3.25.1

Permitted differences (mechanical):

  • Class renamed HttpUtilJdbcHttpUtil (all self-references updated)
  • 17 import substitutions (SFLogger, StorageClientUtil, OCSPMode, SFSessionProperty, etc.)
  • SFSSLConnectionSocketFactoryIngestSSLConnectionSocketFactory
  • SnowflakeDriver.implementVersionSnowflakeDriverConstants.implementVersion
  • 4x @SnowflakeJdbcInternalApi annotations removed

Unexpected differences:

  • SystemUtil.convertSystemPropertyToIntValue inlined as local method (lines 1134-1156). Safe: body matches JDBC SystemUtil.java @ v3.25.1 verbatim.
  • SessionUtil.isNewRetryStrategyRequest inlined as local method (lines 1158-1186). Safe: body matches JDBC SessionUtil.java @ v3.25.1 verbatim. All 5 path constants match (/session/v1/login-request, /session/authenticator-request, /session/token-request, /api/v1/authn, /sso/saml).

SnowflakeMutableProxyRoutePlanner

JDBC source : net/snowflake/client/core/SnowflakeMutableProxyRoutePlanner.java @ v3.25.1

Unexpected differences: NONE

SFTrustManager

JDBC source : net/snowflake/client/core/SFTrustManager.java @ v3.25.1

Permitted differences (mechanical):

  • 7 import substitutions (StorageClientUtil, SFLogger, SFPair, OCSPMode, etc.)
  • Same-package types (OCSPErrorCode, DecorrelatedJitterBackoff, FileCacheManager, TelemetryService) — imports removed
  • Line count difference (1655 → 1690) entirely due to blank lines from google-java-format

Unexpected differences:

  • HttpUtil.SFConnectionSocketFactoryJdbcHttpUtil.SFConnectionSocketFactory (line 597). Safe: expected rename from HttpUtil → JdbcHttpUtil.

Constants

JDBC source : net/snowflake/client/core/Constants.java @ v3.25.1

Permitted differences (mechanical):

  • SnowflakeUtil.systemGetPropertyStorageClientUtil.systemGetProperty

Unexpected differences: NONE

FileCacheManager

JDBC source : net/snowflake/client/core/FileCacheManager.java @ v3.25.1

Permitted differences (mechanical):

  • 6 import substitutions (FileUtil, StorageClientUtil, SFLogger)

Unexpected differences: NONE

HexUtil

JDBC source : net/snowflake/client/core/HexUtil.java @ v3.25.1

Unexpected differences: NONE

OCSPTelemetryData

JDBC source : net/snowflake/client/core/OCSPTelemetryData.java @ v3.25.1

Permitted differences (mechanical):

  • OCSPModenet.snowflake.ingest.utils.OCSPMode (explicit import, was same-package in JDBC)
  • TelemetryService now same-package (import removed)

Unexpected differences: NONE

Test plan

  • mvn compiler:compile passes
  • CI passes

🤖 Generated with Claude Code

@sfc-gh-ggeng sfc-gh-ggeng force-pushed the jdbc-removal-step11a-restRequest branch from fa6f664 to 3d3b931 Compare April 6, 2026 23:55
@sfc-gh-ggeng sfc-gh-ggeng force-pushed the jdbc-removal-step11a-httputil branch 2 times, most recently from 486d52f to 13967ca Compare April 7, 2026 07:03
@sfc-gh-ggeng sfc-gh-ggeng force-pushed the jdbc-removal-step11a-restRequest branch from 3d3b931 to 9b2d8fb Compare April 7, 2026 07:03
Base automatically changed from jdbc-removal-step11a-restRequest to master April 7, 2026 18:26
…ap callers to replicated REST infrastructure

Replicate JDBC's HttpUtil as JdbcHttpUtil (renamed to avoid collision with
ingest's existing net.snowflake.ingest.utils.HttpUtil). Also replicate
SnowflakeMutableProxyRoutePlanner and AttributeEnhancingHttpRequestRetryHandler
as small helper classes.

Key changes:
- JdbcHttpUtil: verbatim replication of JDBC HttpUtil with import swaps.
  SFTrustManager replaced with null (ingest does not use OCSP trust manager).
  SFSSLConnectionSocketFactory -> IngestSSLConnectionSocketFactory.
  SystemUtil.convertSystemPropertyToIntValue inlined.
  SessionUtil.isNewRetryStrategyRequest inlined as static method.
  Deprecated S3 proxy wrapper methods omitted (S3HttpUtil callable directly).

- RestRequest: all FQN net.snowflake.client.core.HttpUtil references replaced
  with JdbcHttpUtil. SessionUtil.isNewRetryStrategyRequest replaced with
  JdbcHttpUtil.isNewRetryStrategyRequest.

- TelemetryClient: HttpUtil.executeGeneralRequest and HttpUtil.getSocketTimeout
  replaced with JdbcHttpUtil equivalents. SnowflakeSQLException import swapped
  to ingest's replicated version.

- SnowflakeGCSClient: HttpUtil.getHttpClient, getHttpClientWithoutDecompression,
  getSocketTimeout replaced with JdbcHttpUtil equivalents. Added toIngestKey
  adapter to convert JDBC's HttpClientSettingsKey during transition.

- SnowflakeAzureClient: setSessionlessProxyForAzure import swapped from JDBC
  HttpUtil to JdbcHttpUtil.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sfc-gh-ggeng sfc-gh-ggeng force-pushed the jdbc-removal-step11a-httputil branch from 13967ca to f5c0fa5 Compare April 7, 2026 18:27
Replicate SFTrustManager (1689 lines) and its dependencies so JdbcHttpUtil
uses the real OCSP trust manager from the start, rather than temporarily
stubbing it to null.

New files: SFTrustManager, Constants, FileCacheManager, HexUtil,
OCSPTelemetryData.
Updated: JdbcHttpUtil (use real SFTrustManager), FileUtil (add methods
needed by FileCacheManager), IngestSSLConnectionSocketFactory, S3HttpUtil,
StorageClientUtil.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SFTrustManager uses BouncyCastle's bcutil (ASN1, OCSP types). It was
a transitive dependency but maven-dependency-plugin:analyze-only requires
it to be declared explicitly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sfc-gh-ggeng sfc-gh-ggeng enabled auto-merge (squash) April 7, 2026 18:53
@sfc-gh-ggeng sfc-gh-ggeng merged commit 97d355d into master Apr 7, 2026
80 of 99 checks passed
@sfc-gh-ggeng sfc-gh-ggeng deleted the jdbc-removal-step11a-httputil branch April 7, 2026 21:16
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.

2 participants