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
This commit is contained in:
Rodolfo Alonso 2025-02-04 09:49:14 +00:00 committed by Rodolfo Alonso Hernandez
parent 4b30a94c88
commit e2d68e39f5

View File

@ -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)