cockroachdb / cockroachdb/cockroach

roachtest: replace lib/pq with pgx

Open
#143,449 1 comment 0 reactions 0 assignees View on GitHub
A-testeng-foundations C-enhancement E-starter T-testeng
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Lib/pq is no longer actively maintained; it's also quite limited in its features around connection management and alleged less reliable [1] than pgx. Specifically, there isn't a robust way to track down the root cause of test failures like [2],

```
read tcp 172.17.0.3:59624 -> 3.16.78.36:26257: i/o timeout
```

Pgx supports multiple ips [3], which could help with retries. Some day it will also support client-side load-balancing [4]. See the internal slack thread [5] for more context.

[1] https://github.com/cockroachdb/cockroach/issues/143121#issuecomment-2739835367
[2] https://github.com/cockroachdb/cockroach/issues/142789
[3] https://www.postgresql.org/docs/11/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS
[4] https://github.com/jackc/pgx/issues/2059
[5] https://cockroachlabs.slack.com/archives/C023S0V4YEB/p1742465527376359

Jira issue: CRDB-48841

Contributor guide

Open the contributing guide

Research direction

The issue names roachtest but no files, tests, or entry points; start by locating its lib/pq imports and the roachtests that exercise those connections. Validate the replacement with the affected roachtest commands, including the connection and retry behavior described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases, testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.