Uh oh!
There was an error while loading. Please reload this page.
server: use id column as secondary sort criteria with sortKey - #5320
Conversation
shwstppr
commented
Aug 16, 2021
@blueorangutan package |
blueorangutan
commented
Aug 16, 2021
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
blueorangutan
commented
Aug 16, 2021
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 884 |
nvazquez
commented
Aug 16, 2021
@blueorangutan test |
blueorangutan
commented
Aug 16, 2021
@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
shwstppr
commented
Aug 17, 2021
@blueorangutan test |
blueorangutan
commented
Aug 17, 2021
@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
borisstoyanov
left a comment
There was a problem hiding this comment.
LGTM,
I've manually checked with ~1600 records and page size of 450, divided in 4 pages I could not get duplicates.
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page1 page4 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page2 page4 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page3 page4 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page1 page3 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page1 page2 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page3 page2 | wc
0 0 0
Lets wait for results from smoketests to appear.
blueorangutan
commented
Aug 17, 2021
Trillian test result (tid-1671)
|
| String name = column != null ? column.name() : field; | ||
| if (!name.equals("id")) { | ||
| name = String.format("%s, id", name); |
There was a problem hiding this comment.
LGTM but I worry as this is used at so many places, @shwstppr - is there a more isolated way to fix the list API issue than this, i.e. what is causing the issue for the listServiceOfferings API response?
There was a problem hiding this comment.
@rhtyd as mentioned in the PR desc, it is sorting issue when entries in table have same value for the column (for which order by is called). In case of list* APIs where resources have sort_key in their corresponding tables.
Since by default value for sort_key is 0, weirdly sorted results are returned when LIMIT offset is used. Change will add id as secondary sort criteria.
Only issue I see is the case when table doesn't have id column. Don't think that is the case with tables in ACS.
There was a problem hiding this comment.
What if the table has no id column @shwstppr the change is in Filter class and could have widespread side-effects. Can we check the service layer handler specific to listServiceOfferings and do something isolated/specific to that?
There was a problem hiding this comment.
@rhtyd changed the logic. No changes in Filter class now
For tables that use sort_key field, incorrect results can be returned by the list* APIs while using pagination and with the same values for sort-key field. (Default value for sort_key field remains 0). This change adds id column as secondary sort criteria in such cases. Fixesapache#5316 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
137f37f to
169411eCompareshwstppr
commented
Aug 17, 2021
@blueorangutan package |
blueorangutan
commented
Aug 17, 2021
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
blueorangutan
commented
Aug 17, 2021
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 893 |
weizhouapache
commented
Aug 17, 2021
@blueorangutan test |
blueorangutan
commented
Aug 17, 2021
@weizhouapache a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
blueorangutan
commented
Aug 18, 2021
Trillian test result (tid-1680)
|
nvazquez
commented
Aug 18, 2021
@borisstoyanov can you please repeat your tests after the refactor? |
borisstoyanov
left a comment
There was a problem hiding this comment.
LGTM, rerun the tests with latest changes and it all seems fine
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page1 page2 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page1 page3 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page1 page4 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page2 page4 | wc
0 0 0
[root@pr5320-t1674-kvm-centos7-mgmt1 ~]# grep -x -i -f page3 page4 | wc
0 0 0
Description
For tables that use
sort_keyfield, incorrect results can be returned by the list* APIs while using pagination and with the same values forsort-keyfield. (Default value forsort_keyfield remains0).This change adds
idcolumn as secondary sort criteria in such cases.Fixes#5316
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
diskoffering-fix.log