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

Backup process generate big memory footprint and would stop when have huge number of users

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6
    • 1.8.5, 1.9
    • Backup
    • None
    • MOODLE_15_STABLE, MOODLE_16_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE

    Description

      On our production site our staff programmer Cliff found this issue, when we added the winter/spring 2008 students to the DB, then course level manual backup will not complete. We did some debugging and found that the function user_check_backup in /backup/backuplib.php were not implemented efficiently and would generate big memory footprint:

      function user_check_backup($course,$backup_unique_code,$backup_users,$backup_messages) {
      //$backup_users=0-->all
      // 1-->course (needed + enrolled)
      // 2-->none

      global $CFG;
      global $db;

      $count_users = 0;

      //If we've selected none, simply return 0
      if ($backup_users == 0 or $backup_users == 1) {

      //Calculate needed users (calling every xxxx_get_participants function + scales users)
      $needed_users = backup_get_needed_users($course, $backup_messages);

      //Calculate enrolled users (students + teachers)
      $enrolled_users = backup_get_enrolled_users($course);

      //Calculate all users (every record in users table)
      $all_users = backup_get_all_users();

      //Calculate course users (needed + enrolled)
      //First, needed
      $course_users = $needed_users;

      //Now, enrolled
      if ($enrolled_users) {
      foreach ($enrolled_users as $enrolled_user)

      { $course_users[$enrolled_user->id]->id = $enrolled_user->id; }

      }

      //Now, depending of parameters, create $backupable_users
      if ($backup_users == 0)

      { $backupable_users = $all_users; }

      else

      { $backupable_users = $course_users; }

      We rewrote it a little bit and are still testing the patch (patch is not included here in this ticket right now), but would like to create a bug ticket here so that people who are running large sites would aware of this issue. Thanks!

      Attachments

        Issue Links

          Activity

            People

              danmarsden Dan Marsden
              chuang Wen Hao Chuang
              Nobody Nobody
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                3/Mar/08