pgwire: add per-session TCP keepalive settings#164369
Merged
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom Feb 26, 2026
Merged
pgwire: add per-session TCP keepalive settings#164369trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Contributor
|
😎 Merged successfully - details. |
Member
fqazi
approved these changes
Feb 25, 2026
Collaborator
fqazi
left a comment
There was a problem hiding this comment.
@fqazi reviewed 13 files and all commit messages, and made 1 comment.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on rafiss).
dc91c04 to
f360649
Compare
Add PostgreSQL-compatible per-session TCP keepalive settings (tcp_keepalives_idle, tcp_keepalives_interval, tcp_keepalives_count, tcp_user_timeout) that override cluster-level defaults when set to non-zero values. A value of 0 means "use the cluster setting default." Also adds a new `server.sql_tcp_keep_alive.idle` cluster setting to separate idle time from probe interval, which were previously conflated in `server.sql_tcp_keep_alive.interval`. The TCP keepalive cluster settings are moved to a new `pkg/server/tcpkeepalive` sub-package to avoid import cycles between `pkg/server` and `pkg/sql/pgwire`. The existing setting variable names in `pkg/server` are preserved as aliases for backward compatibility. Resolves: cockroachdb#162328 Release note (sql change): CockroachDB now supports the PostgreSQL session variables `tcp_keepalives_idle`, `tcp_keepalives_interval`, `tcp_keepalives_count`, and `tcp_user_timeout`. These allow per-session control over TCP keepalive behavior on each connection. A value of 0 (the default) uses the corresponding cluster setting. Non-zero values override the cluster setting for that session only. Units match PostgreSQL: seconds for keepalive settings, milliseconds for tcp_user_timeout. Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
f360649 to
b953910
Compare
Collaborator
Author
|
/trunk merge tftr! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(
tcp_keepalives_idle,tcp_keepalives_interval,tcp_keepalives_count,tcp_user_timeout) that override cluster-level defaults when set tonon-zero values.
server.sql_tcp_keep_alive.idlecluster setting to separate idletime from probe interval.
pkg/server/tcpkeepalivesub-packageto avoid import cycles between
pkg/serverandpkg/sql/pgwire.Resolves: #162328
Release note (sql change): CockroachDB now supports the PostgreSQL
session variables
tcp_keepalives_idle,tcp_keepalives_interval,tcp_keepalives_count, andtcp_user_timeout. These allow per-sessioncontrol over TCP keepalive behavior on each connection. A value of 0
(the default) uses the corresponding cluster setting. Non-zero values
override the cluster setting for that session only. Units match
PostgreSQL: seconds for keepalive settings, milliseconds for
tcp_user_timeout.