Description:
If you create a symlink from your undo log folder to MySQL datadir MySQL fails to start.
It looks like MySQL is looking for undo logs in both innodb_undo_directory and also scans the complete datadir...
By creating a new MySQL 8.0.16 instance and configuring undo logs outside default location (datadir), like under /tmp/undo-logs. Now creating a symlink from /tmp/undo-logs to the MySQL datadir (you can name the symlink whatever) and MySQL will not start.
You will get errors like:
2019-05-29T07:03:57.947902Z 1 [ERROR] [MY-012209] [InnoDB] Multiple files found for the same tablespace ID:
2019-05-29T07:03:57.947918Z 1 [ERROR] [MY-012202] [InnoDB] Tablespace ID: 4294967278 = ['kalle/undo_002', 'undo_002']
2019-05-29T07:03:57.947930Z 1 [ERROR] [MY-012202] [InnoDB] Tablespace ID: 4294967279 = ['kalle/undo_001', 'undo_001']
How to repeat:
1) Create a new installation of 8.0.16
2) Configure undo logs to dedicated folder like: innodb_undo_directory = /tmp/undo-logs
3) Create a symlink from undo folder to datadir folder using ln -s
4) Try to restart MySQL
In my setup I use our tar packages for Linux and configure innodb_undo_directory = /tmp/undo-logs.
Next after starting MySQL I create a symlink like: ln -s /tmp/undo-logs /home/ted/sandboxes/MySQL-HOWTOs/mysqldata/kalle
My datadir is /home/ted/sandboxes/MySQL-HOWTOs/mysqldata
Full MySQL configuration:
[mysqld_safe]
socket = /tmp/mysql.sock
[mysqld]
basedir = /home/ted/sandboxes/MySQL-HOWTOs/mysqlsrc
datadir = /home/ted/sandboxes/MySQL-HOWTOs/mysqldata
port = 3306
secure_file_priv = /tmp
default_authentication_plugin = mysql_native_password
performance-schema-instrument='wait/lock/metadata/sql/mdl=ON'
innodb_undo_directory = /tmp/undo-logs
I create/start MySQL instance by running:
mysqld --initialize-insecure --basedir=$WS_HOME/mysqlsrc --datadir=$WS_HOME/mysqldata --innodb-undo-directory=/tmp/undo-logs
mysqld_safe --defaults-file=$WS_HOME/my.cnf --ledir=$WS_HOME/mysqlsrc/bin &
Suggested fix:
Do not try to auto-discover undo logs in datadir, not sure why this is done.