Skip to content

Commit

Permalink
Merge #68988
Browse files Browse the repository at this point in the history
68988: roachtest: avoid NPE on cluster creation retries exceeded r=otan a=tbg

When this branch was hit (as it was recently on AWS due to quota issues)
roachtest was giving up anyway, but it wasn't nice that it exploded prematurely
instead of shutting down in an orderly fashion.

Release note: None


Co-authored-by: Tobias Grieger <[email protected]>
  • Loading branch information
craig[bot] and tbg committed Aug 17, 2021
2 parents d61e634 + 373120f commit ecab37d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/cmd/roachtest/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,11 @@ func (f *clusterFactory) newCluster(
}

// Logs for creating a new cluster go to a dedicated log file.
logPath := filepath.Join(f.artifactsDir, runnerLogsDir, "cluster-create", c.name+".log")
var retryStr string
if i > 0 {
retryStr = "-retry" + strconv.Itoa(i)
}
logPath := filepath.Join(f.artifactsDir, runnerLogsDir, "cluster-create", c.name+retryStr+".log")
l, err := logger.RootLogger(logPath, teeOpt)
if err != nil {
log.Fatalf(ctx, "%v", err)
Expand Down Expand Up @@ -891,7 +895,7 @@ func (f *clusterFactory) newCluster(
c.Destroy(ctx, closeLogger, l)
if i > maxAttempts {
// Here we have to release the alloc, as we are giving up.
c.destroyState.alloc.Release()
cfg.alloc.Release()
return nil, err
}
// Try again to create the cluster.
Expand Down

0 comments on commit ecab37d

Please sign in to comment.