-
Notifications
You must be signed in to change notification settings - Fork 719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
placement: return rules after clone #3892
Conversation
Signed-off-by: disksing <i@disksing.com>
Codecov Report
@@ Coverage Diff @@
## master #3892 +/- ##
==========================================
- Coverage 74.47% 74.40% -0.07%
==========================================
Files 246 246
Lines 24854 24868 +14
==========================================
- Hits 18509 18504 -5
- Misses 4685 4693 +8
- Partials 1660 1671 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Please take a look. @HunDunDM @bufferflies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Copy-on-Write perform better?
server/server.go
Outdated
@@ -1378,3 +1376,15 @@ func (s *Server) SaveTTLConfig(data map[string]interface{}, ttl time.Duration) e | |||
} | |||
return nil | |||
} | |||
|
|||
func stringsEqual(a, b []string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judge the situation where len
is all 0, then we can still use reflect.DeepEqual
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it will be if len(a) == 0 && len(b) == 0 || reflect.DeepEqual(a, )
, looks not very elegant I think.
copy-on-write should be better. The problem is that Go does not have |
lgtm |
Signed-off-by: disksing <i@disksing.com>
PTAL @HunDunDM @bufferflies |
lgtm |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/merge |
@nolouch: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 82c6b74
|
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #3914. |
In response to a cherrypick label: new pull request created: #3915. |
* placement: return rules after clone Signed-off-by: disksing <i@disksing.com> * fix test Signed-off-by: disksing <i@disksing.com> * move stringsEqual to typeutils Signed-off-by: disksing <i@disksing.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
* placement: return rules after clone Signed-off-by: disksing <i@disksing.com> * fix test Signed-off-by: disksing <i@disksing.com> * move stringsEqual to typeutils Signed-off-by: disksing <i@disksing.com> Co-authored-by: disksing <i@disksing.com> Co-authored-by: 混沌DM <hundundm@gmail.com>
Signed-off-by: disksing i@disksing.com
What problem does this PR solve?
Fix #3886
What is changed and how it works?
Clone the rule before returning to callers. It should be safe to modify and update again.
Check List
Tests
Related changes
Release note