Skip to content
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

[engine] Only record a resource's chosen alias. #9288

Merged
merged 2 commits into from Mar 28, 2022

Commits on Mar 25, 2022

  1. [engine] Only record a resource's chosen alias.

    As we discovered when removing aliases from the state entirely, the
    snapshotter needs to be alias-aware so that it can fix up references to
    resources that were aliased. After a resource operation finishes, the
    snapshotter needs to write out a new copy of the snapshot. However, at
    the time we write the snapshot, there may be resources that have not yet
    been registered that refer to the just-registered resources by a
    different URN due to aliasing. Those references need to be fixed up
    prior to writing the snapshot in order to preserve the snapshot's
    integrity (in particular, the property that all URNs refer to resources
    that exist in the snapshot).
    
    For example, consider the following simple dependency graph: A <-- B.
    When that graph is serialized, B will contain a reference to A in its
    dependency list. Let the next run of the program produces the graph A'
    <-- B where A' is aliased to A. After A' is registered, the snapshotter
    needs to write a snapshot that contains its state, but B must also be
    updated so it references A' instead of A, which will no longer be in the
    snapshot.
    
    These changes take advantage of the fact that although a resource can
    provide multiple aliases, it can only ever resolve those aliases to a
    single resource in the existing state. Therefore, at the time the
    statefile is fixed up, each resource in the statefile could only have
    been aliased to a single old resource, and it is sufficient to store
    only the URN of the chosen resource rather than all possible aliases. In
    addition to preserving the ability to fix up references to aliased
    resources, retaining the chosen alias allows the history of a logical
    resource to be followed across aliases.
    pgavlin committed Mar 25, 2022
    Configuration menu
    Copy the full SHA
    3442463 View commit details
    Browse the repository at this point in the history
  2. PR feedback

    pgavlin committed Mar 25, 2022
    Configuration menu
    Copy the full SHA
    0890634 View commit details
    Browse the repository at this point in the history