Skip to content

Commit

Permalink
Exclude init table from backup to allow bootstrap detection on slave
Browse files Browse the repository at this point in the history
  • Loading branch information
AMecea committed Feb 8, 2019
1 parent e22cd16 commit 0dbcc88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/sidecar/apphelper/apphelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,16 @@ func configReadOnly() error {

func configTopology() error {
if util.NodeRole() == "slave" {

log.Info("setting up as slave")
if util.ShouldBootstrapNode() {
log.Info("doing bootstrap")
if gtid, err := util.ReadPurgedGTID(); err == nil {
log.V(1).Info("RESET MASTER and setting GTID_PURGED", "gtid", gtid)
log.Info("RESET MASTER and setting GTID_PURGED", "gtid", gtid)
if errQ := util.RunQuery("RESET MASTER; SET GLOBAL GTID_PURGED=?", gtid); errQ != nil {
return errQ
}
} else {
log.V(-1).Info("can't determin what GTID to purge", "error", err)
log.V(-1).Info("can't determine what GTID to purge", "error", err)
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/sidecar/apphelper/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func (s *server) backupHandler(w http.ResponseWriter, r *http.Request) {

// nolint: gosec
xtrabackup := exec.Command("xtrabackup", "--backup", "--slave-info", "--stream=xbstream",
fmt.Sprintf("--tables-exclude=%s.%s", util.ToolsDbName, util.ToolsInitTableName),
"--host=127.0.0.1", fmt.Sprintf("--user=%s", util.GetReplUser()),
fmt.Sprintf("--password=%s", util.GetReplPass()))

Expand Down

0 comments on commit 0dbcc88

Please sign in to comment.