Affects Version/s: 3.5.11, 3.8.2
Fix Version/s: None
Component/s: Module: Scheduler
Plugin Version:MOODLE_35_STABLE, MOODLE_37_STABLE
Affected Branches:MOODLE_35_STABLE, MOODLE_38_STABLE
In large Moodle instances (many courses and/or many Scheduler slots) the Scheduler activity becomes unable to update the Moodle calendar with the event created when a student books a slot.
The user-facing result is that the student sees an "Error writing to database" message. The Scheduler slot is created but the matching calendar event is not.
An example is a large Moodle instance in which the maximum id in mdl_course is >10 000 and the max id in mdl_scheduler_slots is >10 000 000.
The eventtype field in mdl_event is a varchar 20 and for Scheduler slots it is populated using:
This does not scale to large sites, and in our case both these strings have now reached 21 characters for more recent courses with larger ids, which is causing the observed database errors.
It would be possible to mitigate the problem by reducing the length of the SSstu or SSsup part of the string, but that doesn't really resolve the scalability issue.
Any thoughts on a solution to this would be very welcome. The fact that we have hit the problem at all is a testimony to the popularity of the Scheduler activity in our site!