зеркало из https://github.com/github/vitess-gh.git
StopSlaveMinimum now just returns a ReplicationPosition.
It doesnt need to return a ReplicationStatus.
This commit is contained in:
Родитель
31226aad61
Коммит
cc21f33ad5
|
@ -79,7 +79,7 @@ type RPCAgent interface {
|
|||
|
||||
StopSlave(ctx context.Context) error
|
||||
|
||||
StopSlaveMinimum(ctx context.Context, position myproto.ReplicationPosition, waitTime time.Duration) (*myproto.ReplicationStatus, error)
|
||||
StopSlaveMinimum(ctx context.Context, position myproto.ReplicationPosition, waitTime time.Duration) (myproto.ReplicationPosition, error)
|
||||
|
||||
StartSlave(ctx context.Context) error
|
||||
|
||||
|
@ -317,14 +317,14 @@ func (agent *ActionAgent) StopSlave(ctx context.Context) error {
|
|||
|
||||
// StopSlaveMinimum will stop the slave after it reaches at least the
|
||||
// provided position.
|
||||
func (agent *ActionAgent) StopSlaveMinimum(ctx context.Context, position myproto.ReplicationPosition, waitTime time.Duration) (*myproto.ReplicationStatus, error) {
|
||||
func (agent *ActionAgent) StopSlaveMinimum(ctx context.Context, position myproto.ReplicationPosition, waitTime time.Duration) (myproto.ReplicationPosition, error) {
|
||||
if err := agent.Mysqld.WaitMasterPos(position, waitTime); err != nil {
|
||||
return nil, err
|
||||
return myproto.ReplicationPosition{}, err
|
||||
}
|
||||
if err := agent.Mysqld.StopSlave(agent.hookExtraEnv()); err != nil {
|
||||
return nil, err
|
||||
return myproto.ReplicationPosition{}, err
|
||||
}
|
||||
return agent.Mysqld.SlaveStatus()
|
||||
return agent.Mysqld.MasterPosition()
|
||||
}
|
||||
|
||||
// StartSlave will start the replication
|
||||
|
|
|
@ -710,18 +710,18 @@ func agentRPCTestStopSlavePanic(ctx context.Context, t *testing.T, client tmclie
|
|||
|
||||
var testStopSlaveMinimumWaitTime = time.Hour
|
||||
|
||||
func (fra *fakeRPCAgent) StopSlaveMinimum(ctx context.Context, position myproto.ReplicationPosition, waitTime time.Duration) (*myproto.ReplicationStatus, error) {
|
||||
func (fra *fakeRPCAgent) StopSlaveMinimum(ctx context.Context, position myproto.ReplicationPosition, waitTime time.Duration) (myproto.ReplicationPosition, error) {
|
||||
if fra.panics {
|
||||
panic(fmt.Errorf("test-triggered panic"))
|
||||
}
|
||||
compare(fra.t, "StopSlaveMinimum position", position.GTIDSet, testReplicationPosition.GTIDSet)
|
||||
compare(fra.t, "StopSlaveMinimum waitTime", waitTime, testStopSlaveMinimumWaitTime)
|
||||
return testReplicationStatus, nil
|
||||
return testReplicationPositionReturned, nil
|
||||
}
|
||||
|
||||
func agentRPCTestStopSlaveMinimum(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
|
||||
rs, err := client.StopSlaveMinimum(ctx, ti, testReplicationPosition, testStopSlaveMinimumWaitTime)
|
||||
compareError(t, "StopSlave", err, rs, testReplicationStatus)
|
||||
pos, err := client.StopSlaveMinimum(ctx, ti, testReplicationPosition, testStopSlaveMinimumWaitTime)
|
||||
compareError(t, "StopSlave", err, pos, testReplicationPositionReturned)
|
||||
}
|
||||
|
||||
func agentRPCTestStopSlaveMinimumPanic(ctx context.Context, t *testing.T, client tmclient.TabletManagerClient, ti *topo.TabletInfo) {
|
||||
|
|
|
@ -175,9 +175,9 @@ func (client *FakeTabletManagerClient) StopSlave(ctx context.Context, tablet *to
|
|||
}
|
||||
|
||||
// StopSlaveMinimum is part of the tmclient.TabletManagerClient interface
|
||||
func (client *FakeTabletManagerClient) StopSlaveMinimum(ctx context.Context, tablet *topo.TabletInfo, minPos myproto.ReplicationPosition, waitTime time.Duration) (*myproto.ReplicationStatus, error) {
|
||||
var status myproto.ReplicationStatus
|
||||
return &status, nil
|
||||
func (client *FakeTabletManagerClient) StopSlaveMinimum(ctx context.Context, tablet *topo.TabletInfo, minPos myproto.ReplicationPosition, waitTime time.Duration) (myproto.ReplicationPosition, error) {
|
||||
var pos myproto.ReplicationPosition
|
||||
return pos, nil
|
||||
}
|
||||
|
||||
// StartSlave is part of the tmclient.TabletManagerClient interface
|
||||
|
|
|
@ -280,15 +280,15 @@ func (client *GoRPCTabletManagerClient) StopSlave(ctx context.Context, tablet *t
|
|||
}
|
||||
|
||||
// StopSlaveMinimum is part of the tmclient.TabletManagerClient interface
|
||||
func (client *GoRPCTabletManagerClient) StopSlaveMinimum(ctx context.Context, tablet *topo.TabletInfo, minPos myproto.ReplicationPosition, waitTime time.Duration) (*myproto.ReplicationStatus, error) {
|
||||
var status myproto.ReplicationStatus
|
||||
func (client *GoRPCTabletManagerClient) StopSlaveMinimum(ctx context.Context, tablet *topo.TabletInfo, minPos myproto.ReplicationPosition, waitTime time.Duration) (myproto.ReplicationPosition, error) {
|
||||
var pos myproto.ReplicationPosition
|
||||
if err := client.rpcCallTablet(ctx, tablet, actionnode.TabletActionStopSlaveMinimum, &gorpcproto.StopSlaveMinimumArgs{
|
||||
Position: minPos,
|
||||
WaitTime: waitTime,
|
||||
}, &status); err != nil {
|
||||
return nil, err
|
||||
}, &pos); err != nil {
|
||||
return pos, err
|
||||
}
|
||||
return &status, nil
|
||||
return pos, nil
|
||||
}
|
||||
|
||||
// StartSlave is part of the tmclient.TabletManagerClient interface
|
||||
|
|
|
@ -249,12 +249,12 @@ func (tm *TabletManager) StopSlave(ctx context.Context, args *rpc.Unused, reply
|
|||
}
|
||||
|
||||
// StopSlaveMinimum wraps RPCAgent.StopSlaveMinimum
|
||||
func (tm *TabletManager) StopSlaveMinimum(ctx context.Context, args *gorpcproto.StopSlaveMinimumArgs, reply *myproto.ReplicationStatus) error {
|
||||
func (tm *TabletManager) StopSlaveMinimum(ctx context.Context, args *gorpcproto.StopSlaveMinimumArgs, reply *myproto.ReplicationPosition) error {
|
||||
ctx = callinfo.RPCWrapCallInfo(ctx)
|
||||
return tm.agent.RPCWrapLock(ctx, actionnode.TabletActionStopSlaveMinimum, args, reply, true, func() error {
|
||||
status, err := tm.agent.StopSlaveMinimum(ctx, args.Position, args.WaitTime)
|
||||
pos, err := tm.agent.StopSlaveMinimum(ctx, args.Position, args.WaitTime)
|
||||
if err == nil {
|
||||
*reply = *status
|
||||
*reply = pos
|
||||
}
|
||||
return err
|
||||
})
|
||||
|
|
|
@ -104,7 +104,7 @@ type TabletManagerClient interface {
|
|||
|
||||
// StopSlaveMinimum stops the mysql replication after it reaches
|
||||
// the provided minimum point
|
||||
StopSlaveMinimum(ctx context.Context, tablet *topo.TabletInfo, stopPos myproto.ReplicationPosition, waitTime time.Duration) (*myproto.ReplicationStatus, error)
|
||||
StopSlaveMinimum(ctx context.Context, tablet *topo.TabletInfo, stopPos myproto.ReplicationPosition, waitTime time.Duration) (myproto.ReplicationPosition, error)
|
||||
|
||||
// StartSlave starts the mysql replication
|
||||
StartSlave(ctx context.Context, tablet *topo.TabletInfo) error
|
||||
|
|
|
@ -329,7 +329,7 @@ func (sdw *SplitDiffWorker) synchronizeReplication() error {
|
|||
return fmt.Errorf("cannot stop slave %v at right binlog position %v: %v", sdw.sourceAliases[i], blpPos.Position, err)
|
||||
}
|
||||
stopPositionList.Entries[i].Uid = ss.Uid
|
||||
stopPositionList.Entries[i].Position = stoppedAt.Position
|
||||
stopPositionList.Entries[i].Position = stoppedAt
|
||||
|
||||
// change the cleaner actions from ChangeSlaveType(rdonly)
|
||||
// to StartSlave() + ChangeSlaveType(spare)
|
||||
|
|
|
@ -333,7 +333,7 @@ func (vsdw *VerticalSplitDiffWorker) synchronizeReplication() error {
|
|||
return fmt.Errorf("cannot stop slave %v at right binlog position %v: %v", vsdw.sourceAlias, pos.Position, err)
|
||||
}
|
||||
stopPositionList.Entries[0].Uid = ss.Uid
|
||||
stopPositionList.Entries[0].Position = stoppedAt.Position
|
||||
stopPositionList.Entries[0].Position = stoppedAt
|
||||
|
||||
// change the cleaner actions from ChangeSlaveType(rdonly)
|
||||
// to StartSlave() + ChangeSlaveType(spare)
|
||||
|
|
Загрузка…
Ссылка в новой задаче