Public bug reported: Currently, when Neutron executes DB transaction, if there is no active session (or session at all), ``neutron_lib.context.Context`` creates a default writer session [1].
That's a safeguard for the code written in Neutron but an inefficient way to access to the DB. Reader context allows, for example, the ASYNC_READER mode: """ This state indicates that the transaction is a read-only and is safe to use on an asynchronously updated slave database. """ That is supposed to be less blocking than a writer context. When the ``neutron_lib.context.Context.session`` property is removed, if a transaction is not correctly executed inside a context (reader or writer), the transaction fails. This bug is just a tracker for all the patches needed to decorate all the DB transactions. [1]https://github.com/openstack/neutron-lib/blob/c2879ec1739d1425bcc762d4b6584ee241f995ca/neutron_lib/context.py#L157-L161 [2]https://review.opendev.org/c/openstack/neutron-lib/+/791978/4/neutron_lib/context.py#b142 ** Affects: neutron Importance: Wishlist Status: New ** Changed in: neutron Importance: Undecided => Wishlist -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1933321 Title: Explicitly provide a DB context when executing a DB transaction Status in neutron: New Bug description: Currently, when Neutron executes DB transaction, if there is no active session (or session at all), ``neutron_lib.context.Context`` creates a default writer session [1]. That's a safeguard for the code written in Neutron but an inefficient way to access to the DB. Reader context allows, for example, the ASYNC_READER mode: """ This state indicates that the transaction is a read-only and is safe to use on an asynchronously updated slave database. """ That is supposed to be less blocking than a writer context. When the ``neutron_lib.context.Context.session`` property is removed, if a transaction is not correctly executed inside a context (reader or writer), the transaction fails. This bug is just a tracker for all the patches needed to decorate all the DB transactions. [1]https://github.com/openstack/neutron-lib/blob/c2879ec1739d1425bcc762d4b6584ee241f995ca/neutron_lib/context.py#L157-L161 [2]https://review.opendev.org/c/openstack/neutron-lib/+/791978/4/neutron_lib/context.py#b142 To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1933321/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp