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: Reset job load attempt when loading cdc job #108523

Merged
merged 1 commit into from
Aug 10, 2023
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
10 changes: 6 additions & 4 deletions pkg/cmd/roachtest/tests/cdc_bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ func waitForChangefeed(
) (changefeedInfo, error) {
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
for attempt := 0; ; attempt++ {
const maxLoadJobAttempts = 5
for loadJobAttempt := 0; ; loadJobAttempt++ {
select {
case <-ticker.C:
case <-ctx.Done():
Expand All @@ -557,9 +558,9 @@ func waitForChangefeed(

info, err := getChangefeedInfo(conn, jobID)
if err != nil {
logger.Errorf("error getting changefeed info: %v (attempt %d)", err, attempt+1)
if attempt > 5 {
return changefeedInfo{}, errors.Wrap(err, "failed 5 attempts to get changefeed info")
logger.Errorf("error getting changefeed info: %v (attempt %d)", err, loadJobAttempt+1)
if loadJobAttempt > 5 {
return changefeedInfo{}, errors.Wrapf(err, "failed %d attempts to get changefeed info", maxLoadJobAttempts)
}
continue
} else if info.errMsg != "" {
Expand All @@ -570,6 +571,7 @@ func waitForChangefeed(
} else if ok {
return *info, nil
}
loadJobAttempt = 0
}
}

Expand Down