-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Settings streams exchange semantics #1534
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghost
added
the
Issue-Bug
It either shouldn't be doing this or needs an investigation.
label
Oct 1, 2021
yao-msft
reviewed
Oct 4, 2021
yao-msft
reviewed
Oct 4, 2021
yao-msft
reviewed
Oct 4, 2021
yao-msft
approved these changes
Oct 4, 2021
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #463
Change
The goal of this change is to add exchange semantics to settings stream writes. Currently they do not have any interprocess synchronization. This does not lead to corrupted streams as the underlying systems prevent simultaneous writes, but it can lead to data loss if updates from one process are not merged with those from another.
Because holding any kind of lock would likely lead to contention amongst the processes, we use exchange semantics instead. Writes are only permitted if the stream has not changed since it was last read. This required moving to a more object oriented model for the settings streams, which then required updating the consumers of it to also maintain an object and respond to failed write attempts.
The update to
AdminSettings
was fairly straightforward, requiring just the necessary interface updates and the exchange retry loop.For
SourceListInternal
, I also refactored the code out ofRepositorySource.cpp
which was getting quite large. I moved the group policy related functions to their own file (SourcePolicy.cpp
) and the source enumeration related functions to theirs (SourceList.cpp
). The renamedSourceList
type now maintains the stream objects for its lifetime and manages the necessary exchange retry attempts for the various writes that are required.Validation
New unit tests are added to validate the code under controlled circumstances. Functional tests would be impractical to write as the actual interactions are races between various writes, although the configurable test source that was added recently would aid in this area.
Microsoft Reviewers: Open in CodeFlow