-
Bug
-
Resolution: Fixed
-
Blocker
-
2.3.5, 2.4.2, 2.4.6, 2.5, 2.6
-
MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
-
MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
-
wip-
MDL-38228-master -
-
20
The upgrade script portion of the fix for MDL-37939 is inefficient and causes a considerable performance problem for upgrading large sites. The process queries course modules for each course section individually. That's a pretty big deal for Moodlerooms, where our largest site has nearly 445,000 course sections, and an average of over 6,000 course sections across 1,200 sites.
The root of the problem is finding the course modules which don't exist in the sequence field of the related course section. The following query will get those course section records for you.
SELECT cs.* |
FROM mdl_course_sections cs |
INNER JOIN mdl_course_modules cm |
ON (cm.course = cs.course AND cm.section = cs.id) |
WHERE CONCAT(',', cs.sequence, ',') NOT LIKE CONCAT('%,', cm.id, ',%') |
The following returns an average of 33 course sections for affected sites (~80%), with a maximum of 772 course sections.
Note: FIND_IN_SET is an operator that only works for MySQL and PG, but the query can be tweaked to support any RDBMS.
Additonally: for 2.5 and 2.6 branches the new upgrade script has to be run again because of another bug. In version 2.4 we can just replace the old script with a faster one.
- has a non-specific relationship to
-
MDL-38173 Adding module on courses with completion enabled creates course_module section-id corruption
- Closed
-
MDL-38386 Change upgrade step for 24 and master for MDL-38173
- Closed
- has been marked as being related by
-
MDL-44065 MDL-44065 Course: _add_instance exception leads to inconsistent db
- Closed
- is a regression caused by
-
MDL-37939 Moving modules between sections is not properly working
- Closed
- is blocked by
-
MDL-37028 Integrity check the course module sequence/sections
- Closed
- Testing discovered
-
MDL-37939 Moving modules between sections is not properly working
- Closed
- will be (partly) resolved by
-
MDL-38173 Adding module on courses with completion enabled creates course_module section-id corruption
- Closed
-
MDL-37028 Integrity check the course module sequence/sections
- Closed
- will help resolve
-
MDL-31571 Implement orphan module cleaner
- Open