From e2d68e39f5e62be9ca8a247b3f957e5e2d4ec3a3 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Date: Tue, 4 Feb 2025 09:49:14 +0000 Subject: [PATCH] Revert "Change the ``StandardAttribute`` load method to "selectin"" This reverts commit 7f702af482b6b47f2fe74a8b475fb2a23cb5f7a4. Reason for revert: this patch was introduced to make the database produced code compatible with PostgreSQL. During this cycle we dropped the support for this backend. This patch is probably introducing a race condition when retrieving the port standard attributes because these are retrieved in a second SQL query (lazy='selectin'). In order to keep a healthy database engine, supporting MariaDB/MySQL, it is better to retrieve the selected field in the ``port`` retrieval query instead of issuing a delayed second one. Closes-Bug: #2093258 Change-Id: Ida5afffb808597aa09cc62984b36189a8bf409a0 --- neutron_lib/db/standard_attr.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/neutron_lib/db/standard_attr.py b/neutron_lib/db/standard_attr.py index ca88fcc4b..f33b1fb36 100644 --- a/neutron_lib/db/standard_attr.py +++ b/neutron_lib/db/standard_attr.py @@ -152,11 +152,8 @@ class HasStandardAttributes: # pylint: disable=method-hidden @declarative.declared_attr def standard_attr(cls): - # NOTE(ralonsoh): the load method has been updated from "joined" to - # "selectin". The first provides more complex queries but it is only - # needed one query. return sa.orm.relationship(StandardAttribute, - lazy='selectin', + lazy='joined', cascade='all, delete-orphan', single_parent=True, uselist=False)