Memory leak caused by query table meta data?
- Date: Mon, 9 May 2016 10:24:15 -0700
- From: Zhaobang Liu <liuzhaobang001@xxxxxxxxx>
- Subject: Memory leak caused by query table meta data?
We know that normally Mysql is good at controlling memory usage but the
problem we are seeing is a bit suspicious. I want to ask for help to see
whether somebody can help on debugging the issue. Feel free to let me know
if there are more details needed.
The databases we have are all in InnoDB. There are around 4400 tables in a
database. Lots of tables are partitioned by yearweek and having more than
How to reproduce the issue:
1) We have a script to monitor table schema and create partitions. While
running it, we found running 'SHOW CREATE TABLE xxx' on each table will
make Mysql take more and more memory. After scanning all of the tables,
mysql has started using more than 1GB swap.
2) We had a migration recently to add a column to half of the tables we
have. The query is like 'ALTER ONLINE TABLE table_name ADD COLUMN IF NOT
EXISTS (`col` smallint(3) DEFAULT NULL)' and it was in one thread to
migration the tables one by one. The memory usage keeps increasing and
start to swap as well.
Mariadb 10.0.20 running on 64 bit CentOS6.7. 7GB RAM, 8GB
swap. vm.swappiness = 30.
innodb-buffer-pool-size = 2G
innodb-buffer-pool-instances = 2
innodb-additional-mem-pool-size = 20M
innodb-log-buffer-size = 4M
innodb-thread-concurrency = 4
innodb-file-format = Barracuda
innodb-file-per-table = 1
query-cache-type = 1
query-cache-size = 16M
thread-cache-size = 64
table-open-cache = 1024
table-definition-cache = 2048