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
This commit is contained in:
Zane Bitter 2018-04-11 09:23:22 -04:00
parent 2c63287420
commit d5eb7c83ef
1 changed files with 1 additions and 0 deletions

View File

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