-
Type:
Task
-
Resolution: Duplicate
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
tadjik1 has created PR #2330: GODRIVER-3646 Implement backpressure error labels for connection establishment in mongo-go-driver
Issue Text:
<!--- If applicable, issue number goes here, e.g. GODRIVER-ABCD -->
GODRIVER-3646(https://jira.mongodb.org/browse/GODRIVER-3646)
-
- Summary
<!--- A summary of the changes proposed by this pull request. -->
Implements client-side backpressure error handling for connection establishment, as specified in the CMAP and SDAM specification updates.
When a connection fails during dial, TLS handshake, or the initial `hello`, the driver labels the error with `SystemOverloadedError` and `RetryableError`. The SDAM error handler checks for these labels and skips pool clearing (alongside with server description updates), preventing connection churn when the server is under load.
Per spec, backpressure labels are NOT applied to DNS lookup failures, non-I/O TLS errors (certificate validation, hostname mismatch, etc.), or authentication errors.
-
- Background & Motivation
<!--- Rationale for the pull request. -->
When server enables ingress connection rate limiting, it may reject new connections during periods of high load. Previously, the driver treated these rejections like any other network error - marking the server `Unknown` and clearing the connection pool. This triggered a destructive cycle: clearing the pool forced new connection attempts, which were also rejected, leading to repeated pool clears and degraded availability.
The specification introduced backpressure errors labels to break this cycle: errrors during connection establishment (before authentication) are labeled that they may be caused by transient server overload, not an actual server state change.
-
- Notes for reviewers
- The `connection.go` refactor replaces the cascading `if err == nil
{ ... }
` pattern with early returns, to distinct error wrapping for pre- vs. post-auth failures.
- Error types filtering: this implementation distinguishes errors types per spec. SOCKS5 proxy errors are not filtered the driver currently doesn't support it.
- Prose test for ingress rate limiting implemented
- the unified test runner fix is unrelated to backpressure but was blocking the [the server description is not changed on handshake error during minPoolSize population](https://github.com/mongodb/specifications/blob/bb9dddd8176eddbb9424f9bebedfe8c6bbf28c3a/source/server-discovery-and-monitoring/tests/unified/backpressure-server-description-unchanged-on-min-pool-size-population-error.yml) spec test from passing
- duplicates
-
GODRIVER-3646 Avoid clearing the connection pool when the server connection rate limiter triggers
-
- Closed
-