Skip to content
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

Make use of ProcessHistoryRegistry thread safe #927

Merged

Conversation

Dr15Jones
Copy link
Contributor

Made sure that the ProcessHistoryRegistry was replicated sufficiently so that no thread would be updating a registry while a different thread could be attempting to read it.

To allow for thread-safe uses of the ProcessHistoryRegistry, the HistoryAppender no longer updates the ProcessHistoryRegistry to hold its appended history. Now it just returns a shared_ptr to the new or cached ProcessHistory. The shared_ptr is now owned by all Principals which are currently processing with that history.
To simplify the sharing, we only cache the last ProcessHistory and no longer hold a map to all previously seen histories. This will allow us to have one HistoryAppender per Stream when used by the SubProcess.
The HistoryAppender now returns a shared_ptr<ProcessHistory const> so processHistoryPtr_ was changed to match. In addition, the fillPrincipal function no longer needs to modify the ProcessHistoryRegistry so the argument is now const.
The underlying Principal::fillPrincipal no longer modifies the ProcessHistoryRegistry and therefore takes a const reference. The fill*Principal methods were updated to match. This makes it clearer when reasoning about thread safety.
…egistry and RunPrincipal now holds the reducedProcessHistoryID

-Principal::fillPrincipal no longer modifies the ProcessHistoryRegistry so now takes a const argument. fillRunPrincipal was updated to match.
-The RunPrincipal now holds onto the reducedProcessHistoryID which is used to uniquely identify a Run. This makes identification of a Run easier for the SubProcess when it is time to write that Run.
Now has its own copy of the ProcessHistoryRegistry as preparation for thread-safety. As part of the change, now get the parent’s reducedProcessHistoryID from the RunPrincipal and not from the parent ProcessHistoryRegistry (which is no longer accessible).
Full thread-safety will require each Stream to have its own ProcessHistoryRegistry and HistoryAppender.
…tory from RunPrincipal

The SubProcess no longer takes a ProcessHistoryRegistry as an argument to its constructor since it now has its own internal copy. This avoids possible updates of a ProcessHistoryRegistry from different threads.
In addition, RunPrincipal now holds its reducedProcessHistoryID so the EventProcessor now uses it from the RunPrincipal and not the Source.
The various fill*Principal member functions were changed to take a const ProcessHistoryRegistry. This change just swaps out using processHistoryRegistryForUpdate() and now use processHistoryRegistry() to make it clear that no change is required.
If the SubProcess had only one ProcessHistoryRegistry, that registry could be updating at the same time the HistoryAppender was reading from it. Therefore we need separate ProcessHistoryRegistry and HistoryAppender for each concurrent Run, Lumi and Stream.
Attempt to do a rebase failed without an adequate explanation from git as to why it failed.
@Dr15Jones
Copy link
Contributor Author

+1

All framework unit tests pass.

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next IBs unless changes or unless it breaks tests. @ktf can you please take care of it?

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next IBs unless changes or unless it breaks tests. @ktf can you please take care of it?

ktf added a commit that referenced this pull request Sep 27, 2013
…adSafe

Make use of ProcessHistoryRegistry thread safe
@ktf ktf merged commit 3304247 into cms-sw:CMSSW_7_0_X Sep 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants