Comment 11 for bug 1428385

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote : Re: Percona Server 5.6.22-72.0 failed to start

Basically, I am able to reproduce something similar (not exactly the same) with a very simple text case. Look:

[root@centos ~]# mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-72.1-log Percona Server (GPL), Release 72.1, Revision 0503478

Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@datadir, @@innodb_data_file_path;
+-----------------+------------------------------------+
| @@datadir | @@innodb_data_file_path |
+-----------------+------------------------------------+
| /var/lib/mysql/ | ibdata1:18M;ibdata2:12M:autoextend |
+-----------------+------------------------------------+
1 row in set (0.00 sec)

mysql> exit
Bye
[root@centos ~]# vi /etc/my.cnf
[root@centos ~]# service mysql restart
Shutting down MySQL (Percona Server)................. SUCCESS!
Starting MySQL (Percona Server)...... SUCCESS!
[root@centos ~]# ls -lh /var/lib/mysql/ibdata*
-rw-rw----. 1 mysql mysql 18M Mar 16 20:17 /var/lib/mysql/ibdata1
-rw-rw----. 1 mysql mysql 12M Mar 16 20:17 /var/lib/mysql/ibdata2

So, it was a very basic setup of Percona Server with 2 data files. One was 18M at the moment when I started this test, then I've added another one, 12M in size and auto extending. So far it's OK.

Now, I planned to add another one, 13M in size (for whatever reason), ibdata3, but made a typo and added ibdata2 for a second time 9buth with different size 13M):

[root@centos ~]# grep innodb_data_file /etc/my.cnf
innodb_data_file_path=ibdata1:18M;ibdata2:12M;ibdata2:13M:autoextend
[root@centos ~]# service mysql restart
Shutting down MySQL (Percona Server).................. SUCCESS!
Starting MySQL (Percona Server)..................... ERROR! The server quit without updating PID file (/var/lib/mysql/centos.pid).
[root@centos ~]# ps aux | grep mysqld
root 4539 0.0 0.0 103244 868 pts/0 S+ 20:19 0:00 grep mysqld

So, we had got an error and in the error log we see:

[root@centos ~]# tail -80 /var/log/mysqld.log

150316 20:18:54 mysqld_safe mysqld from pid file /var/lib/mysql/centos.pid ended
150316 20:18:58 mysqld_safe Transparent huge pages are already set to: never.
150316 20:18:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2015-03-16 20:19:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-03-16 20:19:00 4337 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=centos-bin' to avoid this problem.
2015-03-16 20:19:00 4337 [Note] Plugin 'FEDERATED' is disabled.
2015-03-16 20:19:00 4337 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-03-16 20:19:00 4337 [Note] InnoDB: The InnoDB memory heap is disabled
2015-03-16 20:19:00 4337 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-03-16 20:19:00 4337 [Note] InnoDB: Memory barrier is not used
2015-03-16 20:19:00 4337 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-03-16 20:19:00 4337 [Note] InnoDB: Using Linux native AIO
2015-03-16 20:19:00 4337 [Note] InnoDB: Not using CPU crc32 instructions
2015-03-16 20:19:00 4337 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-03-16 20:19:00 4337 [Note] InnoDB: Completed initialization of buffer pool
2015-03-16 20:19:00 4337 [ERROR] InnoDB: auto-extending data file ./ibdata2 is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 832 pages, max 0 (relevant if non-zero) pages!
2015-03-16 20:19:00 4337 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2015-03-16 20:19:00 4337 [ERROR] Plugin 'InnoDB' init function returned error.
2015-03-16 20:19:00 4337 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
...

What if we try smaller size, 9M? Then it works:

[root@centos ~]# grep innodb_data_file /etc/my.cnf
innodb_data_file_path=ibdata1:18M;ibdata2:12M;ibdata2:9M:autoextend
[root@centos ~]# ls -lh /var/lib/mysql/ibdata*
-rw-rw----. 1 mysql mysql 18M Mar 16 20:18 /var/lib/mysql/ibdata1
-rw-rw----. 1 mysql mysql 12M Mar 16 20:18 /var/lib/mysql/ibdata2
[root@centos ~]# service mysql start
Starting MySQL (Percona Server)...... SUCCESS!
[root@centos ~]# ls -lh /var/lib/mysql/ibdata*
-rw-rw----. 1 mysql mysql 18M Mar 16 20:27 /var/lib/mysql/ibdata1
-rw-rw----. 1 mysql mysql 12M Mar 16 20:18 /var/lib/mysql/ibdata2
[root@centos ~]# mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-72.1-log Percona Server (GPL), Release 72.1, Revision 0503478

Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@datadir, @@innodb_data_file_path;
+-----------------+-----------------------------------------------+
| @@datadir | @@innodb_data_file_path |
+-----------------+-----------------------------------------------+
| /var/lib/mysql/ | ibdata1:18M;ibdata2:12M;ibdata2:9M:autoextend |
+-----------------+-----------------------------------------------+
1 row in set (0.00 sec)

So, some duplicate entries work, while some lead to error messages. Maybe with the file really used for some tables one may end up with error like the one in the initial report, but essentially we have a reason to ask at least to NOT accept duplicate paths at all, as this may lead to different kinds of problems.