-
Bug
-
Resolution: Fixed
-
Critical
-
2.0, 2.2.3
-
MOODLE_20_STABLE, MOODLE_22_STABLE
-
MOODLE_23_STABLE
-
This bug has been turned into a more generic bug than it once was (as the original report is actually caused by multiple issues). This issue and MDL-32203 fix the majority of issues.
The problem is due to the bug MDL-32203 and the fact that the completion code in cron needs to run at the same time the site is being used a few of the course completion tables can get filled with duplicate records.
This breaks completion in multiple places due to it's assuming there will be no duplicates.
Adding unique indexes to the columns will prevent the duplicates being created by other race conditions. This bug will also remove some unused database fields/tables that confuse developers, and most importantly clean up any existing duplicate records (which needs to happen before the indexes can be created).
OLD DESCRIPTION:
This is nearly the same problem as in MDL-28021 - somehow there are duplicate entires for course completion landing in the table {$CFG->prefix}_course_completion_crit_compl.
This causes a 'more than one record in fetch' error for some users in courses with a completion block, effectively blocking them from using moodle.
I'm not sure of the origin of these duplicates yet, I suggest for a start we delete duplicates and put a unique index on the database; this prevents the access loss issue and should throw an error from the responsible location when an insert is made.
I don't yet have a way to reproduce this issue but it is confirmed in about half a dozen courses and affects about 200 users in the site...
Backtrace:
[error] [client 10.229.5.75] Default exception handler: Found more than one record in fetch() ! Debug:
- line 429 of /lib/setuplib.php: moodle_exception thrown
- line 130 of /lib/completion/data_object.php: call to print_error()
- line 119 of /lib/completion/completion_criteria_completion.php: call to data_object::fetch_helper()
- line 65 of /lib/completion/data_object.php: call to completion_criteria_completion::fetch()
- line 273 of /lib/completionlib.php: call to data_object->__construct()
- line 58 of /blocks/completionstatus/block_completionstatus.php: call to completion_info->get_completions()
- line 280 of /blocks/moodleblock.class.php: call to block_completionstatus->get_content()
- has a non-specific relationship to
-
MDL-27368 course completion causes cron failure
-
- Closed
-
-
MDL-33394 Backport MDL-28949: Remove duplicate course completion records and introduce indexes
-
- Closed
-
- is blocked by
-
MDL-32203 Course completion data object misses records
-
- Closed
-
- is duplicated by
-
MDL-30692 Consider creating one unique index on course_completion_aggr_methd (course, criteriatype)
-
- Closed
-