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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.5.11, 3.8.2
    • Fix Version/s: None
    • Component/s: Module: Scheduler
    • Labels:
      None
    • Plugin Version:
      MOODLE_35_STABLE, MOODLE_37_STABLE
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_38_STABLE

      Description

      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!

        Attachments

          Activity

            People

            Assignee:
            bostelm Henning Bostelmann
            Reporter:
            ericabithell Erica Bithell
            Participants:
            Component watchers:
            Valery Fremaux
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: