Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Driver changes

- Clarify the kernel error for `WithTransport` with guidance for TLS and proxy configuration.
- Lower the minimum supported Go version from 1.27.3 to 1.26.11. Go 1.27 users need 1.27.4 or newer for the emSign certificate distrust and November security fixes. The `go.mod` minimum accepts every Go 1.27 patch, including 1.27.0 through 1.27.3.
- Read buffered kernel result batches without a runtime hop, falling back to a blocking fetch when needed.
- Honor `WithPort` and the DSN port on the kernel backend, including after automatic Reyden recovery, instead of rejecting a non-default port. IPv6 hosts need brackets, and a port the kernel rejects returns an error wrapping both `ErrInvalidKernelConfig` and `ErrNotSupportedByKernel`.
Expand Down
5 changes: 3 additions & 2 deletions CONNECTION_PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ chunks, not bytes, and do not include consumer or application buffers.
| `WithKernelSkipHostnameVerify()` | ❌ | ✅ | Skip **only** the hostname check while keeping chain validation (finer-grained than `WithSkipTLSHostVerify`). Rejected on Thrift. |

The `WithTransport` rejection is deliberate — a Go transport can't cross the C ABI into the
kernel's Rust HTTP stack. The dedicated kernel TLS knobs cover what a custom transport is
used for:
kernel's Rust HTTP stack. `WithTransport` cannot be used with Reyden warehouses, which require the
kernel; use the `WithKernel*` TLS and proxy options instead. The dedicated kernel TLS knobs cover
what a custom transport is used for:

| Reason for a custom `WithTransport` | Kernel option |
|---|---|
Expand Down
54 changes: 54 additions & 0 deletions connector_reyden_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,60 @@ func TestReydenPreCheck(t *testing.T) {
})
}

// reydenCountingTransport verifies that kernel construction does not invoke the caller's transport.
type reydenCountingTransport struct{ calls int }

func (rt *reydenCountingTransport) RoundTrip(*http.Request) (*http.Response, error) {
rt.calls++
return nil, errors.New("unexpected transport request")
}

func TestReydenWithTransportRejection(t *testing.T) {
for _, cached := range []bool{false, true} {
name := "KP001 recovery"
if cached {
name = "cached Reyden pre-check"
}
t.Run(name, func(t *testing.T) {
defer warehouse_cache.ClearCache()
tt := NewTestReydenFallback()
if cached {
warehouse_cache.MarkReyden(tt.host, tt.warehouseID)
}
thriftCalled, kernelCalled := false, false
kernelBackend := &fakeKernelBackend{}
conn := tt.makeConnector(
func(ctx context.Context, cfg *config.Config, client *http.Client) (backend.Backend, error) {
thriftCalled = true
return &fakeThriftBackend{openSessionErr: dbsqlerrint.NewReydenThriftUnsupportedError(
"Lakehouse/RT is not supported for Thrift protocol")}, nil
},
func(ctx context.Context, cfg *config.Config) (backend.Backend, error) {
kernelCalled = true
if _, err := validateKernelConfigContext(ctx, cfg); err != nil {
return nil, err
}
return kernelBackend, nil
},
)
transport := &reydenCountingTransport{}
WithTransport(transport)(conn.cfg)
be, _, err := conn.openSessionWithReydenFallback(context.Background())
require.Error(t, err)
assert.ErrorIs(t, err, dbsqlerr.ErrNotSupportedByKernel)
assert.Equal(t, !cached, errors.Is(err, dbsqlerr.ErrReydenThriftUnsupported))
assert.Contains(t, err.Error(), "WithTransport")
assert.Contains(t, err.Error(), "WithKernel* TLS and proxy options")
assert.Contains(t, err.Error(), "warehouses that accept Thrift")
assert.Equal(t, !cached, thriftCalled)
assert.True(t, kernelCalled)
assert.Nil(t, be)
assert.False(t, kernelBackend.SessionValid())
assert.Zero(t, transport.calls)
})
}
}

func TestReydenCacheMarking(t *testing.T) {
t.Run("Rejection marks warehouse in cache", func(t *testing.T) {
defer warehouse_cache.ClearCache()
Expand Down
3 changes: 2 additions & 1 deletion kernel_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ func validateKernelConfigContext(ctx context.Context, cfg *config.Config) (kerne
// a wholesale custom Transport is unsupported.)
if cfg.Transport != nil {
return kernel.Auth{}, fmt.Errorf("databricks: a custom WithTransport (RoundTripper) is %w "+
"(the kernel uses its own HTTP stack); use the default (Thrift) backend", dbsqlerr.ErrNotSupportedByKernel)
"(the kernel uses its own HTTP stack); use WithKernel* TLS and proxy options, "+
"or use the Thrift backend for warehouses that accept Thrift", dbsqlerr.ErrNotSupportedByKernel)
}
// Auth: resolve the kernel auth form (PAT / OAuth M2M / U2M) off cfg.Authenticator,
// the single source of truth. resolveKernelAuth rejects unsupported authenticators
Expand Down
Loading