Test for breaking ties in paging is wrong (?)

Bug #930544 reported by justinsb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
justinsb

Bug Description

In registry/db/api.py we have this code:

       if sort_dir == 'desc':
            query = query.filter(
                or_(sort_key_attr < marker_value,
                    and_(sort_key_attr == marker_value,
                         models.Image.created_at < marker_image.created_at,
                         models.Image.id < marker)))
        else:
            query = query.filter(
                or_(sort_key_attr > marker_value,
                    and_(sort_key_attr == marker_value,
                         models.Image.created_at > marker_image.created_at,
                         models.Image.id > marker)))

I think there's a few problems here:

Normally the sort_key_attr is created_at. So the second test will never match, because created_at cannot be < X and == X.

I think this should be:
                      models.Image.created_at <= marker_image.created_at,

Further, I think the second test should also be <=, not >, because I think this is supposed to be checking for chronological order (i.e. we don't get 'new' results injected into a previous search) ?

This is related to, but different from Bug #930543. Using the same hack to force the timestamps the same shows up the problems here.

Changed in glance:
assignee: nobody → justinsb (justin-fathomdb)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/4045

Changed in glance:
status: New → In Progress
Jay Pipes (jaypipes)
Changed in glance:
milestone: none → essex-4
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/4045
Committed: http://github.com/openstack/glance/commit/7990cb4e0c0528f6d4694fa0faf81597ea56d6ba
Submitter: Jenkins
Branch: master

commit 7990cb4e0c0528f6d4694fa0faf81597ea56d6ba
Author: Justin Santa Barbara <email address hidden>
Date: Mon Feb 13 13:27:44 2012 -0800

    Fix paging ties

    Bug #930543
    Bug #930544

    Change-Id: Ifad1ea61f3ecbf58af9bc7f0bc635e69246f6ece

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.