diff options
author | Ihar Hrachyshka <ihrachys@redhat.com> | 2016-08-27 05:36:17 +0000 |
---|---|---|
committer | Ihar Hrachyshka <ihrachys@redhat.com> | 2016-09-01 09:43:13 +0000 |
commit | 4314f3224f689c660d231183404f3af78310016e (patch) | |
tree | d88717d0c9bb9d0fda416b700642c38d37ccbe0a /README.rst | |
parent | 363e710295fad49f9c8996ae6efb9e1d9791628f (diff) | |
download | oslo-db-4.13.1.tar.gz |
Correctly detect incomplete sort_keys passed to paginate_query4.13.1
Currently, the function expects that sort_keys will contain 'id',
otherwise a warning is triggered. This assumption is wrong in multiple
ways. First, models may not have an 'id' attribute. Second, even if the
attribute is present, it may be non-unique irrespective of the name
chosen for it.
The right way of determining sorting keys that would not guarantee
stable sorting order for paginated results is to extract sets of unique
keys from the model itself, and compare sorting keys to those extracted
sets. If at least one of those unique key sets is a subset of passed
sorting keys, then no warning should be issued.
The patch also add _get_unique_keys function but, in contrast to its
Ocata version, does *not* expose it as part of library public API, and
makes it explicit it's not part of it, by using the leading underscore
in its name. The rationale behind that is that we don't want to expose
new features in Newton if possible. The function is a modified version
of a function with a similar name (get_unique_keys) currently maintained
in Neutron tree for similar needs.
To avoid calculating the same result over and over on each call to the
new function, we cache it in info dict of the relevant Table.
Change-Id: I46d9d53ee5f6fa2863b31027fa81997571d6568a
Closes-Bug: #1617996
(cherry picked from commit dea700d13e4c152bf1a484b62cc2bce329ef6fa9)
Diffstat (limited to 'README.rst')
0 files changed, 0 insertions, 0 deletions