From c1cc2b47b6bfb7179b46484b4f44e766b6476552 Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Mon, 18 Jan 2021 13:24:21 +0100 Subject: [PATCH] roachtest: rattle unhealthy cached conns At least on some systems (my Linux desktop for example), using a sql connection pool whose target node has restarted leads to a spurious "broken pipe" error on the next attempt to use the connection. I think this is a bug in whatever driver we're using, but for now work around it by running a `SELECT 1` before returning the conn to the caller. Release note: None --- pkg/cmd/roachtest/versionupgrade.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/roachtest/versionupgrade.go b/pkg/cmd/roachtest/versionupgrade.go index 7b268bebf7a8..2db107b1ff10 100644 --- a/pkg/cmd/roachtest/versionupgrade.go +++ b/pkg/cmd/roachtest/versionupgrade.go @@ -219,7 +219,11 @@ func (u *versionUpgradeTest) conn(ctx context.Context, t *test, i int) *gosql.DB u.conns = append(u.conns, u.c.Conn(ctx, i)) } } - return u.conns[i-1] + db := u.conns[i-1] + // Run a trivial query to shake out errors that can occur when the server has + // restarted in the meantime. + _ = db.PingContext(ctx) + return db } func (u *versionUpgradeTest) uploadVersion(