https://bugzilla.wikimedia.org/show_bug.cgi?id=36400

       Web browser: ---
             Bug #: 36400
           Summary: Continue may skip or repeat entries for iwlinks or
                    langlinks
           Product: MediaWiki
           Version: 1.20-git
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: patch-need-review
          Severity: normal
          Priority: Unprioritized
         Component: API
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---


Created attachment 10495
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=10495
Patch to change the ORDER BY in the queries to match that expected by the
continue handling

For iwlinks, the continue parameter implies ORDER BY iwl_from, iwl_prefix,
iwl_title. However, this does not match the actual ordering in two of the three
cases:

1. When iwprefix is not given, the query is ORDER BY iwl_from, iwl_prefix (or
ORDER BY iwl_prefix when iwl_from is constant). iwl_title is not sorted, so if
the database would want to return three titles in the order A, C, B, with
iwlimit=1 it would return A and set continue to C. When continuing, it would
skip B because C > B.

2. When iwprefix is given but iwtitle is not given, the query is ORDER BY
iwl_title, iwl_from, which is backwards (iwl_prefix need not be included, as it
is constant). This is very easy to see the problem: just create pages A and B
where B has an interwiki link that sorts between two interwiki links in A.
https://en.wikipedia.org/w/api.php?format=jsonfm&action=query&prop=iwlinks&titles=A|C&iwprefix=wikisource&iwlimit=1
illustrates this at the moment.

3. When both iwprefix and iwltitle are specified, the query is ORDER BY
iwl_from. This is fine because iwl_prefix and iwl_title are constant in the
query.


The langlinks module has a similar structure, but here case 1 is not a problem
because (ll_from, ll_prefix) is a unique key. Case 2 *is* still an issue.


The simple fix would be to change the queries so the ordering matches that
implied by the continue parameter in all cases (see patch). I don't know if
this will make MySQL filesort, however.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to