| The order of the results of the {{/wikis/ {wikiName} /classes/ {className} /objects}} REST resource is not defined and, more importantly, not stable on PostgreSQL, meaning that depending on the number of results and offsets you specify, the order changes, so when you paginate over the results, the union of all pages might contain duplicates and miss some results. Steps to reproduce: Run the attached Python script against an XWiki instance that uses PostgreSQL as database.
The script has more options in case you, e.g., need to log in with a user or password. Expected result: The script returns an output like
Actual result: The script returns a result like:
Simpler check (doesn't show a real bug): Open /xwiki/rest/wikis/xwiki/classes/XWiki.DocumentSheetBinding/objects?media=json and check the order of the results: If they are ordered by "pageId" and "number", the fix is there, without fix, the order is seemingly random. The ordering can also be reproduced on other databases, not just PostgreSQL while the inconsistencies affect - as far as I'm aware - only PostgreSQL. Found this through failures of ObjectsResourceIT#testAllObjectsForClassNameResourcePaginationAndErrors on PostgreSQL, 6 out of 17 test executions were failing on CI. |