Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit

Permalink
Restore native dba.reboot_cluster_from_complete_outage() (#155)
Browse files Browse the repository at this point in the history
Signed-off-by: Gianluca Borello <[email protected]>
  • Loading branch information
gianlucaborello authored and owainlewis committed Jun 26, 2018
1 parent e33d324 commit d9b3b4f
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions pkg/util/mysqlsh/mysqlsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,36 +197,8 @@ func (r *runner) run(ctx context.Context, python string) ([]byte, error) {
}

func (r *runner) RebootClusterFromCompleteOutage(ctx context.Context) error {
r.mu.Lock()
defer r.mu.Unlock()

stdout := &bytes.Buffer{}
stderr := &bytes.Buffer{}

// NOTE(apryde): This is implemented in SQL rather than as a call to
// dba.reboot_cluster_from_complete_outage() due to https://bugs.mysql.com/90793.
sql := strings.Join([]string{
"RESET PERSIST group_replication_bootstrap_group;",
"SET GLOBAL group_replication_bootstrap_group=ON;",
"start group_replication;",
}, " ")

args := []string{"--no-wizard", "--uri", r.uri, "--sql", "-e", sql}

cmd := r.exec.CommandContext(ctx, "mysqlsh", args...)

cmd.SetStdout(stdout)
cmd.SetStderr(stderr)

glog.V(6).Infof("Running command: mysqlsh %v", args)
err := cmd.Run()
glog.V(6).Infof(" stdout: %s\n stderr: %s\n err: %s", stdout, stderr, err)
if err != nil {
underlying := NewErrorFromStderr(stderr.String())
if underlying != nil {
return errors.WithStack(underlying)
}
}
python := fmt.Sprintf("dba.reboot_cluster_from_complete_outage('%s')", innodb.DefaultClusterName)
_, err := r.run(ctx, python)
return err
}

Expand Down

0 comments on commit d9b3b4f

Please sign in to comment.