Bug #76344 mysql_install_db does not wait for forked mysqld to finish bootstrap
Submitted: 16 Mar 2015 22:32 Modified: 27 Mar 2015 2:41
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:5.7.6-m16 OS:Any
Assigned to: CPU Architecture:Any

[16 Mar 2015 22:32] Roel Van de Paar
Description:
Testcase below, on 5.7.6-m16 (but NOT on 5.7.6-m15) fails to re-create ib_logfile's

2015-03-16T22:26:38.125971Z 0 [ERROR] InnoDB: Cannot create log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2015-03-16T22:26:38.726520Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2015-03-16T22:26:38.726543Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-03-16T22:26:38.726562Z 0 [ERROR] Failed to initialize plugins.
2015-03-16T22:26:38.726571Z 0 [ERROR] Aborting

How to repeat:
Minimal testcase (cleans up at start, can be run multiple times in a row).

BASE=/sda/MS-mysql-5.7.6-m16-linux-x86_64-debug
WORK=/dev/shm/test
ps -ef | egrep $WORK | grep -v grep | awk '{print $2}' | xargs kill -9 2>/dev/null
rm -Rf $WORK
mkdir -p $WORK/template
cd $BASE/
./bin/mysql_install_db --no-defaults --insecure --basedir=$BASE --datadir=$WORK/template
rm $WORK/template/ib_logfile0 $WORK/template/ib_logfile1
mkdir -p $WORK/1/data $WORK/1/log
cp -R $WORK/template/* $WORK/1/data
./bin/mysqld --no-defaults --basedir=$BASE --datadir=$WORK/1/data --port=51684 --pid_file=$WORK/1/pid.pid --socket=$WORK/1/socket.sock --log-error=$WORK/1/log/master.err
cat $WORK/1/log/master.err | grep "ERROR"
[16 Mar 2015 22:48] Roel Van de Paar
mysqld --initialize-insecure works (but that does not alter the m16 regression; mysql_install_db is not deprecated yet)

BASE=/sda/MS-mysql-5.7.6-m16-linux-x86_64-debug
WORK=/dev/shm/test
ps -ef | egrep $WORK | grep -v grep | awk '{print $2}' | xargs kill -9 2>/dev/null
rm -Rf $WORK
mkdir -p $WORK/template
cd $BASE/
#./bin/mysql_install_db --no-defaults --insecure --basedir=$BASE --datadir=$WORK/template
./bin/mysqld --initialize-insecure --basedir=$BASE --datadir=$WORK/template
rm $WORK/template/ib_logfile0 $WORK/template/ib_logfile1
mkdir -p $WORK/1/data $WORK/1/log
cp -R $WORK/template/* $WORK/1/data
./bin/mysqld --no-defaults --basedir=$BASE --datadir=$WORK/1/data --port=51684 --pid_file=$WORK/1/pid.pid --socket=$WORK/1/socket.sock --log-error=$WORK/1/log/master.err
cat $WORK/1/log/master.err | grep "ERROR"
[20 Mar 2015 7:06] Roel Van de Paar
Thanks for the new title reflecting the core issue, that helps :)
[27 Mar 2015 2:41] Paul DuBois
Noted in 5.7.7, 5.8.0 changelogs.

mysql_install_db started mysqld in bootstrap mode, but failed to wait
for it to finish, causing premature shutdown and the need for crash
recovery.