Bug #73309 Cannot change buffer pool size
Submitted: 17 Jul 2014 9:58 Modified: 17 Aug 2014 17:05
Reporter: David Canos Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S2 (Serious)
Version:5.6.19 OS:Linux
Assigned to: CPU Architecture:Any
Tags: innodb, memory allocation, performance schema

[17 Jul 2014 9:58] David Canos
Description:
I am not able to change innodb_buffer_pool_size.
Using MySQL 5.6.19 on CentOS 6.5

I have a 2Gb RAM, first time a set buffer pool to 1GB  
MySQL Started ok
After this I decreased buffer pool to 800M, this error appears during boot:

1266-2014-07-17 10:46:56 29855 [Note] InnoDB: Initializing buffer pool, size = 800.0M
1267-InnoDB: mmap(858521600 bytes) failed; errno 12
1268:2014-07-17 10:46:56 29855 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
1269-2014-07-17 10:46:56 29855 [ERROR] Plugin 'InnoDB' init function returned error.

I expect this message if i'd set buffer pool to a value higher than available memory, but not decreasing. 
If I rollback the changes setting innodb_buffer_pool_size to 1Gb back, it boots normally.

I surprisingly find out that turning off performance schema allow me to change buffer pool size and restart as usual. 

# Innodb configuration
innodb                         = FORCE
innodb_strict_mode             = 1
innodb_file_per_table           = 1
innodb_file_format              = Barracuda
innodb_buffer_pool_size         = 800M
innodb_log_file_size            = 128M

innodb_support_xa               = 1
innodb_doublewrite              = 0
innodb_flush_method             = O_DIRECT
innodb_flush_log_at_trx_commit  = 2
innodb_checksum_algorithm       = crc32
innodb_io_capacity              = 20000
innodb_flush_neighbors          = 0
innodb_thread_concurrency       = 0 

How to repeat:
I have reproduced two times in digitalocean droplets, 2Gb and 500Mb each one.

Install 5.6.19 from repository on a empty server.
> wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
> yum localinstall mysql-community-release-el6-5.noarch.rpm
> yum install mysql-community-server 
> service mysqld start
> /usr/bin/mysql_secure_installation
(custom /etc/my.cnf setting innodb configuration (see description) and enabling performance schema
> service mysqld restart
works fine

Decrease my.cnf innodb_buffer_pool 
> service mysqld restart
Reboot MySQL fails, check error_log 

Disable performance schema in my.cnf
> service mysqld restart
Reboot MySQL, works fine
[17 Jul 2014 11:37] Sveta Smirnova
Thank you for the report.

Please provide options from your configuration, related to performance schema.
[17 Jul 2014 11:42] MySQL Verification Team
Also, see Bug #72719.
[17 Jul 2014 12:01] David Canos
Defaults performance schema settings
[17 Jul 2014 17:05] Sveta Smirnova
Thank you for the feedback.

I cannot repeat described behavior.

I think cause of this can be the fact that OS did not free RAM which were occupied by mysqld when it allocated 1G first time. Please run following tests:

1.1. Stop mysqld using mysqladmin shutdown command, ensure it shutdowns fine (there should be records "InnoDB: Shutdown completed; log sequence number...", "./bin/mysqld: Shutdown complete" in the error log file)
1.2. Try to start server with smaller innodb_buffer_pool_size

And

2.1. Don't decrease size of the buffer pool, but simply restart mysqld using command `service mysqld restart`

If you cannot repeat the issue in both cases please send us full error log file.
[18 Aug 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".