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

Shared questions not backed up, leading to DB data corruption and SQL errors

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • 1.9.5, 2.2
    • None
    • Backup, Questions
    • observed at MySQL servers
    • MOODLE_19_STABLE, MOODLE_22_STABLE

    Description

      Symptoms
      ========

      • unable to add questions to a quiz
      • after debugging turned on, an SQL error complains. Invalid arguments passed to IN() operator like in "questionid IN (,,,,,,,,189,188,187)"
      • the field "questions" in mdl_quiz table contains data like ,,,,,189,188,187 (it est missing integers)

      Reasons
      =======
      The data of the field "questions" got corrupted during a restore procedure. A course backup with a quiz was restored. However, questions used by the quiz were not included in the backup. During the restore, the id of not included question casts to empty string '' which leads to corrupted data in mdl_quiz.questions field.

      The reason why the questions were not included in the backup is that all the questions were shared at the course category context. However, at the end of the term, the course were moved out of the category to an archive so it was not descendant of the category containing the questions any more. The quiz itself continued working so the teacher did not notice anything weird. During the backup procedure, the number of questions being backed-up was reported as 0. But it itself is not alarming too much if the backup is done by administrator, for example, who does not know the course so much.

      How to reproduce
      ==============
      1. Create a top level category CAT1
      2. Create course COURSE under CAT1
      3. Create a QUIZ in COURSE containing three or so questions. Save the questions in the context of CAT1
      4. Create another top level category CAT2
      5. Move the COURSE into CAT2
      6. Check the QUIZ still works
      7. Backup the COURSE
      8. Restore the COURSE into CLONE
      9. Try to add a question to the QUIZ in CLONE (with debugging on, of course)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mudrd8mz David Mudrák (@mudrd8mz)
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan, Safat Shahin, Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: