Comment 8 for bug 2037107

Revision history for this message
Max (maxlamprecht) wrote :

Hi Rodolfo,

thx for the fast reply :)
I like the proposed solution to just get the subnet.shared field from the network view.

But we should also check the network_rbacs loading for networks.
I checked the code now a few times and it seems that the group_by is also not working in the network view.

I attached a PDB snipped with the sql queries [1].
Here we can see that the group_by does not work
-> It moves the grouping/filtering to a subquery (also the previous WHERE condition)
-> after the subquery there is still a left outer join to networkrbacs
=> 4000 results instead amount of networks

I guess that sqlalchemy does that because we specify lazy='joined' at the orm model and also have the outerjoin in line [2]
-> so sqlalchemy excepts a "full" join to the left table(networkrbacs)

This means that if we use group_by like in the current implementation it will not help.

[1] https://paste.opendev.org/show/bCCkZ01zquynsUm6lUSw/
[2] https://review.opendev.org/c/openstack/neutron-lib/+/884878/1/neutron_lib/db/model_query.py#125

Best regards
Max