-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Migrate to the new ref. based writeOneIOV() in Alignment package #35711
Migrate to the new ref. based writeOneIOV() in Alignment package #35711
Conversation
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35711/26019
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
@@ -377,7 +377,7 @@ void SiStripBackplaneCalibration::endOfJob() { | |||
if (saveToDB_) { // If requested, write out to DB | |||
edm::Service<cond::service::PoolDBOutputService> dbService; | |||
if (dbService.isAvailable()) { | |||
dbService->writeOne(output, firstRunOfIOV, recordNameDBwrite_); | |||
dbService->writeOneIOV(*output, firstRunOfIOV, recordNameDBwrite_); |
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.
dbService->writeOneIOV(*output, firstRunOfIOV, recordNameDBwrite_); | |
dbService->writeOneIOV(&output, firstRunOfIOV, recordNameDBwrite_); |
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.
L333 SiStripBackPlaneCorrection *output = new SiStripBackPlaneCorrection;
Here output is a pointer.
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.
Yes, and we want to pass the reference to that pointer instead, as you write in the title of the PR. We can chat about this in our skype if you want @yuanchao
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.
@tvami Then "output" should be created as a normal instance of SiStripBackPlaneCorrection. And the rest of the code needs to be modify to cope with it. Or the client needs to delete this obj. somewhere later when no further usage. (ex. move L383 "delete output" out of the else{} before L387) That's what @GiacomoSguazzoni and I just discussed on skype. (in either cases, it can't be done easily with scripts)
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 am not sure this piece of code is actually tested in unit test.
How can we make sure it's not broken by the updates?
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.
the Call with *output is the one correct, but make sure the object is deleted at the end of its use. The method by reference (writeOnIOV) does not 'see' pointers, so it can't take care about the delete!
Hi @yuanchao I think you changed to the pointer many time when you should have kept the reference, no? |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35711/26024
|
A new Pull Request was created by @yuanchao (Yuan CHAO) for master. It involves the following packages:
@cmsbuild, @malbouis, @tvami, @yuanchao, @francescobrivio can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
@cmsbuild please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-7367f9/19706/summary.html CMS StaticAnalyzer warnings: There are 11 EventSetupRecord::get warnings. See https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-7367f9/19706/llvm-analysis/esrget-sa.txt for details. Comparison SummarySummary:
|
-alca
|
PR description:
The new reference based method of the DBOutputService, writeOneIOV(), is introduced to keep the ownership of DB payload at the client side. The client will need to take care of the object memory. This PR migrates the old method, writeOne(), to writeOneIOV() in the following code:
** Please note that for payload objects created with 'new' function are not freed!
PR validation:
Code compiles.
if this PR is a backport please specify the original PR and why you need to backport that PR:
Not a backport and no backport is foreseen.