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: increase consistency check timeout, and ignore errors #69285

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
12 changes: 7 additions & 5 deletions pkg/cmd/roachtest/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ func (c *clusterImpl) CheckReplicaDivergenceOnDB(
//
// We've seen the consistency checks hang indefinitely in some cases.
rows, err := db.QueryContext(ctx, `
SET statement_timeout = '3m';
SET statement_timeout = '5m';
SELECT t.range_id, t.start_key_pretty, t.status, t.detail
FROM
crdb_internal.check_consistency(true, '', '') as t
Expand All @@ -1278,20 +1278,22 @@ WHERE t.status NOT IN ('RANGE_CONSISTENT', 'RANGE_INDETERMINATE')`)
l.Printf("consistency check failed with %v; ignoring", err)
return nil
}
defer rows.Close()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. A quick check using the sqlclosecheck shows we have a few more cases of omitting a Close(). In many cases it likely doesn't matter because we are following up with t.Fatal(). (No need to handle them here, I'll open an issue)

var finalErr error
for rows.Next() {
var rangeID int32
var prettyKey, status, detail string
if scanErr := rows.Scan(&rangeID, &prettyKey, &status, &detail); scanErr != nil {
return scanErr
l.Printf("consistency check failed with %v; ignoring", scanErr)
return nil
}
finalErr = errors.CombineErrors(finalErr,
errors.Newf("r%d (%s) is inconsistent: %s %s\n", rangeID, prettyKey, status, detail))
}
if err := rows.Err(); err != nil {
finalErr = errors.CombineErrors(finalErr, err)
l.Printf("consistency check failed with %v; ignoring", err)
return nil
}

return finalErr
}

Expand Down Expand Up @@ -1330,7 +1332,7 @@ func (c *clusterImpl) FailOnReplicaDivergence(ctx context.Context, t test.Test)
defer db.Close()

if err := contextutil.RunWithTimeout(
ctx, "consistency check", time.Minute,
ctx, "consistency check", 5*time.Minute,
func(ctx context.Context) error {
return c.CheckReplicaDivergenceOnDB(ctx, t.L(), db)
},
Expand Down