Unable to restore backup

Re: Unable to restore backup

by Donna Hrynkiw -
Number of replies: 3

Hello Michael,

I'm sharing your pain. I have exactly the same problem with exactly the same error. I came here hoping someone would be able to advise me if it was possible to tweak the xml in the backup file to prevent/bypass the duplicate entry.

Background: I'm restoring a course from a previous semester, made on a different instance/site, with slightly different versions of Moodle (original site: v2.6.4, destination site: v2.6.6). I'm restoring the assignments only, but with user data. (Attempting to retrieve a student's course work from a previous semester.) I've already had to tweak the user.xml to take care of a user restore conflict.

From the debug info (appended below), I expected to be able to find an assignment with id=6136, but no luck. I do not have access to the database.

Michael, I promise to come back and share any information/success I have with this restore with you if you will do the same.


Donna
Kwantlen Polytechnic University

======================

Debug info:

Debug info: Duplicate entry '6136-0-0-0' for key 'mdl_assisubm_assusegroatt_uix'
INSERT INTO mdl_assign_submission (userid,timecreated,timemodified,status,groupid,attemptnumber,assignment) VALUES(?,?,?,?,?,?,?)
[array (
0 => '0',
1 => 1400089563,
2 => 1400090036,
3 => 'submitted',
4 => 0,
5 => '0',
6 => 6136,
)]
Error code: dmlwriteexception
Stack trace:

    line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
    line 1146 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
    line 1188 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
    line 139 of /mod/assign/backup/moodle2/restore_assign_stepslib.php: call to mysqli_native_moodle_database->insert_record()
    line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_assign_activity_structure_step->process_assign_submission()
    line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
    line 151 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 186 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
    line 233 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
    line ? of unknownfile: call to progressive_parser->start_tag()
    line 175 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
    line 154 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
    line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
    line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
    line 192 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
    line 177 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
    line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
    line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
    line 184 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
    line 99 of /backup/restore.php: call to restore_ui->execute()



In reply to Donna Hrynkiw

Re: Unable to restore backup

by Pedro Ximenes -

Hi,


I'm using Moodle 2.9.2+ (Build: 20151008) and having same problem.

Unique Index mdl_assisubm_assusegroatt_uix from mdl_assign_submission table is generating errors.


Root cause is:

I had one assignment with multiple submissions from the same user. In the assign_submission table there is an attemptnumber field that the assignment upgrade script does not make use of. As a resut of the unique index - mdl_assisubm_assusegroatt_uix - the insert fails during one of the submissions and throws a database error. (https://tracker.moodle.org/browse/MDL-45806)


How to solve it?


Many thanks!


Pedro Ximenes


In reply to Pedro Ximenes

Re: Unable to restore backup

by Pedro Ximenes -

No ideas?

In reply to Pedro Ximenes

Re: Unable to restore backup

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

If your above statement is correct, I would suggest submitting to the tracker as a bug.  Also, check the tracker to see if it has been reported already and maybe fixed in a later version.