Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-43447

We cannot rely on ORDER BY id

    XMLWordPrintable

Details

    • Epic
    • Status: Closed
    • Critical
    • Resolution: Won't Do
    • 2.6
    • None
    • Database SQL/XMLDB
    • MOODLE_26_STABLE
    • Stop ORDER BY id

    Description

      It seems that, once you have master-master replication, you cannot assume that ORDER BY id means anything.

      Sadly, various bits of Moodle code rely on it. Try searching for

      • ORDER BY id - 14 matches in core
      • get_record.*\s["']id['"] - 190 matches in core, but no all relevant.

      The situation seems to be:

      So, the only viable long-term solution is to remove all ORDER BY id, but that will be a big job, so I expect this will have to become an Epic in due course, in order to add appropriate developer debug warnings, and then find and fix all problems.

      Long chat log discussion here: https://moodle.org/local/chatlogs/index.php?conversationid=14503#c520410

      The issue that triggered all this: MDL-43246

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              timhunt Tim Hunt
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: