← Back to team overview

mahara-contributors team mailing list archive

[Bug 1841118] [NEW] upgrade query takes too long in DB upgrade to 18.04

 

Public bug reported:

When upgrading from 17.10 to 18.04, with MySQL 5.7 the upgrade script
takes too long to upgrade the event_log table

In queries like

            log_debug('Adjust existing "event_log" data for "saveview" and "deleteview" events');
            $sql = "UPDATE {event_log} e
                    LEFT JOIN {view} v ON v.id = JSON_EXTRACT( CAST( e.data AS JSON ), '$.id')
                    SET e.resourceid   = JSON_EXTRACT( CAST( e.data AS JSON ), '$.id'),
                        e.resourcetype = 'view',
                        e.ownerid      = v.owner,
                        e.ownertype    = CASE WHEN v.owner IS NULL THEN NULL ELSE 'view' END
                    WHERE e.event IN ('saveview', 'deleteview')";
            execute_sql($sql);

if there are too many logs in the table, the sql query will take too
long too run. This needs to be improved.

** Affects: mahara
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1841118

Title:
  upgrade query takes too long in DB upgrade to 18.04

Status in Mahara:
  New

Bug description:
  When upgrading from 17.10 to 18.04, with MySQL 5.7 the upgrade script
  takes too long to upgrade the event_log table

  In queries like

              log_debug('Adjust existing "event_log" data for "saveview" and "deleteview" events');
              $sql = "UPDATE {event_log} e
                      LEFT JOIN {view} v ON v.id = JSON_EXTRACT( CAST( e.data AS JSON ), '$.id')
                      SET e.resourceid   = JSON_EXTRACT( CAST( e.data AS JSON ), '$.id'),
                          e.resourcetype = 'view',
                          e.ownerid      = v.owner,
                          e.ownertype    = CASE WHEN v.owner IS NULL THEN NULL ELSE 'view' END
                      WHERE e.event IN ('saveview', 'deleteview')";
              execute_sql($sql);

  if there are too many logs in the table, the sql query will take too
  long too run. This needs to be improved.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1841118/+subscriptions


Follow ups