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

PlannedReparent fixes #6050

Merged
merged 6 commits into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
16 changes: 11 additions & 5 deletions go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ type FakeMysqlDaemon struct {
// same it returns nil, if different it returns an error
WaitMasterPosition mysql.Position

// PromoteSlaveResult is returned by PromoteSlave
PromoteSlaveResult mysql.Position
// PromoteResult is returned by Promote
PromoteResult mysql.Position

// PromoteError is used by Promote
PromoteError error

// SchemaFunc provides the return value for GetSchema.
// If not defined, the "Schema" field will be used instead, see below.
Expand Down Expand Up @@ -348,9 +351,12 @@ func (fmd *FakeMysqlDaemon) WaitMasterPos(_ context.Context, pos mysql.Position)
return fmt.Errorf("wrong input for WaitMasterPos: expected %v got %v", fmd.WaitMasterPosition, pos)
}

// PromoteSlave is part of the MysqlDaemon interface
func (fmd *FakeMysqlDaemon) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error) {
return fmd.PromoteSlaveResult, nil
// Promote is part of the MysqlDaemon interface
func (fmd *FakeMysqlDaemon) Promote(hookExtraEnv map[string]string) (mysql.Position, error) {
if fmd.PromoteError != nil {
return mysql.Position{}, fmd.PromoteError
}
return fmd.PromoteResult, nil
}

// ExecuteSuperQueryList is part of the MysqlDaemon interface
Expand Down
5 changes: 2 additions & 3 deletions go/vt/mysqlctl/mysql_daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ type MysqlDaemon interface {

WaitMasterPos(context.Context, mysql.Position) error

// PromoteSlave makes the slave the new master. It will not change
// Promote makes the current server master. It will not change
// the read_only state of the server.
PromoteSlave(map[string]string) (mysql.Position, error)

Promote(map[string]string) (mysql.Position, error)
// Schema related methods
GetSchema(dbName string, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error)
GetColumns(dbName, table string) ([]*querypb.Field, []string, error)
Expand Down
4 changes: 2 additions & 2 deletions go/vt/mysqlctl/reparent.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ func (mysqld *Mysqld) DemoteMaster() (rp mysql.Position, err error) {
return mysqld.MasterPosition()
}

// PromoteSlave will promote a slave to be the new master.
func (mysqld *Mysqld) PromoteSlave(hookExtraEnv map[string]string) (mysql.Position, error) {
// Promote will promote this server to be the new master.
func (mysqld *Mysqld) Promote(hookExtraEnv map[string]string) (mysql.Position, error) {
ctx := context.TODO()
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
Expand Down
103 changes: 90 additions & 13 deletions go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading