Don't store pipeline references on builds
On full and tenant reconfiguration, we construct new pipeline objects
and re-enqueue all of the items into them. Because of this, we need
to be careful with references to pipelines. Generally we use the
forward references from the Layout, but we also regularly make use
of backward references from QueueItems. When we re-enqueue items
we take care to update these backward references (or clear them
if we are unable to re-enqueue them).
Unfortunately, we missed another backward reference, those from
Build objects. This cas cause old pipelines (and, because they
have backward references to their layouts, entire old layouts) to
persist as long as there is a build in the system referencing them.
And because we keep all of the builds for an item in the previous
buildset records, that can be as long as an item is in the system.
Which can be a very long time on bad days.
To correct, remove the pipeline backref from Build and replace it
with a property method which finds the pipeline by way of the
build's buildset and then its item, which should be safely updated
on re-enqueing, as described above.
Add a test which verifies no extra pipeline objects persist.
Change-Id: I837c0eb8f49ea238a1d5ca2435acb8b245f4a871
2 files changed