pulumi/pkg/engine
Pat Gavlin bac11495cd
[engine] Only record a resource's chosen alias. (#9288)
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.
2022-03-28 08:36:08 -07:00
..
lifeycletest [engine] Only record a resource's chosen alias. (#9288) 2022-03-28 08:36:08 -07:00
deployment.go Preview of update plans (#8448) 2022-01-31 10:31:51 +00:00
destroy.go Preview of update plans (#8448) 2022-01-31 10:31:51 +00:00
diff.go Bold in-progress diffs diffrently (#7918) 2021-09-28 15:16:09 -07:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
engine.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
errors.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
events.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
eventsink.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
import.go Preview of update plans (#8448) 2022-01-31 10:31:51 +00:00
journal.go [engine] Only record a resource's chosen alias. (#9288) 2022-03-28 08:36:08 -07:00
plugin_host.go Update error handling (#8406) 2021-11-12 18:37:17 -08:00
plugins.go [plugins] Fix plugin reinstallation. (#8892) 2022-02-02 23:10:16 -08:00
plugins_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
project.go Update error handling (#8406) 2021-11-12 18:37:17 -08:00
query.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
refresh.go Preview of update plans (#8448) 2022-01-31 10:31:51 +00:00
snapshot.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
update.go Preview of update plans (#8448) 2022-01-31 10:31:51 +00:00
update_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00