Stop using nested transactions in OVO get/delete
Nested transactions have unnecessary overhead of starting new transactions in the database and the only place we need them are where we expect duplicate violations during create/update. This gets rid of them for get_objects and delete_objects so we don't adopt additional unnecessary overhead in OVO adoption. Before this patch, update_port calls were resulting in several independent nested transactions that each require multiple round trips to the database. Change-Id: Icbfe678b6f6ebcdcd7f7ca71f6ac5febb64bdaa3 Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
This commit is contained in:
parent
31d24b4e1a
commit
72ac25c929
|
@ -432,7 +432,7 @@ class NeutronDbObject(NeutronObject):
|
|||
raise o_exc.NeutronPrimaryKeyMissing(object_class=cls.__name__,
|
||||
missing_keys=missing_keys)
|
||||
|
||||
with db_api.autonested_transaction(context.session):
|
||||
with context.session.begin(subtransactions=True):
|
||||
db_obj = obj_db_api.get_object(
|
||||
context, cls.db_model,
|
||||
**cls.modify_fields_to_db(kwargs)
|
||||
|
@ -456,7 +456,7 @@ class NeutronDbObject(NeutronObject):
|
|||
"""
|
||||
if validate_filters:
|
||||
cls.validate_filters(**kwargs)
|
||||
with db_api.autonested_transaction(context.session):
|
||||
with context.session.begin(subtransactions=True):
|
||||
db_objs = obj_db_api.get_objects(
|
||||
context, cls.db_model, _pager=_pager,
|
||||
**cls.modify_fields_to_db(kwargs)
|
||||
|
@ -503,7 +503,7 @@ class NeutronDbObject(NeutronObject):
|
|||
"""
|
||||
if validate_filters:
|
||||
cls.validate_filters(**kwargs)
|
||||
with db_api.autonested_transaction(context.session):
|
||||
with context.session.begin(subtransactions=True):
|
||||
return obj_db_api.delete_objects(
|
||||
context, cls.db_model, **cls.modify_fields_to_db(kwargs))
|
||||
|
||||
|
|
Loading…
Reference in New Issue