Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-8013

Calendar fails to update and Scheduler throws database error in large sites

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.1
    • 3.5.11, 3.8.2
    • Module: Scheduler
    • None
    • MOODLE_35_STABLE, MOODLE_37_STABLE
    • MOODLE_35_STABLE, MOODLE_38_STABLE
    • MOODLE_401_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:

      $studenteventtype = "SSstu:{$slot->id}:{$scheduler->course}";
      $teachereventtype = "SSsup:{$slot->id}:{$scheduler->course}";
      

      (locallib.php)

      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!

            bostelm Henning Bostelmann
            ericabithell Erica Bithell
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.