Cache the TemplateResource reference ID like an attribute
TemplateResources can have their reference ID defined by an OS::stack_id
output in the template. However getting it - or just checking that it even
exists - is very expensive, and it happens virtually every time we load the
stack in memory for any reason.
Since when the output is present the reference ID is also available as an
attribute, simply cache it in the database as if it were an attribute
regardless of whether the output exists. Once it is in the cache,
subsequent accesses will be cheap just like they are for attributes.
Keep previous performance optimisations in place as well, since attributes
are not stored in the database in the legacy path (so legacy stacks don't
benefit from this change), and since the cache does get invalidated e.g. on
every stack update.
Reviewed: https:/ /review. openstack. org/533047 /git.openstack. org/cgit/ openstack/ heat/commit/ ?id=3cd84afcfc7 1ad41dceb15619a 3c89ce21db605c
Committed: https:/
Submitter: Zuul
Branch: master
commit 3cd84afcfc71ad4 1dceb15619a3c89 ce21db605c
Author: Zane Bitter <email address hidden>
Date: Thu Jan 11 20:11:04 2018 -0500
Cache the TemplateResource reference ID like an attribute
TemplateRes ources can have their reference ID defined by an OS::stack_id
output in the template. However getting it - or just checking that it even
exists - is very expensive, and it happens virtually every time we load the
stack in memory for any reason.
Since when the output is present the reference ID is also available as an
attribute, simply cache it in the database as if it were an attribute
regardless of whether the output exists. Once it is in the cache,
subsequent accesses will be cheap just like they are for attributes.
Keep previous performance optimisations in place as well, since attributes
are not stored in the database in the legacy path (so legacy stacks don't
benefit from this change), and since the cache does get invalidated e.g. on
every stack update.
Change-Id: Ib9cd0aa40d377e c227754e386e02f 185fd871909
Closes-Bug: #1742847
Related-Bug: #1719333