Skip to content

Commit

Permalink
switchover: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hnes committed Feb 14, 2022
1 parent 9fa724f commit 1ddde23
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion micro-cluster/cluster/switchover/switchover.go
Expand Up @@ -379,7 +379,7 @@ func (m *Manager) clusterGetRelationByMasterSlaveClusterId(ctx context.Context,
return nil, err
}
for _, v := range relations {
if v.SubjectClusterID == masterClusterId && v.RelationType == constants.ClusterRelationSlaveTo {
if v.SubjectClusterID == masterClusterId && v.RelationType == constants.ClusterRelationStandBy {
relation = v
break
}
Expand Down
2 changes: 1 addition & 1 deletion micro-cluster/cluster/switchover/switchover_test.go
Expand Up @@ -38,7 +38,7 @@ func TestSwitchover(t *testing.T) {
clusterRW.EXPECT().GetRelations(gomock.Any(), gomock.Eq("2")).Return(
[]*clusterMgr.ClusterRelation{
{
RelationType: constants.ClusterRelationSlaveTo,
RelationType: constants.ClusterRelationStandBy,
SubjectClusterID: "1",
ObjectClusterID: "2",
SyncChangeFeedTaskID: "1",
Expand Down
2 changes: 1 addition & 1 deletion micro-cluster/cluster/switchover/workflow_test.go
Expand Up @@ -38,7 +38,7 @@ func TestWorkFlowToDO(t *testing.T) {
clusterRW.EXPECT().GetRelations(gomock.Any(), gomock.Eq("2")).Return(
[]*clusterMgr.ClusterRelation{
{
RelationType: constants.ClusterRelationSlaveTo,
RelationType: constants.ClusterRelationStandBy,
SubjectClusterID: "1",
ObjectClusterID: "2",
SyncChangeFeedTaskID: "1",
Expand Down
4 changes: 2 additions & 2 deletions models/cluster/management/readwriteimpl.go
Expand Up @@ -349,7 +349,7 @@ func (g *ClusterReadWrite) SwapMasterSlaveRelation(ctx context.Context, oldMaste
}

err := tx.Delete(&ClusterRelation{
RelationType: constants.ClusterRelationSlaveTo,
RelationType: constants.ClusterRelationStandBy,
ObjectClusterID: oldSlaveClusterId,
SubjectClusterID: oldMasterClusterId,
}).Error
Expand All @@ -358,7 +358,7 @@ func (g *ClusterReadWrite) SwapMasterSlaveRelation(ctx context.Context, oldMaste
return err
}
err = tx.Create(&ClusterRelation{
RelationType: constants.ClusterRelationSlaveTo,
RelationType: constants.ClusterRelationStandBy,
ObjectClusterID: oldMasterClusterId,
SubjectClusterID: oldSlaveClusterId,
SyncChangeFeedTaskID: newSyncChangeFeedTaskId,
Expand Down

0 comments on commit 1ddde23

Please sign in to comment.