Include repo etags in transactions #3860
Merged
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.
Problem
In the course of investigating why available modules were missing in #3699, users shared their registries, which revealed that the server etags (see #2682) were getting out of sync with the available modules; users were ending up with old module lists but up-to-date etags. This meant that if they tried to Refresh immediately, it would say the list was already up to date, even though it wasn't.
Cause
I found this very confusing for quite a long while. That data is all part of the
Registry
object; shouldn't it all be saved toregistry.json
together or not at all? No! There is one specific scenario in which they can get out of sync:ReinstallModuleKraken
from Replace repo-reinst with kraken, handle in UIs #3344)Changes
In #3828 we eliminated this exception, so this is already functionally fixed, but architecturally it's still important to make the data objects behave properly.
Now the etags are saved by a new
Registry.SetETags
function, which callsEnlistWithTransaction
first, which will save off a copy of the registry with the original etags. This will ensure that if the registry is reverted in a transaction, the etags will accurately reflect the state of the available modules list.