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

expired_retention_period scheduled task not working on larger moodles



    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.6.2, 3.6.3
    • Fix Version/s: None
    • Component/s: Administration
    • Labels:
    • Affected Branches:


      We are preparing our Moodle installation for a summer upgrade to 3.6.x - currently I am running 3.6.2.  We are upgrading from 3.2, and running on Linux/MySQL.  Our test server, where 3.6 is currently sitting, is not production standard but reasonably well resourced.  In general, Moodle runs well on it.


      We are a large Moodle, with thousands of courses and tens of thousands of users - albeit not all active. 


      One of the new features we are particularly looking forward to using is the new Data Privacy/Retention/GPDR admin component.


      However, I am having problems, particularly when attempting to run the "Expired retention period \tool_dataprivacy\task\expired_retention_period" scheduled task.


      The database snarls up and brings down the entire site.  This query runs and runs ... and runs.  It never seems to resolve.


              $sql = "SELECT $fields




                        JOIN (

                              SELECT c.enddate AS expirydate, subctx.path

                                FROM {context} subctx

                                JOIN {course} c

                                  ON subctx.contextlevel = :contextlevel

                                 AND subctx.instanceid = c.id

                                 AND c.format != 'site'

                             ) ctxcourse

                          ON ctx.path LIKE {$parentpath} OR ctx.path = ctxcourse.path

                   LEFT JOIN {tool_dataprivacy_ctxinstance} dpctx

                          ON dpctx.contextid = ctx.id

                   LEFT JOIN {tool_dataprivacy_ctxexpired} expiredctx

                          ON ctx.id = expiredctx.contextid


                    ORDER BY ctx.path DESC";



      Is anybody else having similar issues?  Does anybody know how to resolve it?  My feeling is that for bigger Moodle, a flatter, less clever but also less nested series of queries might be better - but I'd really like other people's view.   Is there work going on in this area?


      Any help/insights would be hugely welcome. 




            • Votes:
              4 Vote for this issue
              6 Start watching this issue


              • Created: