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

Use temporary tables in sync_users of external database authentication

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0
    • Fix Version/s: DEV backlog
    • Component/s: Authentication, Performance
    • Labels:
    • Environment:
      Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz, 4GB RAM,Linux, MySQL with tunned configurations, Apache 2,
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      Here at Universidade Federal de Santa Catarina we are starting the upgrade of our infra-structure to 2.0 and our first major goal is to sync users from the academic control system.
      In Moodle 1.9 we use a custom system, developed from beggining, and with a lot of features. One of these is to create users in Moodle from a table, and now we know that Moodle's External Database Authetication plugin can do the work, but it is not that "performatic".
      As the documentation says, it uses arrays to calculate the set of users to be created, instead of a temporary table and a left join like what is done in ldap plugin.
      This patch i am submitting changes this behaviour and introduces the temporary table in the proccess. A lot of duplicated code from ldap, that we may think about refactor.
      I haven't tested the original process, but the new one can calculate the users to create in almost zero time in a fresh install (just 2 or 3 records in user table) and it took about 5 minutes to calculate the set with 38K records in the external table that were already in moodle.
      Also, the update process can be a lot improved. The current code does an update for each user, that consists of one SELECT and N updates, where N is the number of update keys. I don't have numbers but should be better to construct only one UPDATE TABLE query and let the database calculate which records differ. This is valid for remove/suspend process too.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              danielneis Daniel Neis Araujo created issue -
              danielneis Daniel Neis Araujo made changes -
              Field Original Value New Value
              Attachment mdl-25372.v1.diff [ 22340 ]
              danielneis Daniel Neis Araujo made changes -
              Link This issue has been marked as being related by MDL-15475 [ MDL-15475 ]
              skodak Petr Skoda made changes -
              Assignee Petr Škoda (skodak) [ skodak ] moodle.com [ moodle.com ]
              Fix Version/s DEV backlog [ 10464 ]
              dougiamas Martin Dougiamas made changes -
              Workflow jira [ 40421 ] MDL Workflow [ 47166 ]
              danielneis Daniel Neis Araujo made changes -
              Attachment mdl25372-1.9.diff [ 23584 ]
              dougiamas Martin Dougiamas made changes -
              Workflow MDL Workflow [ 47166 ] MDL Full Workflow [ 75355 ]
              aborrow Anthony Borrow made changes -
              Labels patch
              danielneis Daniel Neis Araujo made changes -
              Link This issue has a non-specific relationship to MDL-25373 [ MDL-25373 ]
              poltawski Dan Poltawski made changes -
              Status Open [ 1 ] Closed [ 6 ]
              Resolution Duplicate [ 3 ]

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: