command: Update backend hash value only after a successful migration #29860
+132
−23
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.
Replaces #29856
Closes #26259
Closes #26260
The
Meta.backend_C_r_S_unchanged()
method was sadly pulling too many duties.It seems to have originally been used as a method to be called when the backend is not changing, with an extra assumption that if the configured backend's hash doesn't match the one in state, surely the hash should just be updated as an option might have been moved to command line flags.
However, this function was used throughout this file as 'the method to load the initialized (but not necessarily configured) backend', regardless of whether or not it is the same (unchanged). This is in addition to
Meta.backendFromState()
, which is used to load the same thing except in the main codepath of 'init -backend=false'.These changes separate the concerns of backend_C_r_S_unchanged() by
savedBackend()
)updateSavedBackendHash()
)This allows migration codepaths to not update the hash value until after a migration has successfully taken place.
Although it would make sense to incoporate
Meta.backendFromState()
in to this shared API, I've left that alone as it's not consequential to the specific bug we're after here.