Only write to template files if template data changes
Currently the template data is assigned to the files dict regardless of whether the data has changed or not. This has no consequence on Liberty, but the files dict in Kilo and Juno is a sqlalchemy MutableDict so these assignments are triggering updates to the raw_template table. These updates are even triggered for calls to heat resource-list. With large raw_template records this can make heat unusable. Therefore this fix is presented here as having no effect (and being harmless) to git master, but high priority backports for Kilo and Juno. Change-Id: Ibb714a9c5dc9f6879ff108419127da985a57897b Closes-Bug: #1494108
This commit is contained in:
parent
a8ae73b35e
commit
779ba8e431
|
@ -189,6 +189,7 @@ class TemplateResource(stack_resource.StackResource):
|
|||
# 3. look in the db
|
||||
reported_excp = None
|
||||
t_data = self.stack.t.files.get(self.template_name)
|
||||
stored_t_data = t_data
|
||||
if not t_data and self.template_name.endswith((".yaml", ".template")):
|
||||
try:
|
||||
t_data = self.get_template_file(self.template_name,
|
||||
|
@ -203,7 +204,8 @@ class TemplateResource(stack_resource.StackResource):
|
|||
t_data = jsonutils.dumps(self.nested().t.t)
|
||||
|
||||
if t_data is not None:
|
||||
self.stack.t.files[self.template_name] = t_data
|
||||
if t_data != stored_t_data:
|
||||
self.stack.t.files[self.template_name] = t_data
|
||||
self.stack.t.env.register_class(self.resource_type,
|
||||
self.template_name,
|
||||
path=self.resource_path)
|
||||
|
|
Loading…
Reference in New Issue