Remove old buildsets

Buildsets contain references to the dependent items at the time
they were created.  If an item is re-enqueued due to reconfiguration,
(or any other circumstance about the item's position in the pipeline
changes), a new buildset will be created, and the item updated.  Old
buildsets are kept around as an attribute of the item.

The layout is an attribute of the item, and during reconfiguration,
all items currently in pipelines are updated, so we won't have stale
layouts on these items.  However, previous build sets may have
lists of dependent items which, if they are no longer currently in
a pipeline, will not have been updated.  Old build sets may have much
longer lists of dependent items than the current build set.  In fact,
with the right timing for adding new entries to a dependent pipeline
and reconfigurations, an infinite chain of overlapping dependent item
lists could be constructed.

By dropping references to previous buildsets, we can drop references
to old layouts sooner because the dependent items list on current
build sets should generally not grow without bound, and only contain
a moderate number of references to items no longer in pipelines.

An idea for a future change would be to look into whether the dependent
items list could be deleted sooner, or the cost of maintining it
reduced.

Change-Id: I958e1feabda24ae61d66f6b4dc36442c6d0a606b
This commit is contained in:
James E. Blair 2017-10-18 17:30:19 -07:00
parent 8fe53b4441
commit 4e91418458

View File

@ -1263,8 +1263,6 @@ class BuildSet(object):
self.item = item
self.builds = {}
self.result = None
self.next_build_set = None
self.previous_build_set = None
self.uuid = None
self.commit = None
self.dependent_items = None
@ -1402,10 +1400,8 @@ class QueueItem(object):
self.pipeline = queue.pipeline
self.queue = queue
self.change = change # a ref
self.build_sets = []
self.dequeued_needing_change = False
self.current_build_set = BuildSet(self)
self.build_sets.append(self.current_build_set)
self.item_ahead = None
self.items_behind = []
self.enqueue_time = None
@ -1427,12 +1423,7 @@ class QueueItem(object):
id(self), self.change, pipeline)
def resetAllBuilds(self):
old = self.current_build_set
self.current_build_set.result = 'CANCELED'
self.current_build_set = BuildSet(self)
old.next_build_set = self.current_build_set
self.current_build_set.previous_build_set = old
self.build_sets.append(self.current_build_set)
self.layout = None
self.job_graph = None