Comment 64 for bug 1918145

Revision history for this message
LEDUC Florian (leducflorian) wrote :

Regarding your last comment, we have used this approach for two ORM objects for stable/ussuri back then:

------------------------------------------------------------------------

--- a/neutron/db/models/segment.py
+++ b/neutron/db/models/segment.py
@@ -69,11 +69,9 @@ class SegmentHostMapping(model_base.BASEV2):

     # Add a relationship to the NetworkSegment model in order to instruct
     # SQLAlchemy to eagerly load this association
- # Monkey-patch : change the lazy strategy from 'subquery' to 'joined'
- # as MariaDB 10.3 don't use an optimal execution plan with 'subquery'
     network_segment = orm.relationship(
         NetworkSegment, load_on_pending=True,
         backref=orm.backref("segment_host_mapping",
- lazy='joined',
+ lazy='subquery',
                             cascade='delete'))
     revises_on_change = ('network_segment', )

------------------------------------------------------------------------
--- a/neutron/db/models/segment.py
+++ b/neutron/db/models/segment.py
@@ -49,7 +49,7 @@ class NetworkSegment(standard_attr.HasStandardAttributes,
                      nullable=True)
     network = orm.relationship(models_v2.Network,
                                backref=orm.backref("segments",
- lazy='subquery',
+ lazy='joined',
                                                    cascade='delete'))
     api_collections = [segment.SEGMENTS]