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

tm revamp: deprecate obsolete code #6241

Merged
merged 5 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
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
476 changes: 167 additions & 309 deletions go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go

Large diffs are not rendered by default.

251 changes: 64 additions & 187 deletions go/vt/proto/tabletmanagerservice/tabletmanagerservice.pb.go

Large diffs are not rendered by default.

1,311 changes: 0 additions & 1,311 deletions go/vt/schemamanager/schemaswap/schema_swap.go

This file was deleted.

6 changes: 1 addition & 5 deletions go/vt/vtcombo/tablet_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func CreateTablet(ctx context.Context, ts *topo.Server, cell string, uid uint32,
}
agent := tabletmanager.NewComboActionAgent(ctx, ts, alias, int32(8000+uid), int32(9000+uid), controller, dbcfgs, mysqld, keyspace, shard, dbname, strings.ToLower(initTabletType.String()))
if tabletType == topodatapb.TabletType_MASTER {
if err := agent.TabletExternallyReparented(ctx, ""); err != nil {
if err := agent.ChangeType(ctx, topodatapb.TabletType_MASTER); err != nil {
return fmt.Errorf("TabletExternallyReparented failed on master %v: %v", topoproto.TabletAliasString(alias), err)
}
}
Expand Down Expand Up @@ -625,10 +625,6 @@ func (itmc *internalTabletManagerClient) StartSlaveUntilAfter(ctx context.Contex
return fmt.Errorf("not implemented in vtcombo")
}

func (itmc *internalTabletManagerClient) TabletExternallyReparented(ctx context.Context, tablet *topodatapb.Tablet, externalID string) error {
return fmt.Errorf("not implemented in vtcombo")
}

func (itmc *internalTabletManagerClient) GetSlaves(ctx context.Context, tablet *topodatapb.Tablet) ([]string, error) {
return nil, fmt.Errorf("not implemented in vtcombo")
}
Expand Down
4 changes: 0 additions & 4 deletions go/vt/vtctld/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

"vitess.io/vitess/go/flagutil"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/schemamanager/schemaswap"
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/vtctl"
Expand Down Expand Up @@ -55,9 +54,6 @@ func initWorkflowManager(ts *topo.Server) {
topovalidator.RegisterShardValidator()
topovalidator.Register()

// Register the Schema Swap workflow.
schemaswap.RegisterWorkflowFactory()

// Register the Horizontal Resharding workflow.
resharding.Register()

Expand Down
22 changes: 0 additions & 22 deletions go/vt/vttablet/agentrpctest/test_agent_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,26 +818,6 @@ func agentRPCTestStartSlavePanic(ctx context.Context, t *testing.T, client tmcli
expectHandleRPCPanic(t, "StartSlave", true /*verbose*/, err)
}

var testTabletExternallyReparentedCalled = false

func (fra *fakeRPCAgent) TabletExternallyReparented(ctx context.Context, externalID string) error {
if fra.panics {
panic(fmt.Errorf("test-triggered panic"))
}
testTabletExternallyReparentedCalled = true
return nil
}

func agentRPCTestTabletExternallyReparented(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
err := client.TabletExternallyReparented(ctx, tablet, "")
compareError(t, "TabletExternallyReparented", err, true, testTabletExternallyReparentedCalled)
}

func agentRPCTestTabletExternallyReparentedPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.Tablet) {
err := client.TabletExternallyReparented(ctx, tablet, "")
expectHandleRPCPanic(t, "TabletExternallyReparented", false /*verbose*/, err)
}

var testGetSlavesResult = []string{"slave1", "slave2"}

func (fra *fakeRPCAgent) GetSlaves(ctx context.Context) ([]string, error) {
Expand Down Expand Up @@ -1295,7 +1275,6 @@ func Run(t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.T
agentRPCTestStopSlaveMinimum(ctx, t, client, tablet)
agentRPCTestStartSlave(ctx, t, client, tablet)
agentRPCTestStartSlaveUntilAfter(ctx, t, client, tablet)
agentRPCTestTabletExternallyReparented(ctx, t, client, tablet)
agentRPCTestGetSlaves(ctx, t, client, tablet)

// VReplication methods
Expand Down Expand Up @@ -1350,7 +1329,6 @@ func Run(t *testing.T, client tmclient.TabletManagerClient, tablet *topodatapb.T
agentRPCTestStopSlavePanic(ctx, t, client, tablet)
agentRPCTestStopSlaveMinimumPanic(ctx, t, client, tablet)
agentRPCTestStartSlavePanic(ctx, t, client, tablet)
agentRPCTestTabletExternallyReparentedPanic(ctx, t, client, tablet)
agentRPCTestGetSlavesPanic(ctx, t, client, tablet)

// VReplication methods
Expand Down
5 changes: 0 additions & 5 deletions go/vt/vttablet/faketmclient/fake_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@ func (client *FakeTabletManagerClient) StartSlaveUntilAfter(ctx context.Context,
return nil
}

// TabletExternallyReparented is part of the tmclient.TabletManagerClient interface.
func (client *FakeTabletManagerClient) TabletExternallyReparented(ctx context.Context, tablet *topodatapb.Tablet, externalID string) error {
return nil
}

// GetSlaves is part of the tmclient.TabletManagerClient interface.
func (client *FakeTabletManagerClient) GetSlaves(ctx context.Context, tablet *topodatapb.Tablet) ([]string, error) {
return nil, nil
Expand Down
13 changes: 0 additions & 13 deletions go/vt/vttablet/grpctmclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,19 +546,6 @@ func (client *Client) StartSlaveUntilAfter(ctx context.Context, tablet *topodata
return err
}

// TabletExternallyReparented is part of the tmclient.TabletManagerClient interface.
func (client *Client) TabletExternallyReparented(ctx context.Context, tablet *topodatapb.Tablet, externalID string) error {
cc, c, err := client.dial(tablet)
if err != nil {
return err
}
defer cc.Close()
_, err = c.TabletExternallyReparented(ctx, &tabletmanagerdatapb.TabletExternallyReparentedRequest{
ExternalId: externalID,
})
return err
}

// GetSlaves is part of the tmclient.TabletManagerClient interface.
func (client *Client) GetSlaves(ctx context.Context, tablet *topodatapb.Tablet) ([]string, error) {
cc, c, err := client.dial(tablet)
Expand Down
11 changes: 0 additions & 11 deletions go/vt/vttablet/grpctmserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,6 @@ func (s *server) StartSlaveUntilAfter(ctx context.Context, request *tabletmanage
return response, s.agent.StartSlaveUntilAfter(ctx, request.Position, time.Duration(request.WaitTimeout))
}

func (s *server) TabletExternallyReparented(ctx context.Context, request *tabletmanagerdatapb.TabletExternallyReparentedRequest) (response *tabletmanagerdatapb.TabletExternallyReparentedResponse, err error) {
defer s.agent.HandleRPCPanic(ctx, "TabletExternallyReparented", request, response, false /*verbose*/, &err)
ctx = callinfo.GRPCCallInfo(ctx)
response = &tabletmanagerdatapb.TabletExternallyReparentedResponse{}
return response, s.agent.TabletExternallyReparented(ctx, request.ExternalId)
}

func (s *server) TabletExternallyElected(ctx context.Context, request *tabletmanagerdatapb.TabletExternallyElectedRequest) (*tabletmanagerdatapb.TabletExternallyElectedResponse, error) {
return &tabletmanagerdatapb.TabletExternallyElectedResponse{}, nil
}

func (s *server) GetSlaves(ctx context.Context, request *tabletmanagerdatapb.GetSlavesRequest) (response *tabletmanagerdatapb.GetSlavesResponse, err error) {
defer s.agent.HandleRPCPanic(ctx, "GetSlaves", request, response, false /*verbose*/, &err)
ctx = callinfo.GRPCCallInfo(ctx)
Expand Down
4 changes: 0 additions & 4 deletions go/vt/vttablet/tabletmanager/action_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ type ActionAgent struct {
// any background tasks spawned by the agent.
batchCtx context.Context

// finalizeReparentCtx represents the background finalize step of a
// TabletExternallyReparented call.
finalizeReparentCtx context.Context

// History of the health checks, public so status
// pages can display it
History *history.History
Expand Down
7 changes: 3 additions & 4 deletions go/vt/vttablet/tabletmanager/healthcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,12 @@ func TestStateChangeImmediateHealthBroadcast(t *testing.T) {
t.Fatal(err)
}

// Run TER to turn us into a proper master, wait for it to finish.
// Change to master.
agent.HealthReporter.(*fakeHealthCheck).reportReplicationDelay = 19 * time.Second
if err := agent.TabletExternallyReparented(ctx, "unused_id"); err != nil {
if err := agent.ChangeType(ctx, topodatapb.TabletType_MASTER); err != nil {
t.Fatalf("TabletExternallyReparented failed: %v", err)
}
<-agent.finalizeReparentCtx.Done()
// It is not enough to wait for finalizeReparentCtx to be done, we have to wait for shard_sync to finish
// Wait for shard_sync to finish
startTime := time.Now()
for {
if time.Since(startTime) > 10*time.Second /* timeout */ {
Expand Down
4 changes: 1 addition & 3 deletions go/vt/vttablet/tabletmanager/rpc_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func (agent *ActionAgent) changeTypeLocked(ctx context.Context, tabletType topod
}

// let's update our internal state (stop query service and other things)
// refreshTablet will invoke broadcastHealth if needed.
if err := agent.refreshTablet(ctx, "ChangeType"); err != nil {
return err
}
Expand All @@ -102,9 +103,6 @@ func (agent *ActionAgent) changeTypeLocked(ctx context.Context, tabletType topod
if err := agent.fixSemiSyncAndReplication(agent.Tablet().Type); err != nil {
return vterrors.Wrap(err, "fixSemiSyncAndReplication failed, may not ack correctly")
}

// and re-run health check
agent.runHealthCheckLocked()
return nil
}

Expand Down
2 changes: 0 additions & 2 deletions go/vt/vttablet/tabletmanager/rpc_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ type RPCAgent interface {

StartSlaveUntilAfter(ctx context.Context, position string, waitTime time.Duration) error

TabletExternallyReparented(ctx context.Context, externalID string) error

GetSlaves(ctx context.Context) ([]string, error)

// VReplication API
Expand Down
Loading