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

Commit d9b3b4f

Browse files
gianlucaborelloowainlewis
authored andcommitted
Restore native dba.reboot_cluster_from_complete_outage() (#155)
Signed-off-by: Gianluca Borello <g.borello@gmail.com>
1 parent e33d324 commit d9b3b4f

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

pkg/util/mysqlsh/mysqlsh.go

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -197,36 +197,8 @@ func (r *runner) run(ctx context.Context, python string) ([]byte, error) {
197197
}
198198

199199
func (r *runner) RebootClusterFromCompleteOutage(ctx context.Context) error {
200-
r.mu.Lock()
201-
defer r.mu.Unlock()
202-
203-
stdout := &bytes.Buffer{}
204-
stderr := &bytes.Buffer{}
205-
206-
// NOTE(apryde): This is implemented in SQL rather than as a call to
207-
// dba.reboot_cluster_from_complete_outage() due to https://bugs.mysql.com/90793.
208-
sql := strings.Join([]string{
209-
"RESET PERSIST group_replication_bootstrap_group;",
210-
"SET GLOBAL group_replication_bootstrap_group=ON;",
211-
"start group_replication;",
212-
}, " ")
213-
214-
args := []string{"--no-wizard", "--uri", r.uri, "--sql", "-e", sql}
215-
216-
cmd := r.exec.CommandContext(ctx, "mysqlsh", args...)
217-
218-
cmd.SetStdout(stdout)
219-
cmd.SetStderr(stderr)
220-
221-
glog.V(6).Infof("Running command: mysqlsh %v", args)
222-
err := cmd.Run()
223-
glog.V(6).Infof(" stdout: %s\n stderr: %s\n err: %s", stdout, stderr, err)
224-
if err != nil {
225-
underlying := NewErrorFromStderr(stderr.String())
226-
if underlying != nil {
227-
return errors.WithStack(underlying)
228-
}
229-
}
200+
python := fmt.Sprintf("dba.reboot_cluster_from_complete_outage('%s')", innodb.DefaultClusterName)
201+
_, err := r.run(ctx, python)
230202
return err
231203
}
232204

0 commit comments

Comments
 (0)