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

vttablet: bring back demote_master_type #6384

Merged
merged 2 commits into from
Jun 26, 2020
Merged
Changes from all 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
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