• Chris Arcand's avatar
    command: Don't always update backend hash when fetching the saved backend · 7c0c2e95
    Chris Arcand authored
    The Meta.backend_C_r_S_unchanged() method was sadly a bit of a mess.
    
    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
    
    1) Fetching the saved backend (savedBackend())
    2) Updating the hash value in the backend cache when appropriate (either
       by leaving it to the caller to do themselves or by calling
       updateSavedupdateSavedBackendHash())
    
    This allows migration codepaths to *not* update the hash value until
    after a migration has successfully taken place.
    7c0c2e95