Skip to content

Commit

Permalink
Merge pull request #6384 from planetscale/ss-resurrect-demote-master-…
Browse files Browse the repository at this point in the history
…type

vttablet: bring back demote_master_type
  • Loading branch information
sougou authored Jun 26, 2020
2 parents 27f77b5 + f279fc1 commit 3cd3fa9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion go/vt/vttablet/tabletmanager/tm_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ var (
// The following variables can be changed to speed up tests.
mysqlPortRetryInterval = 1 * time.Second
rebuildKeyspaceRetryInterval = 1 * time.Second

// demoteMasterType is deprecated.
// TODO(sougou); remove after release 7.0.
demoteMasterType = flag.String("demote_master_type", "REPLICA", "DEPRECATED: the tablet type a demoted master will transition to")
)

func init() {
Expand Down Expand Up @@ -281,6 +285,13 @@ func (tm *TabletManager) Start(tablet *topodatapb.Tablet) error {
tm.DBConfigs.DBName = topoproto.TabletDbName(tablet)
tm.History = history.New(historyLength)
tm.tabletAlias = tablet.Alias
demoteType, err := topoproto.ParseTabletType(*demoteMasterType)
if err != nil {
return err
}
if demoteType != tablet.Type {
log.Warningf("deprecated demote_master_type %v must match init_tablet_type %v", demoteType, tablet.Type)
}
tm.baseTabletType = tablet.Type
tm._healthy = fmt.Errorf("healthcheck not run yet")

Expand All @@ -299,7 +310,7 @@ func (tm *TabletManager) Start(tablet *topodatapb.Tablet) error {
return err
}

err := tm.QueryServiceControl.InitDBConfig(querypb.Target{
err = tm.QueryServiceControl.InitDBConfig(querypb.Target{
Keyspace: tablet.Keyspace,
Shard: tablet.Shard,
TabletType: tablet.Type,
Expand Down

0 comments on commit 3cd3fa9

Please sign in to comment.