yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #04492
[Bug 1212994] Re: redundant conditions in paginate-query
** Changed in: glance
Status: Fix Committed => Fix Released
** Changed in: glance
Milestone: None => havana-3
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1212994
Title:
redundant conditions in paginate-query
Status in OpenStack Image Registry and Delivery Service (Glance):
Fix Released
Bug description:
For a list call on images, when a sort_key is applied, the query
generated has redundant values for 'created_at' condition. This
happens when there are duplicate values in the sort_keys list. eg) The
following is the query captured for a simple image_get_all with a
marker image provided:
SELECT anon_1.images_created_at AS anon_1_images_created_at, anon_1.images_updated_at AS anon_1_images_updated_at, anon_1.images_deleted_at AS anon_1_images_deleted_at, anon_1.images_deleted AS anon_1_images_deleted, anon_1.images_id AS anon_1_images_id, anon_1.images_name AS anon_1_images_name, anon_1.images_disk_format AS anon_1_images_disk_format, anon_1.images_container_format AS anon_1_images_container_format, anon_1.images_size AS anon_1_images_size, anon_1.images_status AS anon_1_images_status, anon_1.images_is_public AS anon_1_images_is_public, anon_1.images_checksum AS anon_1_images_checksum, anon_1.images_min_disk AS anon_1_images_min_disk, anon_1.images_min_ram AS anon_1_images_min_ram, anon_1.images_owner AS anon_1_images_owner, anon_1.images_protected AS anon_1_images_protected
FROM (SELECT images.created_at AS images_created_at, images.updated_at AS images_updated_at, images.deleted_at AS images_deleted_at, images.deleted AS images_deleted, images.id AS images_id, images.name AS images_name, images.disk_format AS images_disk_format, images.container_format AS images_container_format, images.size AS images_size, images.status AS images_status, images.is_public AS images_is_public, images.checksum AS images_checksum, images.min_disk AS images_min_disk, images.min_ram AS images_min_ram, images.owner AS images_owner, images.protected AS images_protected
FROM images
WHERE images.is_public = :is_public_1 UNION SELECT images.created_at AS images_created_at, images.updated_at AS images_updated_at, images.deleted_at AS images_deleted_at, images.deleted AS images_deleted, images.id AS images_id, images.name AS images_name, images.disk_format AS images_disk_format, images.container_format AS images_container_format, images.size AS images_size, images.status AS images_status, images.is_public AS images_is_public, images.checksum AS images_checksum, images.min_disk AS images_min_disk, images.min_ram AS images_min_ram, images.owner AS images_owner, images.protected AS images_protected
FROM images JOIN image_members ON images.id = image_members.image_id
WHERE image_members.deleted = :deleted_1) AS anon_1
WHERE CASE WHEN (anon_1.images_created_at IS NOT NULL) THEN anon_1.images_created_at ELSE :param_1 END < :param_2 OR CASE WHEN (anon_1.images_created_at IS NOT NULL) THEN anon_1.images_created_at ELSE :param_3 END = :param_4 AND CASE WHEN (anon_1.images_created_at IS NOT NULL) THEN anon_1.images_created_at ELSE :param_5 END < :param_6 OR CASE WHEN (anon_1.images_created_at IS NOT NULL) THEN anon_1.images_created_at ELSE :param_7 END = :param_8 AND CASE WHEN (anon_1.images_created_at IS NOT NULL) THEN anon_1.images_created_at ELSE :param_9 END = :param_10 AND CASE WHEN (anon_1.images_id IS NOT NULL) THEN anon_1.images_id ELSE :param_11 END < :param_12 ORDER BY anon_1.images_created_at DESC, anon_1.images_created_at DESC, anon_1.images_id DESC
Note the multiple 'created_at' condition in the final WHERE clause.
This should be fixed.
To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1212994/+subscriptions