Repository navigation
Settings streams exchange semantics - #1534
Merged
Merged
Conversation
yao-msft
reviewed
Oct 4, 2021
yao-msft
reviewed
Oct 4, 2021
yao-msft
reviewed
Oct 4, 2021
This file contains hidden or 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
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
AdminSettingswas fairly straightforward, requiring just the necessary interface updates and the exchange retry loop.For
SourceListInternal, I also refactored the code out ofRepositorySource.cppwhich 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 renamedSourceListtype 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