Comment 4 for bug 710799

Revision history for this message
Joshua Prunier (joshua-prunier) wrote :

I do not believe this bug has been fixed in 5.5.30-30.2 (and possibly 5.1.68-14.6 but I have not tested it) as the test database directory still gets created during an upgrade.

The following code snippet from rpm -qp --scripts Percona-Server-server-55-5.5.30-rel30.2.500.rhel6.x86_64.rpm will recreate the test directory if it is not there when the rpm is installed.

if [ $1 -eq 1 ]; then
# ----------------------------------------------------------------------
# Create data directory if needed, check whether upgrade or install
# ----------------------------------------------------------------------
if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
if [ -f $STATUS_FILE ] ; then
        SERVER_TO_START=`grep '^SERVER_TO_START=' $STATUS_FILE | cut -c17-`
else
        SERVER_TO_START=''
fi
# echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
if [ ! -d $mysql_datadir/mysql ] ; then
        mkdir $mysql_datadir/mysql;
        echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE
else
        # If the directory exists, we may assume it is an upgrade.
        echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE
fi
if [ ! -d $mysql_datadir/test ]; then
        mkdir $mysql_datadir/test;
fi
/usr/bin/mysql_install_db --rpm --user=mysql
fi

Running mysql_install_db will create the test directory if it is not there which makes the test directory check and creation unnecessary. A possible fix could be to check the existence of the test directory prior to mysql_install_db being invoked and then $mysql_datadir/test removed if an upgrade is being performed and the test database did not exist prior to installing the rpm.

Something like:

if [ $1 -eq 1 ]; then
# ----------------------------------------------------------------------
# Create data directory if needed, check whether upgrade or install
# ----------------------------------------------------------------------
if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
if [ -f $STATUS_FILE ] ; then
        SERVER_TO_START=`grep '^SERVER_TO_START=' $STATUS_FILE | cut -c17-`
else
        SERVER_TO_START=''
fi
# echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
if [ ! -d $mysql_datadir/mysql ] ; then
        mkdir $mysql_datadir/mysql;
        echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE
else
        # If the directory exists, we may assume it is an upgrade.
        echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE

        if [ ! -d $mysql_datadir/test ] ; then
             RMTEST=1
        else
             RMTEST=0
        fi
fi

/usr/bin/mysql_install_db --rpm --user=mysql

if [ $RMTEST = 1 ] ; then
     rm -rf $mysql_datadir/test;
fi
fi