Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-7676

Memory leak when dropping database that has partitioned tables


    • Bug
    • Status: Done
    • Medium
    • Resolution: Won't Fix
    • 8.0.23-14 (Q1 2021)
    • None
    • None


      MySQL memory leaks when dropping a database that has many partitioned tables.

      How to Repeat

      1. Start mysqld. For example, you can use this command:

      ./mtr --start innodb --mysqld=--innodb_buffer_pool_size=1G --mysqld=--innodb_log_file_size=512M --mysqld=--innodb-write-io-threads=64  --mysqld=--innodb_open_files=65535 &

      2. Make sure innodb_file_per_table is ON
      3. Start watching memory usage of the mysqld process:

      pidstat -r -p `cat var/run/mysqld.1.pid` 2 > pidstat.`cat var/run/mysqld.1.pid`.8023 &

      4. Open a new terminal and run the attached test case. It creates 100 tables, each having 8100 partitions, then drops the database holding these tables.
      5. You will notice that memory usage will increase. In my case, it was 0,37% RAM after the first few tables were created, 12.19% while DROP DATABASE was running, and 9.23% when DROP DATABASE finished. Memory usage did not decrease further.
      6. Run the test second time and watch memory usage.

      In my case it grew up to 19.33%, then lowered down to 16.39%.

      The issue

      We have two issues here.

      1. Significant memory use increase after creating 100 partitioned tables, then dropping the database that holds them.
      2. The fact that after the second test run memory usage increased by the almost same amount.

      In both cases, memory was not freed once the job is done.

      Upstream exhibits the same behavior for the test run, but after the second run memory use increased only by 0.1% that makes this behavior not so critical




            kamil.holubicki Kamil Holubicki
            sveta.smirnova Sveta Smirnova
            1 Vote for this issue
            5 Start watching this issue



              Time Tracking

                Original Estimate - 1 hour, 1 minute Original Estimate - 1 hour, 1 minute
                1h 1m
                Time Spent - 4 days, 16 minutes Remaining Estimate - 1 hour, 1 minute
                1h 1m
                Time Spent - 4 days, 16 minutes Remaining Estimate - 1 hour, 1 minute
                4d 16m

                Smart Checklist