-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
tool: renaming and refactoring global variables in ceph-dedup-daemon #57223
base: main
Are you sure you want to change the base?
tool: renaming and refactoring global variables in ceph-dedup-daemon #57223
Conversation
@athanatos This PR is to address your comment (#56067 (comment), #56067 (comment)) about refactoring global variables. Please take a look. |
Ok, I will get to this next week. |
@@ -662,16 +668,14 @@ int make_crawling_daemon(const po::variables_map &opts) | |||
<< ")" | |||
<< dendl; | |||
|
|||
std::shared_lock l(glock); | |||
state = new SampleDedupWorkerThread::SampleDedupGlobal( | |||
chunk_dedup_threshold, sampling_ratio, report_period, fp_threshold); |
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.
Never use raw new/delete without an extremely good reason. Use a unique_ptr.
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.
Apologies, I didn't look closely enough -- you don't even need a std::unique_ptr. You can just declare it directly as
SampleDedupWorkerThread::SampleDedupGlobal state(
chunk_dedup_threshold, sampling_ratio, report_period, fp_threshold);
since it's a simple, concrete structure.
@@ -662,16 +668,14 @@ int make_crawling_daemon(const po::variables_map &opts) | |||
<< ")" | |||
<< dendl; | |||
|
|||
std::shared_lock l(glock); | |||
state = new SampleDedupWorkerThread::SampleDedupGlobal( |
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.
Why is state declared outside of this function, couldn't it be a local std::unique_ptr?
@@ -717,32 +721,38 @@ int make_crawling_daemon(const po::variables_map &opts) | |||
ret = rados.get_pool_stats(pool_names, stats); | |||
if (ret < 0) { | |||
derr << "error fetching pool stats: " << cpp_strerror(ret) << dendl; | |||
return -EINVAL; | |||
ret = -EINVAL; | |||
goto out; |
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.
This goto is here so that you can call invoke delete state. Once you've switched it to a unique_ptr, this can go back to being a normal return.
} | ||
if (stats.find(base_pool_name) == stats.end()) { | ||
derr << "stats can not find pool name: " << base_pool_name << dendl; | ||
return -EINVAL; | ||
ret = -EINVAL; | ||
goto out; |
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.
Same here.
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
fdcd5b8
to
a854567
Compare
@@ -662,16 +668,14 @@ int make_crawling_daemon(const po::variables_map &opts) | |||
<< ")" | |||
<< dendl; | |||
|
|||
std::shared_lock l(glock); | |||
state = new SampleDedupWorkerThread::SampleDedupGlobal( | |||
chunk_dedup_threshold, sampling_ratio, report_period, fp_threshold); |
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.
Apologies, I didn't look closely enough -- you don't even need a std::unique_ptr. You can just declare it directly as
SampleDedupWorkerThread::SampleDedupGlobal state(
chunk_dedup_threshold, sampling_ratio, report_period, fp_threshold);
since it's a simple, concrete structure.
a854567
to
17ffdea
Compare
@athanatos Can you take a look to see if I addressed your comment? |
… a gobal variable Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com> Signed-off-by: Sungmin Lee <sung_min.lee@samsung.com>
17ffdea
to
81382ac
Compare
I added needs-qa tag. |
Follow-up: #56067
This is 2nd PR to rename and refactor globals.
Signed-off-by: Myoungwon Oh myoungwon.oh@samsung.com
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
x
between the brackets:[x]
. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test dashboard cephadm
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox
jenkins test windows
jenkins test rook e2e