Skip to content

Commit

Permalink
ddl: fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: xhe <xw897002528@gmail.com>
  • Loading branch information
xhebox committed Dec 24, 2021
1 parent b4d8422 commit 99825b0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ddl/placement/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ func NewBundleFromConstraintsOptions(options *model.PlacementSettings) (*Bundle,
Rules = append(Rules, NewRule(Leader, 1, LeaderConstraints))

if followerCount == 0 {
return nil, fmt.Errorf("%w: you must set some followers", ErrInvalidPlacementOptions)
followerCount = 2
}

FollowerRules, err := NewRules(Voter, followerCount, followerConstraints)
if err != nil {
return nil, fmt.Errorf("%w: invalid FollowerConstraints", err)
Expand Down Expand Up @@ -145,6 +144,9 @@ func NewBundleFromSugarOptions(options *model.PlacementSettings) (*Bundle, error
}

followers := options.Followers
if followers == 0 {
followers = 2
}
schedule := options.Schedule

primaryIndex := 0
Expand Down Expand Up @@ -205,10 +207,6 @@ func newBundleFromOptions(options *model.PlacementSettings) (bundle *Bundle, err
isSyntaxSugar = false
}

if options.Followers == 0 {
options.Followers = 2
}

if isSyntaxSugar {
bundle, err = NewBundleFromSugarOptions(options)
} else {
Expand Down

0 comments on commit 99825b0

Please sign in to comment.