[openstack-dev] [nova] Consistency, efficiency, and safety of NovaObject.save()
Nikola Đipanov
ndipanov at redhat.com
Thu Nov 13 08:52:02 UTC 2014
On 11/13/2014 02:45 AM, Dan Smith wrote:
>> I’m not sure if I’m seeing the second SELECT here either but I’m less
>> familiar with what I’m looking at. compute_node_update() does the
>> one SELECT as we said, then it doesn’t look like
>> self._from_db_object() would emit any further SQL specific to that
>> row.
>
> I don't think you're missing anything. I don't see anything in that
> object code, or the other db/sqlalchemy/api.py code that looks like a
> second select. Perhaps he was referring to two *queries*, being the
> initial select and the following update?
>
FWIW - I think an example Matt was giving me yesterday was block devices
where we have:
@require_context
def block_device_mapping_update(context, bdm_id, values, legacy=True):
_scrub_empty_str_values(values, ['volume_size'])
values = _from_legacy_values(values, legacy, allow_updates=True)
query =_block_device_mapping_get_query(context).filter_by(id=bdm_id)
query.update(values)
return query.first()
which gets called from object save()
N.
More information about the OpenStack-dev
mailing list