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

Deleting a temporary table forces a reload of the databasemeta cache


    • 0
    • International 3.9 - Sprint 3, International 3.9 - Sprint 4, International 3.9 - Sprint 5

      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.

            rezaie9 Shamim Rezaie
            cfulton Charles Fulton
            Michael Hawkins Michael Hawkins
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            6 Vote for this issue
            10 Start watching this issue


                Original Estimate - Not Specified
                Not Specified
                Remaining Estimate - 0 minutes
                Time Spent - 4 days, 3 hours, 2 minutes
                4d 3h 2m

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