MySQL: Enabling innodb_undo_tablespaces
Question
We recently tried setting innodb_undo_tablespaces=2
for our mysql 5.7 server. But during the restart the server returned with:
[ERROR] InnoDB: Expected to open 2 undo tablespaces but was able to find only 0 undo tablespaces. Set the innodb_undo_tablespaces parameter to the correct value and retry. Suggested value is 0
It turns out this is already documented : "The number of innodb_undo_tablespaces must be set prior to initializing InnoDB. Attempting to restart InnoDB with a greater number of undo tablespaces than you specified when you first created the database will result in a failed start and an error stating that InnoDB did not find the expected number of undo tablespaces."
What does "first created the database" mean? Does the documentation mean a fresh installation of mysql where there are no databases within the server? Is there a way to bypass this requirement?
Solution
Probably refers to "fresh installation".
The workaround is painful...
- Dump all the data.
- Stop mysqld.
- Blow away ibdata1 and iblogs.
- Change the setting in my.cnf.
- Restart. (This should feel like a 'fresh' install.)
- Reload the data.
Do you have some indication that changing that setting will help you significantly? If so, please explain. It is a very new feature, and is there for a reason, but not many users need it.
Also
from the 5.7 documentation, - dev.mysql.com/doc/refman/5.7/en/innodb-undo-tablespaces.html
The innodb_undo_tablespaces configuration option is deprecated and will be removed in a future release." and "The number of undo tablespaces can only be configured when initializing a MySQL instance and is fixed for the life of the instance."
– Thanks to @OutfastSource