Skip to content

Commit

Permalink
Refine comments
Browse files Browse the repository at this point in the history
Signed-off-by: JaySon-Huang <[email protected]>
  • Loading branch information
JaySon-Huang committed Jan 7, 2025
1 parent 9fb5f6d commit 7ae26a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/ddl/placement/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ func (b *Bundle) String() string {

// Tidy will post optimize Rules, trying to generate rules that suits PD.
func (b *Bundle) Tidy() error {
// refer to #58633
// Note that does not explicitly set rule with label.key==EngineLabelKey, because the
// refer to tidb#58633
// Does not explicitly set exclude rule with label.key==EngineLabelKey, because the
// PD may wrongly add peer to the unexpected stores if that key is specified.
tempRules := b.Rules[:0]
id := 0
Expand Down
1 change: 1 addition & 0 deletions pkg/ddl/placement/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ func TestString(t *testing.T) {
rules2, err := newRules(pd.Voter, 4, `["-zone=sh", "+zone=bj"]`)
require.NoError(t, err)
rules3, err := newRules(pd.Voter, 3, `["-engine=tiflash", "-engine=tiflash_compute"]`)
require.NoError(t, err)
bundle.Rules = append(append(rules1, rules2...), rules3...)

require.Equal(t, "{\"group_id\":\"TiDB_DDL_1\",\"group_index\":0,\"group_override\":false,\"rules\":[{\"group_id\":\"\",\"id\":\"\",\"start_key\":\"\",\"end_key\":\"\",\"role\":\"voter\",\"is_witness\":false,\"count\":3,\"label_constraints\":[{\"key\":\"zone\",\"op\":\"in\",\"values\":[\"sh\"]}]},{\"group_id\":\"\",\"id\":\"\",\"start_key\":\"\",\"end_key\":\"\",\"role\":\"voter\",\"is_witness\":false,\"count\":4,\"label_constraints\":[{\"key\":\"zone\",\"op\":\"notIn\",\"values\":[\"sh\"]},{\"key\":\"zone\",\"op\":\"in\",\"values\":[\"bj\"]}]},{\"group_id\":\"\",\"id\":\"\",\"start_key\":\"\",\"end_key\":\"\",\"role\":\"voter\",\"is_witness\":false,\"count\":3,\"label_constraints\":[{\"key\":\"engine\",\"op\":\"notIn\",\"values\":[\"tiflash\"]},{\"key\":\"engine\",\"op\":\"notIn\",\"values\":[\"tiflash_compute\"]}]}]}", bundle.String())
Expand Down

0 comments on commit 7ae26a6

Please sign in to comment.