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

Database error when doing a selective restore

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.3, 2.5
    • Fix Version/s: None
    • Component/s: Backup, Quiz
    • Labels:
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_25_STABLE

      Description

      This was discovered while testing MDL-31319, and was previously reported in the forums: http://moodle.org/mod/forum/discuss.php?d=188821. This error occurred when I attempted to restore a quiz which I had deleted from the course. Note that this was the second time I had done so with this course, so the process was like this:

      1. Create quiz.
      3. First student attempt.
      2. Backup quiz.
      3. Delete quiz.
      4. Restore quiz (success).
      5. Second student attempt.
      6. Backup quiz.
      7. Delete quiz.
      8. Restore quiz (fails).

      Here's the stack trace:
      Debug info: Duplicate entry '3-1' for key 'mdl_gradgrad_useite_uix'
      INSERT INTO mdl_grade_grades (userid,rawgrade,rawgrademax,rawgrademin,rawscaleid,usermodified,finalgrade,hidden,locked,locktime,exported,overridden,excluded,feedback,feedbackformat,information,informationformat,timecreated,timemodified,itemid) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
      [array (
      0 => '3',
      1 => NULL,
      2 => '100.00000',
      3 => '0.00000',
      4 => NULL,
      5 => NULL,
      6 => NULL,
      7 => '0',
      8 => '0',
      9 => '0',
      10 => '0',
      11 => '0',
      12 => '0',
      13 => NULL,
      14 => '0',
      15 => NULL,
      16 => '0',
      17 => NULL,
      18 => NULL,
      19 => '1',
      )]
      Stack trace:
      line 397 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 893 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 935 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      line 221 of /backup/moodle2/restore_stepslib.php: call to mysqli_native_moodle_database->insert_record()
      line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_gradebook_structure_step->process_grade_grade()
      line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
      line 125 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
      line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
      line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
      line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
      line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
      line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
      line ? of unknownfile: call to progressive_parser->end_tag()
      line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
      line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
      line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
      line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      line 310 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
      line 46 of /backup/restore.php: call to restore_ui->execute()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              andyjdavis Andrew Davis
              Reporter:
              cfulton Charles Fulton
              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:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: