Browse Source

Increment resource atomic key when storing attributes

When we store resource attribute values in the database, we increment the
atomic_key in the DB. This means we should also increment the _atomic_key
member of the Resource object, so that any future writes to the database
will expect the correct key.

In practice, this doesn't matter because there's no RPC API call that
stores attributes and then writes to the resource in the database for other
reasons. (Attributes are updated if they are missing on show-stack with
outputs, which is otherwise a read-only call; they're also updated at the
very end of a check-resource call in convergence.) But by maintaining a
consistent model this could help to prevent future bugs.

Change-Id: I71ed5907d33f2293c04ad3bace639b1d114e9a77
Related-Bug: #1763021
changes/17/560417/1
Zane Bitter 4 years ago
parent
commit
d5eb7c83ef
  1. 1
      heat/engine/resource.py

1
heat/engine/resource.py

@ -2345,6 +2345,7 @@ class Resource(status.ResourceStatus):
self.context, self.id, self._atomic_key,
self.attributes.cached_attrs, self._attr_data_id)
if attr_data_id is not None:
self._incr_atomic_key(self._atomic_key)
self._attr_data_id = attr_data_id
except Exception as ex:
LOG.error('store_attributes rsrc %(name)s %(id)s DB error %(ex)s',

Loading…
Cancel
Save