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

roachtest: always pass a Context to queries #133690

Merged
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pkg/cmd/roachtest/tests/admission_control_latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ func (v variations) waitForRebalanceToStop(ctx context.Context, t test.Test) {
Multiplier: 1,
}
for r := retry.StartWithCtx(ctx, opts); r.Next(); {
if row := db.QueryRow(q); row != nil {
if row := db.QueryRowContext(ctx, q); row != nil {
var secondsSinceLastEvent int
if err := row.Scan(&secondsSinceLastEvent); err != nil && !errors.Is(err, gosql.ErrNoRows) {
t.Fatal(err)
Expand All @@ -1021,7 +1021,7 @@ func (v variations) waitForIOOverloadToEnd(ctx context.Context, t test.Test) {
anyOverloaded := false
for _, nodeId := range v.targetNodes() {
db := v.Conn(ctx, t.L(), nodeId)
if row := db.QueryRow(q); row != nil {
if row := db.QueryRowContext(ctx, q); row != nil {
var overload float64
if err := row.Scan(&overload); err != nil && !errors.Is(err, gosql.ErrNoRows) {
db.Close()
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/roachtest/tests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func profileTopStatements(

// Enable continuous statement diagnostics rather than just the first one.
sql := "SET CLUSTER SETTING sql.stmt_diagnostics.collect_continuously.enabled=true"
if _, err := db.Exec(sql); err != nil {
if _, err := db.ExecContext(ctx, sql); err != nil {
return err
}

Expand Down Expand Up @@ -199,7 +199,7 @@ FROM (
dbName,
minNumExpectedStmts,
)
if _, err := db.Exec(sql); err != nil {
if _, err := db.ExecContext(ctx, sql); err != nil {
return err
}
return nil
Expand All @@ -217,7 +217,7 @@ func downloadProfiles(
query := "SELECT id, collected_at FROM system.statement_diagnostics"
db := cluster.Conn(ctx, logger, 1)
defer db.Close()
idRow, err := db.Query(query)
idRow, err := db.QueryContext(ctx, query)
if err != nil {
return err
}
Expand All @@ -236,7 +236,7 @@ func downloadProfiles(
return err
}
url := urlPrefix + diagID
resp, err := client.Get(context.Background(), url)
resp, err := client.Get(ctx, url)
if err != nil {
return err
}
Expand Down
Loading