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

Deleting a temporary table forces a reload of the databasemeta cache (Backport of MDL-58584)

XMLWordPrintable

    • MOODLE_38_STABLE
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • Hide

      PHPUnit tests will check that everything is ok

      Show
      PHPUnit tests will check that everything is ok

      MDL-51374 introduced new behavior with temporary tables and the database cache; the creation and deletion of temporary tables isn't supposed to force a cache reload. This works on table creation but not deletion. The issue is that the temporary table is unlisted as such before the cache is reset, so the cache reset code doesn't know it was a temporary table and resets the whole cache. This leads to performance issues if you're running a job which creates and deletes numerous temporary tables, such as mass-creation of backups.

      This is the order of operations when deleting a temporary table:

      1. database_manager->drop_table()
        1. sql_generator->getDropTableSQL()
          1. moodle_temptables->delete_temptable()
        2. database_manager->execute_sql_arr()
          1. moodle_database->change_database_structure()
            1. moodle_database->reset_caches()

      To get the desired behavior I think the code in delete_temptable() needs to fire after the cache is reset. While examining my development environment I saw SHOW TABLE queries and column parsing after every backup and restore operation.

            jan.dagefoerde Jan Dageförde
            lucaboesch Luca Bösch
            Sam Marshall Sam Marshall
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 20 minutes
                20m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.