[openstack-dev] [nova] Consistency, efficiency, and safety of NovaObject.save()
Matthew Booth
mbooth at redhat.com
Thu Nov 13 10:09:17 UTC 2014
On 13/11/14 08:52, Nikola Đipanov wrote:
> 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()
Yes, this is one example, another is Aggregate. I already had a big list
in the post and didn't want a second one.
Matt
--
Matthew Booth
Red Hat Engineering, Virtualisation Team
Phone: +442070094448 (UK)
GPG ID: D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
More information about the OpenStack-dev
mailing list