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

Restore code needs to be robust to unique key violations in old data

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.5, 2.8.3
    • Fix Version/s: 2.7.6, 2.8.4
    • Component/s: Backup, Questions
    • Labels:
    • Testing Instructions:
      Hide

      In place of steps 1-7, you could use the file attache by Eloy, and shower him with thanks.

      1. Make a Moodle 2.4 install
      2. Create a course
      3. Add a quiz
      4. Add one each of a matching, multi-choice and short-answer question.
      5. Go into the database, and find the tables with names like (question|qtype)_(match|numerical|shortanswer)(_options)?
      6. In each one, duplicate the row you find there, so only the id column is different.
      7. Backup the course.
      8. For each branch where you need to test this fix (2.7, 2.8, master), restore that backup.
      9. Verify the restore completes with no errors.
      10. Go to the question bank of the restored course, and click on the edit icon for each question to verify that the options for each question have not been lost during the backup/restore.
        # Have a well-earned beer, or other beverage of your choice.

      To test the random short-answer match part of the change, you would need to install 2.0 or earlier, and I am guessing you don't want to do that. It is probably OK to just review the code and see that the change is the same as in the other qtypes.

      Show
      In place of steps 1-7, you could use the file attache by Eloy, and shower him with thanks. Make a Moodle 2.4 install Create a course Add a quiz Add one each of a matching, multi-choice and short-answer question. Go into the database, and find the tables with names like (question|qtype)_(match|numerical|shortanswer)(_options)? In each one, duplicate the row you find there, so only the id column is different. Backup the course. For each branch where you need to test this fix (2.7, 2.8, master), restore that backup. Verify the restore completes with no errors. Go to the question bank of the restored course, and click on the edit icon for each question to verify that the options for each question have not been lost during the backup/restore. # Have a well-earned beer, or other beverage of your choice. To test the random short-answer match part of the change, you would need to install 2.0 or earlier, and I am guessing you don't want to do that. It is probably OK to just review the code and see that the change is the same as in the other qtypes.
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      This is similar to MDL-40370 or MDL-41093, but for restore, not upgrade.

      Someone in the quiz forum just hit this: https://moodle.org/mod/forum/discuss.php?d=280646#unread

        Attachments

          Activity

            People

            Assignee:
            timhunt Tim Hunt
            Reporter:
            timhunt Tim Hunt
            Peer reviewer:
            Eloy Lafuente (stronk7)
            Integrator:
            Andrew Nicols
            Tester:
            Mark Nelson
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              9/Mar/15