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

roachprod: fix roachprod init. #88514

Merged
merged 1 commit into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions pkg/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -2290,12 +2290,11 @@ func (c *SyncedCluster) ParallelE(

// Init initializes the cluster. It does it through node 1 (as per TargetNodes)
// to maintain parity with auto-init behavior of `roachprod start` (when
// --skip-init) is not specified. The implementation should be kept in
// sync with Start().
// --skip-init) is not specified.
func (c *SyncedCluster) Init(ctx context.Context, l *logger.Logger) error {
// See Start(). We reserve a few special operations for the first node, so we
// strive to maintain the same here for interoperability.
const firstNodeIdx = 0
const firstNodeIdx = 1

l.Printf("%s: initializing cluster\n", c.Name)
initOut, err := c.initializeCluster(ctx, firstNodeIdx)
Expand Down
22 changes: 2 additions & 20 deletions pkg/roachprod/install/cockroach.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,27 +184,9 @@ func (c *SyncedCluster) Start(ctx context.Context, l *logger.Logger, startOpts S

shouldInit := !c.useStartSingleNode()
if shouldInit {
l.Printf("%s: initializing cluster", c.Name)
initOut, err := c.initializeCluster(ctx, node)
if err != nil {
return nil, errors.WithDetail(err, "unable to initialize cluster")
if err := c.Init(ctx, l); err != nil {
return nil, errors.Wrap(err, "failed to initialize cluster")
}

if initOut != "" {
l.Printf(initOut)
}
}

// We're sure to set cluster settings after having initialized the
// cluster.

l.Printf("%s: setting cluster settings", c.Name)
clusterSettingsOut, err := c.setClusterSettings(ctx, l, node)
if err != nil {
return nil, errors.Wrap(err, "unable to set cluster settings")
}
if clusterSettingsOut != "" {
l.Printf(clusterSettingsOut)
}
return nil, nil
})
Expand Down