[openstack-dev] [ ceilometer] The Pagination patches

Jay Pipes jaypipes at gmail.com
Sun Jan 12 21:09:38 UTC 2014


On Fri, 2014-01-10 at 03:31 +0000, Gao, Fengqian wrote:
> Since we still have no new conclusion for pagination for now, shall we
> still go on with the current pagination solution?
> 
> Please help to review patches:
> 
> https://review.openstack.org/#/c/41869/
> https://review.openstack.org/#/c/35454/

Hi Fengqian,

Please see my review on the first of the above patches. You need to
ensure that there is at least one unique column in the sort keys if
pagination is used.

There is a similar issue in the second patch (reviewing it now) that
uses the sqlalchemy_utils (oslo.db) paginate_query() method...

The sqlalchemy_utils.paginate_query() method **requires** that sort_keys
contains a unique column [1]. The docstring for that method says:

"Pagination works by requiring a unique sort_key, specified by
sort_keys. (If sort_keys is not unique, then we risk looping through
values.)"

So, care must be taken to pass sort_keys parameter to paginate_query()
that already contains at least one unique column in the sort keys.

Best,
-jay

[1]
https://github.com/openstack/oslo-incubator/blob/master/openstack/common/db/sqlalchemy/utils.py#L66





More information about the OpenStack-dev mailing list