Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34783

course_overview block doesn't retrieve all required fields for get_fast_modinfo

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.3, 2.4
    • 2.3.2
    • Blocks, Course
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • MOODLE_23_STABLE
    • MDL-34783-master-1
    • Hide

      Preparation:

      • to be enrolled on a couple of courses
      • for those courses to have some activities including some of the following
        • chat
        • assign (2.3 version)
        • forum
        • lesson
        • quiz
        • scorm

      Testing

      I'd advise looking at the db read/write count both before and after applying this patch

      • Open /my
      • look at the db read/write count
      • ensure that all expected overview items are seen both before and after applying
      Show
      Preparation: to be enrolled on a couple of courses for those courses to have some activities including some of the following chat assign (2.3 version) forum lesson quiz scorm Testing I'd advise looking at the db read/write count both before and after applying this patch Open /my look at the db read/write count ensure that all expected overview items are seen both before and after applying

    Description

      We've been seeing some massive speed issues on the /my page and they largely seem to be a result of get_fast_modinfo repeatedly resetting.
      Having tracked this issue back:

      • blocks/course_overview/block_course_overview.php::get_content()
        • calls enrol_get_my_courses() to retrieve a list of courses
        • passes this list to print_overview($courses, $remote_courses)
      • course/lib.php::print_overview()
        • loops through each module, and calls its {$mod->name})print_overview() function
      • {$mod->name})print_overview() calls get_all_instances_in_courses()
      • lib/datalib.php::get_all_instances_in_courses() calls get_fast_modinfo()
      • lib/modinfolib.php::get_fast_modinfo()
        • checks whether the cache is filled and a relevant entry is found for the specified course
        • if found returns
        • if not inserts a new course_modinfo object into the cache
      • lib/modinfolib.php::course_modinfo
        • checks whether the supplied course has a valid modinfo and sectioncache - if not, it calls rebuild_course_cache which resets the get_fast_modinfo cache

      Unfortunately though, the course_overview block doesn't retrieve the sectioncache field for each course from the DB, and as a result, every time a course is retrieved, the entire get_fast_modinfo cache is emptied.

      Attachments

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Dan Poltawski Dan Poltawski
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Adrian Greeve Adrian Greeve
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Amaia Anabitarte, Carlos Escobedo, Laurent David, Mikel Martín Corrales, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                10/Sep/12