mirror of https://github.com/pulumi/pulumi.git
d18b59e9c6
The dependency graph used to determine the set of resources that depend on a resource being DBR'd is constructured from the list of resource states present in the old snapshot. However, the dependencies of resources that are present in both the old snapshot and the current plan can be different, which in turn can cause the engine to make incorrect decisions during DBR with respect to which resources need to be replaced. For example, consider the following program: ``` var resA = new Resource("a", {dbr: "foo"}); var resB = new Resource("b", {dbr: resA.prop}); ``` If this program is then changed to: ``` var resB = new Resource("b", {dbr: "<literal value of resA.prop>"}); var resA = new Resource("a", {dbr: "bar"}); ``` The engine will first decide to make no changes to "b", as its input property values have not changed. "b" has changed, however, such that it no longer has a dependency on "a". The engine will then decide to DBR "a". In the process, it will determine that it first needs to delete "b", because the state for "b" that is used when calculating "a"'s dependents does not reflect the changes made during the plan. To fix this issue, we rely on the observation that dependents can only have been _removed_ from the base dependency graph: for a dependent to have been added, it would have had to have been registered prior to the root--a resource it depends on--which is not a valid operation. This means that any resources that depend on the root must not yet have been registered, which in turn implies that resources that have already been registered must not depend on the root. Thus, we ignore these resources if they are encountered while walking the old dependency graph to determine the set of dependents. |
||
---|---|---|
.. | ||
dependency_graph.go | ||
dependency_graph_test.go | ||
resource_set.go | ||
resource_set_test.go |