-
Notifications
You must be signed in to change notification settings - Fork 409
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
Disallow copy and move #4578
Disallow copy and move #4578
Conversation
[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. |
dbms/src/Common/CPUAffinityManager.h
Outdated
DISALLOW_COPY(ClassName); \ | ||
DISALLOW_MOVE(ClassName) | ||
|
||
#define DISALLOW_COPY(ClassName) \ |
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.
You can write the code in /dbms/src/Common/nocopyable.h
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.
I have done as you said. And I wonder if I need to replace the one line deletion of copy constructor or assign constructor like AggregateDescription(const AggregateDescription &) = delete;
in /dbms/src/DataStreams/SummingSortedBlockInputStream.h, is it on purpose or I can replace it with DISALLOW_COPY(AggregateDescription) 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.
You can replace it directly. Maybe you can list some of the classes need to refactor in the issue and create some sub-issue, and you refactor 3 or 4 of them in one pr.
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.
Like @ywqzzy said, the macro DISALLOW_COPY
/DISALLOW_MOVE
/DISALLOW_COPY_AND_MOVE
should be defined in a common place like dbms/src/Common/noncopyable.h
.
And I wonder whether we can define DISALLOW_COPY_AND_MOVE
before DISALLOW_COPY
/DISALLOW_MOVE
?
@JaySon-Huang could you help to review this pr? |
/rebuild |
1 similar comment
/rebuild |
deae845
to
6c60aff
Compare
3ada1d7
to
09ad8b5
Compare
I found a mistake in dbms/src/Common/ExecutableTask.h, let me fix it and recommit. |
f4c6f44
to
70e00ee
Compare
Can anyone review this pr? thx :) |
/run-all-tests |
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. Good Job!
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
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.
Thanks for your good job! The two copy operations are independent. Declaring copy constructor does not prevent compiler to generate copy assignment and vice versa. And I found that there are some classes which only make copy constructor = delete
but you also replace it with DISALLOW_COPY(className)
. In most cases, it is fine. However, could you please take a deep check to make sure it is all fine? And thanks for your great contribution again!
@@ -359,11 +360,8 @@ class PageDirectory | |||
} | |||
|
|||
// No copying | |||
PageDirectory(const PageDirectory &) = delete; | |||
PageDirectory & operator=(const PageDirectory &) = delete; | |||
// No moving |
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.
maybe combine the two comments?
And why do this? 😂 - std::string toString() const { return "Not Support"; }
+ std::string toString() const
+ {
+ return "Not Support";
+ } honestly, I like the previous code style which makes code more compact with high readability. 😄 |
Signed-off-by: ZHANGWENTAI <[email protected]>
10506f4
to
2929380
Compare
hello! I have remained the format of short function and commit agian |
https://github.com/pingcap/tiflash/pull/4578/files#diff-e49f478fa33ca6648a69a7aba47d9485827d89793ef5784c080375ff2fce5cfb seems have not pushed? |
Actually I did 😂. The reason why I expand those functions still is to keep code style consistent in the file and some functions are not short enough. Expanding them is easier to read |
OK,cool |
@ywqzzy PTAL |
/run-all-tests |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
/merge |
@ywqzzy: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. 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: b1f5f25
|
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
PTAL |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
@ZHANGWENTAI: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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. |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
What problem does this PR solve?
Issue Number: ref #4411
Problem Summary: use DISALLOW_COPY_AND_MOVE instead.
What is changed and how it works?
add DISALLOW_COPY, DISALLOW_MOVE, DISALLOWCOPY_AND_MOVE macro, and used in the files listed in #4411.
Check List
Tests
Side effects
Documentation
Release note