Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: avoid net.Error allocation on each readTimeoutConn.Read call #74339

Merged
Merged
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
8 changes: 5 additions & 3 deletions pkg/sql/pgwire/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1759,9 +1759,11 @@ func (c *readTimeoutConn) Read(b []byte) (int, error) {
return 0, err
}
n, err := c.Conn.Read(b)
// Continue if the error is due to timing out.
if ne := (net.Error)(nil); errors.As(err, &ne) && ne.Timeout() {
continue
if err != nil {
// Continue if the error is due to timing out.
if ne := (net.Error)(nil); errors.As(err, &ne) && ne.Timeout() {
continue
}
}
return n, err
}
Expand Down