Restoring to New Course and Importing Content From Existing Course Ends in Database Error

Restoring to New Course and Importing Content From Existing Course Ends in Database Error

by Robert Blomeyer -
Number of replies: 7

Our new Moodle 2.2.3 server looks and behaves nicely. But something happened that makes it impossible to restore any  course backup archive or import content from an existing course.

We turned on Developer Debugging and consistently see the same error message whether we restore an archive or try importing content into an empty course shell:

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

Error writing to database

More information about this error

Debug info: Duplicate entry '841' for key 'mdl_qtypessaopti_que_uix'
INSERT INTO mdl_qtype_essay_options (responseformat,responsefieldlines,attachments,graderinfo,graderinfoformat,questionid) VALUES(?,?,?,?,?,?)
[array (
0 => 'editor',
1 => '15',
2 => '0',
3 => '',
4 => '0',
5 => 841,
)]

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 63 of /question/type/essay/backup/moodle2/restore_qtype_essay_plugin.class.php: call to mysqli_native_moodle_database->insert_record()
  • line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_qtype_essay_plugin->process_essay()
  • 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 315 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()

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

We'd appreciate it very much if someone might suggest: (1) what this means, and (2) how do we fix it.

Thanks  for your consideration.

Bob Blomeyer

Average of ratings: -
In reply to Robert Blomeyer

Re: Restoring to New Course and Importing Content From Existing Course Ends in Database Error

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well, it suggests one of two things:

  1. Either there is a bug in the essay quetsion-type back-up and restore code; or
  2. There is a problem with the data that you are backing up.

Are you able to make a small backup file, say containing one quiz with one question (and which does not contain any sensitive information), that I can use to try to reproduce the issue? Thanks.

In reply to Tim Hunt

Re: Restoring to New Course and Importing Content From Existing Course Ends in Database Error

by Robert Blomeyer -

Tim:

The same archive restores properly on my 2.2.1 sandbox.

There's something else going on.

I've even ported a working course from the 2.2.1 sandbox over. It won't restore either.

Might there be a bug in the quiz routine on my 2.2.3 production server?

BobBl

In reply to Tim Hunt

Re: Restoring to New Course and Importing Content From Existing Course Ends in Database Error

by Robert Blomeyer -

Based on your reply I'm guessing it's in the backup and restore code for the essay response.

Thanks for your support.

Bob Blomeyer

In reply to Robert Blomeyer

Re: Restoring to New Course and Importing Content From Existing Course Ends in Database Error

by Robert Blomeyer -

I've attached an error log from the backup folder of my moodle site. I turned on debugging on June 16th.

 

Today, (June 20th) I updated to the lated 2.2.3+ version. Now  the logs are getting more complicated.


If anyone has a clue what's wrong, I'd appreciate the help.


Bob Blomeyer

In reply to Robert Blomeyer

Re: Restoring to New Course and Importing Content From Existing Course Ends in Database Error

by Piyush Pandey -

Hey Robert,


are you able to fix the same issue, i am also experiencing the same.

 

Please reply....

In reply to Robert Blomeyer

Re: Restoring to New Course and Importing Content From Existing Course Ends in Database Error

by David Andrew -

Same Issue for me.

Maybe I need to create a new table mdl_qtype_essay_options

Does anyone have the structure or can export the structure of this table so I can create a new one ?

In reply to David Andrew

Re: Restoring to New Course and Importing Content From Existing Course Ends in Database Error

by David Andrew -