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

Deleting a temporary table forces a reload of the databasemeta cache

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              rezaie9 Shamim Rezaie
              cfulton Charles Fulton
              Michael Hawkins Michael Hawkins
              Andrew Lyons Andrew Lyons
              CiBoT CiBoT
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Matteo Scaramuccia, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              6 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Jun/20

                Time Tracking

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