MCPcopy Create free account
hub / github.com/PostHog/duckgres / readStartupWithGSSFallback

Function readStartupWithGSSFallback

controlplane/control.go:1615–1632  ·  view source on GitHub ↗

readStartupWithGSSFallback accepts a GSSAPI probe, rejects it with 'N', and keeps reading startup packets on the same connection so clients can continue with SSLRequest/startup without reconnecting.

(conn net.Conn)

Source from the content-addressed store, hash-verified

1613 }
1614 // Install the tier escalation switcher: the connection is running on the
1615 // small exploratory worker and moves to a normal-size one (workerProfile —
1616 // the org/pool default that a non-tiered connection would have started on)
1617 // the first time it needs to. Invoked on the message-loop goroutine, so
1618 // every field it touches is single-threaded with statement handling.
1619 if useExploratory {
1620 server.SetConnectionExploratory(cc, func(ctx context.Context, reason string) (server.QueryExecutor, int, string, error) {
1621 // The exploratory session is stateless by construction (every
1622 // state-mutating statement escalates BEFORE executing), so
1623 // destroy-then-acquire is safe — and it releases the small worker
1624 // to hot-idle before the org's worker cap is checked for the big
1625 // one, so escalating can never deadlock against the org's own cap.
1626 sessions.DestroySession(pid)
1627 // The session is gone: keep the teardown guard honest for the
1628 // window that follows. An escalation that fails from here on leaves
1629 // the connection with NO session, and destroySessionOnExit
1630 // destroying an unknown pid is exactly the spurious warn the flag
1631 // exists to avoid. Re-armed the moment a replacement session exists.
1632 sessionEverCreated = false
1633 if orgID != "" {
1634 observeOrgSessionsActive(orgID, sessions.SessionCount())
1635 }

Callers 1

Calls 2

readStartupFromRawFunction · 0.85
WriteMethod · 0.45

Tested by 1