Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: shirly <AndreMouche@126.com>
  • Loading branch information
AndreMouche committed Mar 1, 2022
1 parent 39d8003 commit bd6ce2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion server/schedule/checker/joint_state_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (c *JointStateChecker) Check(region *core.RegionInfo) *operator.Operator {
if !core.IsInJointState(region.GetPeers()...) {
return nil
}
op, err := operator.NewLeaveJointStateOperator(c.cluster, region)
op, err := operator.CreateLeaveJointStateOperator(operator.OpDescLeaveJointState, c.cluster, region)
if err != nil {
checkerCounter.WithLabelValues("joint_state_checker", "create-operator-fail").Inc()
log.Debug("fail to create leave joint state operator", errs.ZapError(err))
Expand Down
8 changes: 2 additions & 6 deletions server/schedule/operator/create_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,8 @@ func CreateScatterRegionOperator(desc string, ci ClusterInformer, origin *core.R
Build(0)
}

const opDescLeaveJointState = "leave-joint-state"

// NewLeaveJointStateOperator creates an operator that let region leave joint state with default desc.
func NewLeaveJointStateOperator(ci ClusterInformer, origin *core.RegionInfo) (*Operator, error) {
return CreateLeaveJointStateOperator(opDescLeaveJointState, ci, origin)
}
// OpDescLeaveJointState is the expected desc for LeaveJointStateOperator.
const OpDescLeaveJointState = "leave-joint-state"

// CreateLeaveJointStateOperator creates an operator that let region leave joint state.
func CreateLeaveJointStateOperator(desc string, ci ClusterInformer, origin *core.RegionInfo) (*Operator, error) {
Expand Down
4 changes: 2 additions & 2 deletions server/schedule/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ func (o *Operator) GetAdditionalInfo() string {
return ""
}

// IsLeaveJointStateOperator returns true if the desc is opDescLeaveJointState.
// IsLeaveJointStateOperator returns true if the desc is OpDescLeaveJointState.
func (o *Operator) IsLeaveJointStateOperator() bool {
return strings.EqualFold(o.desc, opDescLeaveJointState)
return strings.EqualFold(o.desc, OpDescLeaveJointState)
}

// these values are used for unit test.
Expand Down

0 comments on commit bd6ce2e

Please sign in to comment.