Skip to content

Commit

Permalink
Merge #59130
Browse files Browse the repository at this point in the history
59130: roachtest: rattle unhealthy cached conns r=irfansharif a=tbg

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


Co-authored-by: Tobias Grieger <[email protected]>
  • Loading branch information
craig[bot] and tbg committed Jan 20, 2021
2 parents c6dff23 + c1cc2b4 commit d367a98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/cmd/roachtest/versionupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d367a98

Please sign in to comment.