Bug #78831 InnoDB looks for buffer pool file name in '/' if innodb_data_home_dir is empty
Submitted: 14 Oct 2015 9:56 Modified: 18 Dec 2015 18:34
Reporter: Rahul Sisondia Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.9 OS:Any
Assigned to: CPU Architecture:Any

[14 Oct 2015 9:56] Rahul Sisondia
Description:
Referring to https://dev.mysql.com/doc/refman/5.7/en/innodb-init-startup-configuration.html 

innodb_data_home_dir can be set as empty 

And referring to https://dev.mysql.com/doc/refman/5.7/en/innodb-preload-buffer-pool.html 

buffer pool file is always created in the innodb_data_home_dir 

Now, If I start server with following two parameters set in cnf file

innodb_data_home_dir =
innodb_buffer_pool_filename=ib_buffer_pool

then server looks for ib_buffer_pool in the root directory and throws following errors. 

Cannot open '/ib_buffer_pool' for reading: No such file or directory
Cannot open '/ib_buffer_pool.incomplete' for writing: Permission denied

How to repeat:

Start server with following options and see the error in the logs. 

innodb_data_home_dir =
innodb_buffer_pool_filename=ib_buffer_pool

Suggested fix:
There are two possible places to look for the problem. 

1. Following statement in the innobase_init() @ ha_innodb.cc, checks only for null pointer but doesn't check for null char. As a result if condition remains true. 

	srv_data_home = innobase_data_home_dir
		? innobase_data_home_dir : default_path;

2.  In buf0dump.cc, use some other variable instead of srv_data_home 

buf_dump_generate_path(
	char*	path,
	size_t	path_size)
{
	char	buf[FN_REFLEN];

	ut_snprintf(buf, sizeof(buf), "%s%c%s", srv_data_home,
		    OS_PATH_SEPARATOR, srv_buf_dump_filename);
[18 Dec 2015 18:34] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.6.29, 5.7.11, 5.8.0 release, and here's the changelog entry:

Starting the server with an empty innodb_data_home_dir entry in the
configuration file caused InnoDB to look for the buffer pool file in the
root directory, resulting in a startup error.