Skip to content

Commit

Permalink
Merge #79977
Browse files Browse the repository at this point in the history
79977: roachtest: improve WaitForUpdatedReplicationReport r=nvanbenschoten a=ajwerner

Before this change, it was possible to wait for only some of the replication
reports to exist without waiting for the critical localities test to exist.

Fixes #78284.

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
  • Loading branch information
craig[bot] and ajwerner committed Apr 15, 2022
2 parents 0d07f9c + be22cd2 commit cfb6bab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/cmd/roachtest/tests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@ func WaitForUpdatedReplicationReport(ctx context.Context, t test.Test, db *gosql
// that the report picks up any new tables or zones.
tStart := timeutil.Now()
for r := retry.StartWithCtx(ctx, retry.Options{}); r.Next(); {
var gen time.Time
var count int
var gen gosql.NullTime
if err := db.QueryRowContext(
ctx, `SELECT generated FROM system.reports_meta ORDER BY 1 DESC LIMIT 1`,
).Scan(&gen); err != nil {
ctx, `SELECT count(*), min(generated) FROM system.reports_meta`,
).Scan(&count, &gen); err != nil {
if !errors.Is(err, gosql.ErrNoRows) {
t.Fatal(err)
}
// No report generated yet.
} else if tStart.Before(gen) {
// No report generated yet. There are 3 types of reports. We want to
// see a result for all of them.
} else if count == 3 && tStart.Before(gen.Time) {
// New report generated.
return
}
Expand Down

0 comments on commit cfb6bab

Please sign in to comment.