[MDEV-10961] [10.2.2] innodb_buffer_pool_size configuration & runtime values mismatch Created: 2016-10-06  Updated: 2016-12-24  Resolved: 2016-12-24

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2.2
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: burnley Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

CentOS 6.8 64bit, kernel-4.7.5 & 4.7.6, running as Xen domU



 Description   

Not sure at the moment whether it's a bug or not, however: I've been using for a lot of time innodb_buffer_pool_size=2560M, but since upgrading from 10.2.1 to 10.2.2 the innodb_buffer_pool_size value has gone up by 512M to 3G.

Log extras, before and after the upgrade:

2016-09-18 10:38:01 140480598009888 [Note] InnoDB: Initializing buffer pool, size = 2.5G
2016-09-18 10:38:03 140480598009888 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.30-76.3 started; log sequence number 61766739749

2016-09-28  8:48:53 140006875584512 [Note] InnoDB: Initializing buffer pool, total size = 3G, instances = 8, chunk size = 128M
2016-09-28  8:48:56 140006875584512 [Note] InnoDB: 5.7.14 started; log sequence number 0

Testing with different values, here's what I've found:

Using innodb_buffer_pool_size=2048M

[root@db1 my.cnf.d]# mysql --defaults-file=/root/mysql.conf -e 'show variables like "innodb_buffer_pool_size"' ; mysqld --print-defaults
+-------------------------+------------+
| Variable_name           | Value      |
+-------------------------+------------+
| innodb_buffer_pool_size | 2147483648 |
+-------------------------+------------+

mysqld would have been started with the following arguments:

--log-error=/var/log/mysqld.log \
--datadir=/var/lib/mysql \
--socket=/var/lib/mysql/mysql.sock \
--symbolic-links=0 \
--user=mysql \
--slow_query_log=1 \
--slow_query_log_file=/var/log/mysqld.log \
--skip-name-resolve=1 \
--query_cache_type=0 \
--key_buffer_size=256K \
--innodb_buffer_pool_size=2048M \
--innodb_log_file_size=256M \
--innodb_log_buffer_size=16M \
--innodb_data_file_path=ibdata1:18M;ibdata0:512M;ibdata2:2048M:autoextend \
--innodb_file_per_table=1 \
--innodb_flush_method=O_DIRECT \
--innodb_flush_log_at_trx_commit=0 \
--innodb_io_capacity=1000 \
--max_connections=100 \
--thread_cache_size=8 \
--tmp_table_size=2G \
--max_heap_table_size=2G \
--sort_buffer_size=2M \
--read_buffer_size=2M \
--max_allowed_packet=8M 

Using innodb_buffer_pool_size=2049M

[root@db1 my.cnf.d]# mysql --defaults-file=/root/mysql.conf -e 'show variables like "innodb_buffer_pool_size"' ; mysqld --print-defaults
+-------------------------+------------+
| Variable_name           | Value      |
+-------------------------+------------+
| innodb_buffer_pool_size | 3221225472 |
+-------------------------+------------+

mysqld would have been started with the following arguments:

--log-error=/var/log/mysqld.log \
--datadir=/var/lib/mysql \
--socket=/var/lib/mysql/mysql.sock \
--symbolic-links=0 \
--user=mysql \
--slow_query_log=1 \
--slow_query_log_file=/var/log/mysqld.log \
--skip-name-resolve=1 \
--query_cache_type=0 \
--key_buffer_size=256K \
--innodb_buffer_pool_size=2049M \
--innodb_log_file_size=256M \
--innodb_log_buffer_size=16M \
--innodb_data_file_path=ibdata1:18M;ibdata0:512M;ibdata2:2048M:autoextend \
--innodb_file_per_table=1 \
--innodb_flush_method=O_DIRECT \
--innodb_flush_log_at_trx_commit=0 \
--innodb_io_capacity=1000 \
--max_connections=100 \
--thread_cache_size=8 \
--tmp_table_size=2G \
--max_heap_table_size=2G \
--sort_buffer_size=2M \
--read_buffer_size=2M \
--max_allowed_packet=8M 

Using innodb_buffer_pool_size=3072M

[root@db1 my.cnf.d]# mysql --defaults-file=/root/mysql.conf -e 'show variables like "innodb_buffer_pool_size"' ; mysqld --print-defaults
+-------------------------+------------+
| Variable_name           | Value      |
+-------------------------+------------+
| innodb_buffer_pool_size | 3221225472 |
+-------------------------+------------+

mysqld would have been started with the following arguments:

--log-error=/var/log/mysqld.log \
--datadir=/var/lib/mysql \
--socket=/var/lib/mysql/mysql.sock \
--symbolic-links=0 \
--user=mysql \
--slow_query_log=1 \
--slow_query_log_file=/var/log/mysqld.log \
--skip-name-resolve=1 \
--query_cache_type=0 \
--key_buffer_size=256K \
--innodb_buffer_pool_size=3072M \
--innodb_log_file_size=256M \
--innodb_log_buffer_size=16M \
--innodb_data_file_path=ibdata1:18M;ibdata0:512M;ibdata2:2048M:autoextend \
--innodb_file_per_table=1 \
--innodb_flush_method=O_DIRECT \
--innodb_flush_log_at_trx_commit=0 \
--innodb_io_capacity=1000 \
--max_connections=100 \
--thread_cache_size=8 \
--tmp_table_size=2G \
--max_heap_table_size=2G \
--sort_buffer_size=2M \
--read_buffer_size=2M \
--max_allowed_packet=8M

 
{noformat:title=Using innodb_buffer_pool_size=3073M}
[root@db1 my.cnf.d]# mysql --defaults-file=/root/mysql.conf -e 'show variables like "innodb_buffer_pool_size"' ; mysqld --print-defaults
+-------------------------+------------+
| Variable_name           | Value      |
+-------------------------+------------+
| innodb_buffer_pool_size | 4294967296 |
+-------------------------+------------+

mysqld would have been started with the following arguments:

--log-error=/var/log/mysqld.log \
--datadir=/var/lib/mysql \
--socket=/var/lib/mysql/mysql.sock \
--symbolic-links=0 \
--user=mysql \
--slow_query_log=1 \
--slow_query_log_file=/var/log/mysqld.log \
--skip-name-resolve=1 \
--query_cache_type=0 \
--key_buffer_size=256K \
--innodb_buffer_pool_size=3073M \
--innodb_log_file_size=256M \
--innodb_log_buffer_size=16M \
--innodb_data_file_path=ibdata1:18M;ibdata0:512M;ibdata2:2048M:autoextend \
--innodb_file_per_table=1 \
--innodb_flush_method=O_DIRECT \
--innodb_flush_log_at_trx_commit=0 \
--innodb_io_capacity=1000 \
--max_connections=100 \
--thread_cache_size=8 \
--tmp_table_size=2G \
--max_heap_table_size=2G \
--sort_buffer_size=2M \
--read_buffer_size=2M \
--max_allowed_packet=8M 



 Comments   
Comment by Elena Stepanova [ 2016-10-06 ]

Thanks for the report.

Comment by Elena Stepanova [ 2016-12-24 ]

In fact, it appears to be "by design". Here is what the manual for InnoDB 5.7 says:

Buffer pool size must always be equal to or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances. If you alter the buffer pool size to a value that is not equal to or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances, buffer pool size is automatically adjusted to a value that is equal to or a multiple of innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances that is not less than the specified buffer pool size.

Here we have innodb_buffer_pool_instances == 8, innodb_buffer_pool_chunk_size == 128M, the initial configuration is innodb_buffer_pool_size=2560M, so indeed, the automatically adjusted value per algorithm above would be 3G.

Generated at Thu Feb 08 07:46:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.