Skip to content

changefeedccl: add timeout to nemeses test inserts #146248

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

Merged
merged 1 commit into from
May 7, 2025
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
8 changes: 7 additions & 1 deletion pkg/ccl/changefeedccl/cdctest/nemeses.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"fmt"
"math/rand"
"strings"
"time"

"github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/changefeedbase"
"github.com/cockroachdb/cockroach/pkg/internal/sqlsmith"
Expand Down Expand Up @@ -418,11 +419,16 @@ func RunNemesis(

defer queryGen.Close()
const numInserts = 100
const insertTimeout = 5 * time.Second
time := timeutil.Now()
for i := 0; i < numInserts; i++ {
query := queryGen.Generate()
log.Infof(ctx, "Executing query: %s", query)
_, err := db.Exec(query)
err := timeutil.RunWithTimeout(ctx, "nemeses populate table",
insertTimeout, func(ctx context.Context) error {
_, err := db.ExecContext(ctx, query)
return err
})
log.Infof(ctx, "Time taken to execute last query: %s", timeutil.Since(time))
time = timeutil.Now()
if err != nil {
Expand Down
Loading