pulumi/pkg/resource
pat@pulumi.com 1d9fa045cb Fix plan snapshotting.
When producing a snapshot for a plan, we have two resource DAGs. One of
these is the base DAG for the plan; the other is the current DAG for the
plan. Any resource r may be present in both DAGs. In order to produce a
snapshot, we need to merge these DAGs such that all resource
dependencies are correctly preserved. Conceptually, the merge proceeds
as follows:

- Begin with an empty merged DAG.
- For each resource r in the current DAG, insert r and its outgoing
  edges into the merged DAG.
- For each resource r in the base DAG:
    - If r is in the merged DAG, we are done: if the resource is in the
      merged DAG, it must have been in the current DAG, which accurately
      captures its current dependencies.
    - If r is not in the merged DAG, insert it and its outgoing edges
      into the merged DAG.

Physically, however, each DAG is represented as list of resources
without explicit dependency edges. In place of edges, it is assumed that
the list represents a valid topological sort of its source DAG. Thus,
any resource r at index i in a list L must be assumed to be dependent on
all resources in L with index j s.t. j < i. Due to this representation,
we implement the algorithm above as follows to produce a merged list
that represents a valid topological sort of the merged DAG:

- Begin with an empty merged list.
- For each resource r in the current list, append r to the merged list.
  r must be in a correct location in the merged list, as its position
  relative to its assumed dependencies has not changed.
- For each resource r in the base list:
    - If r is in the merged list, we are done by the logic given in the
      original algorithm.
    - If r is not in the merged list, append r to the merged list. r
      must be in a correct location in the merged list:
        - If any of r's dependencies were in the current list, they must
          already be in the merged list and their relative order w.r.t.
          r has not changed.
        - If any of r's dependencies were not in the current list, they
          must already be in the merged list, as they would have been
          appended to the list before r.

Prior to these changes, we had been performing these operations in
reverse order: we would start by appending any resources in the old list
that were not in the new list, then append the whole of the new list.
This caused out-of-order resources when a program that produced pending
deletions failed to run to completion.

Fixes #572.
2017-11-15 16:21:42 -08:00
..
config Encrypt secrets in Pulumi.yaml 2017-10-24 16:48:12 -07:00
deploy Fix plan snapshotting. 2017-11-15 16:21:42 -08:00
idl Bring LUMIDL up to code 2017-09-11 16:58:25 -07:00
plugin Stop formatting output that should be raw. 2017-11-14 11:26:41 -08:00
provider Initial work on tracing support (#521) 2017-11-08 17:08:51 -08:00
stack Fix where integration tests look for checkpoints 2017-10-27 19:42:17 -07:00
testdata Fix asset bugs; write more tests 2017-10-24 09:00:11 -07:00
asset.go Rework asset identity and exposure of old assets. (#548) 2017-11-12 11:45:13 -08:00
asset_test.go Rework asset identity and exposure of old assets. (#548) 2017-11-12 11:45:13 -08:00
errors.go Rename pulumi-fabric to pulumi 2017-09-21 19:18:21 -07:00
properties.go Add more context information to assert. (#449) 2017-10-24 08:25:39 -07:00
properties_diff.go Add diffing logic for assets/archives 2017-07-17 12:11:15 -07:00
properties_diff_test.go Rework asset identity and exposure of old assets. (#548) 2017-11-12 11:45:13 -08:00
properties_test.go Tolerate computed and output properties 2017-08-03 11:01:38 -07:00
resource_goal.go Add auto-parenting 2017-10-15 04:38:26 -07:00
resource_id.go Encrypt secrets in Pulumi.yaml 2017-10-24 16:48:12 -07:00
resource_id_test.go Permit -1 for randlen and maxlen 2017-07-15 09:59:44 -07:00
resource_state.go Track resources that are pending deletion in checkpoints. 2017-10-18 17:09:00 -07:00
status.go Wire up Lumi to the new runtime strategy 2017-09-04 11:35:21 -07:00
urn.go Rename pulumi-fabric to pulumi 2017-09-21 19:18:21 -07:00
urn_test.go Rename pulumi-fabric to pulumi 2017-09-21 19:18:21 -07:00