1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

MCOL-520 - move mysql_upgrade

This commit is contained in:
David Hill
2018-11-06 16:35:44 -06:00
parent 5d04584704
commit 16e956db02
4 changed files with 53 additions and 19 deletions

View File

@@ -153,8 +153,14 @@ fi
# if um, run mysql install scripts
if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $ServerTypeInstall = "2" ]; then
mysqlPassword=" "
if [[ $password != " " ]]; then
mysqlPassword="--password="$password
fi
echo "Run post-mysqld-install"
$COLUMNSTORE_INSTALL_DIR/bin/post-mysqld-install --installdir=$COLUMNSTORE_INSTALL_DIR > ${tmpDir}/post-mysqld-install.log 2>&1
$COLUMNSTORE_INSTALL_DIR/bin/post-mysqld-install --installdir=$COLUMNSTORE_INSTALL_DIR $mysqlPassword > ${tmpDir}/post-mysqld-install.log 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: post-mysqld-install failed: check ${tmpDir}/post-mysqld-install.log"
exit 1
@@ -162,12 +168,7 @@ if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $Ser
echo "Run post-mysql-install"
mysqlPassword=" "
if [[ $password != " " ]]; then
mysqlPassword="--password="$password
fi
$COLUMNSTORE_INSTALL_DIR/bin/post-mysql-install --installdir=$COLUMNSTORE_INSTALL_DIR $mysqlPassword --tmpdir=${tmpDir} > ${tmpDir}/post-mysql-install.log 2>&1
$COLUMNSTORE_INSTALL_DIR/bin/post-mysql-install --installdir=$COLUMNSTORE_INSTALL_DIR --tmpdir=${tmpDir} > ${tmpDir}/post-mysql-install.log 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: post-mysql-install failed: check ${tmpDir}/post-mysql-install.log"
exit 1

View File

@@ -24,7 +24,7 @@ checkForError() {
echo "checking for engine columnstore..."
$installdir/mysql/bin/mysql \
--defaults-extra-file=$installdir/mysql/my.cnf \
--user=root $pwprompt \
--user=root \
--execute='show engines;' \
calpontsys | grep -i columnstore
@@ -45,7 +45,6 @@ prefix=/usr/local
installdir=$prefix/mariadb/columnstore
rpmmode=install
password=" "
pwprompt=
for arg in "$@"; do
if [ $(expr -- "$arg" : '--prefix=') -eq 9 ]; then
prefix="$(echo $arg | awk -F= '{print $2}')"
@@ -57,8 +56,6 @@ for arg in "$@"; do
prefix=$(dirname $installdir)
elif [ $(expr -- "$arg" : '--tmpdir=') -eq 9 ]; then
tmpdir="$(echo $arg | awk -F= '{print $2}')"
elif [ $(expr -- "$arg" : '--password=') -eq 11 ]; then
password="$(echo $arg | awk -F= '{print $2}')"
else
echo "ignoring unknown argument: $arg" 1>&2
fi

View File

@@ -8,6 +8,10 @@ prefix=/usr/local
installdir=$prefix/mariadb/columnstore
rpmmode=install
user=mysql
password=" "
pwprompt=
if [ $EUID -ne 0 ]; then
USER=`whoami 2>/dev/null`
user=$USER
@@ -24,6 +28,8 @@ for arg in "$@"; do
prefix=`dirname $installdir`
elif [ `expr -- "$arg" : '--user='` -eq 7 ]; then
user="`echo $arg | awk -F= '{print $2}'`"
elif [ $(expr -- "$arg" : '--password=') -eq 11 ]; then
password="$(echo $arg | awk -F= '{print $2}')"
else
echo "post-mysqld-install: ignoring unknown argument: $arg" 1>&2
fi
@@ -68,6 +74,36 @@ fi
# InfiniDB testing hook...
test -x /usr/local/bin/idb-testing-mysql-pre-start && /usr/local/bin/idb-testing-mysql-pre-start $installdir/mysql
if [ -x $installdir/mysql/mysql-Columnstore ]; then
# Restart in the same way that mysqld will be started normally.
$installdir/mysql/mysql-Columnstore stop >/dev/null 2>&1
sleep 2
$installdir/mysql/mysql-Columnstore start
sleep 5
# Run MariaDB (mysql) upgrade script, if it exist
if [ -x $installdir/mysql/bin/mysql_upgrade ]; then
if [[ ${password} == " " ]]; then
$installdir/mysql/bin/mysql_upgrade --defaults-file=$installdir/mysql/my.cnf > $tmpdir/mysql_upgrade.log
if [ $? -ne 0 ]; then
echo "ERROR: mysql_upgrade failure, check $tmpdir/mysql_upgrade.log"
$installdir/mysql/mysql-Columnstore stop
sleep 2
exit 2;
fi
else
$installdir/mysql/bin/mysql_upgrade --defaults-file=$installdir/mysql/my.cnf --password=$password > $tmpdir/mysql_upgrade.log
if [ $? -ne 0 ]; then
echo "ERROR: mysql_upgrade failure, check $tmpdir/mysql_upgrade.log"
$installdir/mysql/mysql-Columnstore stop
sleep 2
exit 2;
fi
fi
fi
fi
### Don't give the user the notes, we'll fix them ourselves...
$installdir/mysql/scripts/mysql_install_db --rpm --user=$user --defaults-extra-file=$installdir/mysql/my.cnf --basedir=$installdir/mysql >/dev/null
# Change permissions again to fix any new files.

View File

@@ -254,7 +254,13 @@ void mysqlSetup()
string tmpDir = startup::StartUp::tmpDir();
cmd = installDir + "/bin/post-mysqld-install --installdir=" + installDir + " > " + tmpDir + "/post-mysqld-install.log 2>&1";
string mysqlpw = oam.getMySQLPassword();
string passwordOption = "";
if ( mysqlpw != oam::UnassignedName )
passwordOption = " --password=" + mysqlpw;
cmd = installDir + "/bin/post-mysqld-install --installdir=" + installDir + " " + passwordOption + " > " + tmpDir + "/post-mysqld-install.log 2>&1";
int rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) != 0)
@@ -283,13 +289,7 @@ void mysqlSetup()
HOME = p;
}
string mysqlpw = oam.getMySQLPassword();
string passwordOption = "";
if ( mysqlpw != oam::UnassignedName )
passwordOption = " --password=" + mysqlpw;
cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " --tmpdir=" + tmpDir + " " + passwordOption + " > " + tmpDir + "/post-mysql-install.log";
cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " --tmpdir=" + tmpDir + " > " + tmpDir + "/post-mysql-install.log";
rtnCode = system(cmd.c_str());
if (WEXITSTATUS(rtnCode) == 2)