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

MDL-61605 upgrade step can cause unique key violations

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.5
    • 3.5
    • Quiz
    • MOODLE_35_STABLE
    • MOODLE_35_STABLE
    • Hide

      Test new Moodle install:

      1. Create a new install of latest master / MOODLE_35_STABLE.
      2. Verify that the quiz_overview_regrades table has a non-unique index on (questionusageid, slot)

      Test upgrade 3.4 -> 3.5.x

      1. Install Moodle 3.4.x.
      2. Upgrade directly to latest master / MOODLE_35_STABLE.
      3. Verify that the quiz_overview_regrades table has a non-unique index on (questionusageid, slot)

      Test upgrade 3.4 -> 3.5.0 -> 3.5.x

      1. Install Moodle 3.4.x.
      2. Upgrade to v3.5.0 release.
      3. Upgrade to latest master / MOODLE_35_STABLE.
      4. Verify that the quiz_overview_regrades table has a non-unique index on (questionusageid, slot)
      Show
      Test new Moodle install: Create a new install of latest master / MOODLE_35_STABLE. Verify that the quiz_overview_regrades table has a non-unique index on (questionusageid, slot) Test upgrade 3.4 -> 3.5.x Install Moodle 3.4.x. Upgrade directly to latest master / MOODLE_35_STABLE. Verify that the quiz_overview_regrades table has a non-unique index on (questionusageid, slot) Test upgrade 3.4 -> 3.5.0 -> 3.5.x Install Moodle 3.4.x. Upgrade to v3.5.0 release. Upgrade to latest master / MOODLE_35_STABLE. Verify that the quiz_overview_regrades table has a non-unique index on (questionusageid, slot)

    Description

      MDL-61605 adds a unique index to quiz_overview_regrades.

      We thought at the time that this could not cause unique_key errors, but it seems we thought wrong: See https://moodle.org/mod/forum/discuss.php?d=371745.

      Default exception handler: DDL sql execution error Debug: Duplicate entry '530578-13' for key 'mdl_quizoverregr_queslo_uix'
       
      CREATE UNIQUE INDEX mdl_quizoverregr_queslo_uix ON mdl_quiz_overview_regrades (questionusageid, slot)
       
      Error code: ddlexecuteerror
       
      * line 492 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown
      * line 1041 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      * line 77 of /lib/ddl/database_manager.php: call to mysqli_native_moodle_database->change_database_structure()
      * line 756 of /lib/ddl/database_manager.php: call to database_manager->execute_sql_arr()
      * line 52 of /mod/quiz/report/overview/db/upgrade.php: call to database_manager->add_key()
      * line 632 of /lib/upgradelib.php: call to xmldb_quiz_overview_upgrade()
      * line 1857 of /lib/upgradelib.php: call to upgrade_plugins()
      * line 182 of /admin/cli/upgrade.php: call to upgrade_noncore()
      

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              timhunt Tim Hunt
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Jake Dallimore Jake Dallimore
              Ryan Wyllie Ryan Wyllie
              Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                17/May/18