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

Improve the performance of the automated backups manager task by not reading from the standard log

    XMLWordPrintable

Details

    • MDL-75435-course-backup-event
    • Hide

      Autobackup (based on MDL-73926)

       

      1. Set backup | backup_auto_active to Enabled.
      2. Tick all days for the backup | backup_auto_weekdays setting.
      3. Set backup | backup_auto_skip_modif_days to 10 days.
      4. Set backup | backup_auto_skip_modif_prev to Yes.
      5. Create a course.
      6. Check the course id.
      7. Run \core\task\automated_backup_task scheduled task. 

        php admin/cli/scheduled_task.php --execute="core\task\automated_backup_task"
        

      8. Confirm, that the course is scheduled for backup.
      9. Run adhoc tasks to actually back up the course by executing . 

        php admin/cli/adhoc_task.php -e
        

      10. Run \core\task\automated_backup_task scheduled task again.
      11. Confirm, that the course is skipped as not modified.
      12. Create a user.
      13. Enrol the user to the course.
      14. Run \core\task\automated_backup_task scheduled task.
      15. Confirm, that the course is scheduled for backup.
      16. Run adhoc tasks to actually back up the course by executing . 

        php admin/cli/adhoc_task.php -e
        

      17. Access the course.
      18. Navigate to question bank and create a true/false question.
      19. Add \core\event\question_created event to backup | backup_auto_exclude_events admin setting.
      20. Run \core\task\automated_backup_task scheduled task.
      21. Confirm, that the course is scheduled for backup.
      Show
      Autobackup (based on MDL-73926 )   Set backup | backup_auto_active to Enabled . Tick all days for the backup | backup_auto_weekdays setting. Set backup | backup_auto_skip_modif_days to 10 days. Set backup | backup_auto_skip_modif_prev to Yes . Create a course. Check the course id. Run \core\task\automated_backup_task scheduled task.  php admin/cli/scheduled_task.php --execute= "core\task\automated_backup_task" Confirm , that the course is scheduled for backup. Run adhoc tasks to actually back up the course by executing .  php admin/cli/adhoc_task.php -e Run \core\task\automated_backup_task scheduled task again. Confirm , that the course is skipped as not modified. Create a user. Enrol the user to the course. Run \core\task\automated_backup_task scheduled task. Confirm , that the course is scheduled for backup. Run adhoc tasks to actually back up the course by executing .  php admin/cli/adhoc_task.php -e Access the course. Navigate to question bank and create a true/false question. Add \core\event\question_created event to backup | backup_auto_exclude_events admin setting. Run \core\task\automated_backup_task scheduled task. Confirm , that the course is scheduled for backup.

    Description

      This is the root cause here where it queries the log, and does that query inside a loop once per course. With a huge number of courses and a huge log table this is huge bottle neck.

      https://github.com/moodle/moodle/blob/master/backup/util/helper/backup_cron_helper.class.php#L780-L793

      I'm proposing to radically simply this to:

      1. have a moodle event handler looking for any changes to course events
      2. if found, then just set a 'course has modifications' flag
      3. the backup tasks will look at this flag when scheduling the automated backups and reset the flag when they are done

      This change depends on MDL-73926, so the commit is based on it. It will be rebased once MDL-73926 gets accepted.

      Attachments

        Issue Links

          Activity

            People

              srdjan Srdjan Jankovic
              brendanheywood Brendan Heywood
              Brendan Heywood Brendan Heywood
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: