by Michael Hughes.
We've got an issue where we're unable to restore a backup of a class.
When we try to run it we get:
==> error_log_w4.2014.12.09 <==
Failed loading /usr/local/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so: cannot open shared object file: No such file or directory
[Tue Dec 09 16:21:43 2014] [error] [client 130.159.19.1] Default exception handler: Error writing to database Debug: Duplicate entry '13115-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 => 1415679370,
2 => 1415679381,
3 => 'submitted',
4 => 0,
5 => '0',
6 => 13115,
)]
Error code: dmlwriteexception
* line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
* line 1080 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 1122 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()
, referer: http://classes.myplace.strath.ac.uk/backup/restore.php
Looking at the mdl_assign_submission table I can find 43 rows where userid, groupid and attemptnumber == 0:
mysql> select * from mdl_assign_submission where userid =0 and groupid =0 and attemptnumber = 0;
+--------+------------+--------+-------------+--------------+-----------+---------+---------------+
| id | assignment | userid | timecreated | timemodified | status | groupid | attemptnumber |
+--------+------------+--------+-------------+--------------+-----------+---------+---------------+
| 69664 | 8446 | 0 | 1383823153 | 1383823153 | submitted | 0 | 0 |
| 71428 | 8496 | 0 | 1384171263 | 1384171263 | draft | 0 | 0 |
| 85745 | 8089 | 0 | 1385976897 | 1385980992 | draft | 0 | 0 |
| 91285 | 8567 | 0 | 1386663489 | 1386681015 | draft | 0 | 0 |
| 97130 | 8568 | 0 | 1387525378 | 1387541251 | draft | 0 | 0 |
| 118296 | 9579 | 0 | 1393591157 | 1393591158 | submitted | 0 | 0 |
| 158580 | 6970 | 0 | 1411549335 | 1411549335 | draft | 0 | 0 |
| 159278 | 10908 | 0 | 1412340520 | 1412340520 | submitted | 0 | 0 |
| 161840 | 11887 | 0 | 1413638049 | 1413833434 | submitted | 0 | 0 |
| 161875 | 7921 | 0 | 1413653842 | 1413653842 | draft | 0 | 0 |
| 165242 | 12242 | 0 | 1414147752 | 1414147752 | submitted | 0 | 0 |
| 165517 | 7945 | 0 | 1414165860 | 1414165861 | submitted | 0 | 0 |
| 166233 | 7796 | 0 | 1414358504 | 1414744289 | submitted | 0 | 0 |
| 166674 | 8037 | 0 | 1414422773 | 1414491352 | submitted | 0 | 0 |
| 167094 | 512 | 0 | 1414460161 | 1414460161 | submitted | 0 | 0 |
| 167362 | 11470 | 0 | 1414511747 | 1414511747 | submitted | 0 | 0 |
| 167995 | 12240 | 0 | 1414587612 | 1414587620 | submitted | 0 | 0 |
| 169904 | 7795 | 0 | 1414754687 | 1414755307 | submitted | 0 | 0 |
| 170403 | 7797 | 0 | 1414773769 | 1415399222 | submitted | 0 | 0 |
| 170827 | 6752 | 0 | 1414863713 | 1414863713 | submitted | 0 | 0 |
| 173250 | 12435 | 0 | 1415225094 | 1415225101 | submitted | 0 | 0 |
| 176205 | 12257 | 0 | 1415628416 | 1415628416 | submitted | 0 | 0 |
| 176719 | 11517 | 0 | 1415699105 | 1415699223 | submitted | 0 | 0 |
| 177266 | 7958 | 0 | 1415748385 | 1415748395 | submitted | 0 | 0 |
| 178589 | 11088 | 0 | 1415862869 | 1415862869 | submitted | 0 | 0 |
| 178716 | 11249 | 0 | 1415877055 | 1415877055 | submitted | 0 | 0 |
| 180007 | 12404 | 0 | 1415971885 | 1415972010 | submitted | 0 | 0 |
| 180900 | 7121 | 0 | 1416134934 | 1416181638 | submitted | 0 | 0 |
| 181776 | 11342 | 0 | 1416222569 | 1416229681 | submitted | 0 | 0 |
| 183829 | 6514 | 0 | 1416339791 | 1416340171 | submitted | 0 | 0 |
| 186098 | 6754 | 0 | 1416512266 | 1416512287 | submitted | 0 | 0 |
| 186348 | 11091 | 0 | 1416525194 | 1416525194 | submitted | 0 | 0 |
| 188380 | 6530 | 0 | 1416760221 | 1416760256 | submitted | 0 | 0 |
| 189342 | 8101 | 0 | 1416808258 | 1417083400 | submitted | 0 | 0 |
| 192659 | 3773 | 0 | 1417113875 | 1417116321 | submitted | 0 | 0 |
| 196588 | 11564 | 0 | 1417433711 | 1417433711 | submitted | 0 | 0 |
| 197877 | 11464 | 0 | 1417531876 | 1417531876 | submitted | 0 | 0 |
| 198513 | 12433 | 0 | 1417609654 | 1417609742 | submitted | 0 | 0 |
| 199680 | 12841 | 0 | 1417716199 | 1417716199 | submitted | 0 | 0 |
| 200384 | 13021 | 0 | 1415748385 | 1415748395 | submitted | 0 | 0 |
| 200661 | 12535 | 0 | 1417781046 | 1417971263 | submitted | 0 | 0 |
| 202899 | 11711 | 0 | 1418038866 | 1418038867 | submitted | 0 | 0 |
| 203203 | 6719 | 0 | 1418052326 | 1418052334 | submitted | 0 | 0 |
+--------+------------+--------+-------------+--------------+-----------+---------+---------------+
43 rows in set (0.19 sec)
Given that a submission should be made either by a user or into a group I'm wondering how there are *any* rows that have all 3 of these parts of the key being 0.