Bug #74835 Embedded server fails to bootstrap/start up with innodb_undo_tablespaces=2
Submitted: 13 Nov 2014 9:34 Modified: 5 May 2015 15:52
Reporter: Marko Mäkelä Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.7.6 OS:Any
Assigned to: CPU Architecture:Any

[13 Nov 2014 9:34] Marko Mäkelä
The embedded MySQL server fails to start up when the server has been bootstrapped with multiple undo tablespaces.

The server bootstrap seems to be fine; we do have the undo tablespaces created. The startup fails, because srv_undo_tablespaces_init() is returning DB_TABLESPACE_NOT_FOUND.

How to repeat:
./mtr --mem --{mysqld,bootstrap}=--innodb-undo-tablespaces=2 --embedded main.1st
main.1st                                 [ fail ]
        Test ended at 2014-11-13 11:16:20

CURRENT_TEST: main.1st
mysqltest: Can't initialize MySQL server

Suggested fix:
Remove the absolute path setup from InnoDB startup, and clean up the code a little (do not prepend "./" either):

diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index b8ec197..dde6b9f 100755
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -3080,7 +3080,7 @@ innobase_init(
        Note that when using the embedded server, the datadirectory is not
        necessarily the current directory of this program. */
-       if (mysqld_embedded) {
+       if (0) {
                default_path = mysql_real_data_home;
                fil_path_to_mysql_datadir = mysql_real_data_home;
        } else {
[5 May 2015 15:52] Daniel Price
Fixed as of the upcoming 5.7.8, 5.8.0 releases, and here's the changelog

An embedded MySQL server failed to start with
"innodb_undo_tablespaces=2". The server was unable to locate undo
tablespaces that were created when the MySQL instance was initialized. For
embedded MySQL installations, the "innodb_undo_directory" default value of
""."" may not be the same directory as the MySQL data directory. To
address this problem, "innodb_undo_directory" is now NULL by default,
requiring that a path be specified. If a path is not specified, undo
tablespaces are created in the MySQL data directory, as defined by
"datadir". A workaround for pre-MySQL 5.7.8 embedded installations is to
define an absolute path for "innodb_undo_directory".

Related reference manual updates (changes should appear within the next 24