Comment 1 for bug 1255607

Revision history for this message
Raildo Mascena de Sousa Filho (raildo) wrote :

After analyzing, I noticed that bug #1255607 this get call is unnecessary.
https://github.com/openstack/glance/blob/master/glance/db/__init__.py#L236

But after looking deeper at the code, I realized that create_member
https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L956
and update_member
https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L976

are routed to the same call:
https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L984

So there will never be a duplicate query, as if the member does not exist it creates a new one, if the member exists it is an update, so the constrain to deny duplication that exists but will never be used.
https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/models.py#L198

In short I believe we have two solutions:

1 - just remove the get, because with the current implementation it is never duplicated in the table, however the functionality of create and update member are the same, which it seems is conceptually wrong.

2- create a different call from member-create in the API and in the client where will be done an insert in the table "image_members" and the treatment will be done to deny duplicate and create a new call member-update that will be an update on the table.