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

We cannot rely on ORDER BY id

    XMLWordPrintable

    Details

    • Type: Epic
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.6
    • Fix Version/s: BACKEND
    • Component/s: Database SQL/XMLDB
    • Labels:
    • Affected Branches:
      MOODLE_26_STABLE
    • Epic Name:
      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

              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated: