You've already forked mariadb-columnstore-engine
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:
@@ -153,8 +153,14 @@ fi
|
|||||||
|
|
||||||
# if um, run mysql install scripts
|
# if um, run mysql install scripts
|
||||||
if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $ServerTypeInstall = "2" ]; then
|
if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $ServerTypeInstall = "2" ]; then
|
||||||
|
|
||||||
|
mysqlPassword=" "
|
||||||
|
if [[ $password != " " ]]; then
|
||||||
|
mysqlPassword="--password="$password
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Run post-mysqld-install"
|
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
|
if [ $? -ne 0 ]; then
|
||||||
echo "ERROR: post-mysqld-install failed: check ${tmpDir}/post-mysqld-install.log"
|
echo "ERROR: post-mysqld-install failed: check ${tmpDir}/post-mysqld-install.log"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -162,12 +168,7 @@ if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $Ser
|
|||||||
|
|
||||||
echo "Run post-mysql-install"
|
echo "Run post-mysql-install"
|
||||||
|
|
||||||
mysqlPassword=" "
|
$COLUMNSTORE_INSTALL_DIR/bin/post-mysql-install --installdir=$COLUMNSTORE_INSTALL_DIR --tmpdir=${tmpDir} > ${tmpDir}/post-mysql-install.log 2>&1
|
||||||
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
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "ERROR: post-mysql-install failed: check ${tmpDir}/post-mysql-install.log"
|
echo "ERROR: post-mysql-install failed: check ${tmpDir}/post-mysql-install.log"
|
||||||
exit 1
|
exit 1
|
||||||
|
@@ -24,7 +24,7 @@ checkForError() {
|
|||||||
echo "checking for engine columnstore..."
|
echo "checking for engine columnstore..."
|
||||||
$installdir/mysql/bin/mysql \
|
$installdir/mysql/bin/mysql \
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
--defaults-extra-file=$installdir/mysql/my.cnf \
|
||||||
--user=root $pwprompt \
|
--user=root \
|
||||||
--execute='show engines;' \
|
--execute='show engines;' \
|
||||||
calpontsys | grep -i columnstore
|
calpontsys | grep -i columnstore
|
||||||
|
|
||||||
@@ -45,7 +45,6 @@ prefix=/usr/local
|
|||||||
installdir=$prefix/mariadb/columnstore
|
installdir=$prefix/mariadb/columnstore
|
||||||
rpmmode=install
|
rpmmode=install
|
||||||
password=" "
|
password=" "
|
||||||
pwprompt=
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
if [ $(expr -- "$arg" : '--prefix=') -eq 9 ]; then
|
if [ $(expr -- "$arg" : '--prefix=') -eq 9 ]; then
|
||||||
prefix="$(echo $arg | awk -F= '{print $2}')"
|
prefix="$(echo $arg | awk -F= '{print $2}')"
|
||||||
@@ -57,8 +56,6 @@ for arg in "$@"; do
|
|||||||
prefix=$(dirname $installdir)
|
prefix=$(dirname $installdir)
|
||||||
elif [ $(expr -- "$arg" : '--tmpdir=') -eq 9 ]; then
|
elif [ $(expr -- "$arg" : '--tmpdir=') -eq 9 ]; then
|
||||||
tmpdir="$(echo $arg | awk -F= '{print $2}')"
|
tmpdir="$(echo $arg | awk -F= '{print $2}')"
|
||||||
elif [ $(expr -- "$arg" : '--password=') -eq 11 ]; then
|
|
||||||
password="$(echo $arg | awk -F= '{print $2}')"
|
|
||||||
else
|
else
|
||||||
echo "ignoring unknown argument: $arg" 1>&2
|
echo "ignoring unknown argument: $arg" 1>&2
|
||||||
fi
|
fi
|
||||||
|
@@ -8,6 +8,10 @@ prefix=/usr/local
|
|||||||
installdir=$prefix/mariadb/columnstore
|
installdir=$prefix/mariadb/columnstore
|
||||||
rpmmode=install
|
rpmmode=install
|
||||||
user=mysql
|
user=mysql
|
||||||
|
|
||||||
|
password=" "
|
||||||
|
pwprompt=
|
||||||
|
|
||||||
if [ $EUID -ne 0 ]; then
|
if [ $EUID -ne 0 ]; then
|
||||||
USER=`whoami 2>/dev/null`
|
USER=`whoami 2>/dev/null`
|
||||||
user=$USER
|
user=$USER
|
||||||
@@ -24,6 +28,8 @@ for arg in "$@"; do
|
|||||||
prefix=`dirname $installdir`
|
prefix=`dirname $installdir`
|
||||||
elif [ `expr -- "$arg" : '--user='` -eq 7 ]; then
|
elif [ `expr -- "$arg" : '--user='` -eq 7 ]; then
|
||||||
user="`echo $arg | awk -F= '{print $2}'`"
|
user="`echo $arg | awk -F= '{print $2}'`"
|
||||||
|
elif [ $(expr -- "$arg" : '--password=') -eq 11 ]; then
|
||||||
|
password="$(echo $arg | awk -F= '{print $2}')"
|
||||||
else
|
else
|
||||||
echo "post-mysqld-install: ignoring unknown argument: $arg" 1>&2
|
echo "post-mysqld-install: ignoring unknown argument: $arg" 1>&2
|
||||||
fi
|
fi
|
||||||
@@ -68,6 +74,36 @@ fi
|
|||||||
# InfiniDB testing hook...
|
# InfiniDB testing hook...
|
||||||
test -x /usr/local/bin/idb-testing-mysql-pre-start && /usr/local/bin/idb-testing-mysql-pre-start $installdir/mysql
|
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...
|
### 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
|
$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.
|
# Change permissions again to fix any new files.
|
||||||
|
@@ -254,7 +254,13 @@ void mysqlSetup()
|
|||||||
|
|
||||||
string tmpDir = startup::StartUp::tmpDir();
|
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());
|
int rtnCode = system(cmd.c_str());
|
||||||
|
|
||||||
if (WEXITSTATUS(rtnCode) != 0)
|
if (WEXITSTATUS(rtnCode) != 0)
|
||||||
@@ -283,13 +289,7 @@ void mysqlSetup()
|
|||||||
HOME = p;
|
HOME = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
string mysqlpw = oam.getMySQLPassword();
|
cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " --tmpdir=" + tmpDir + " > " + tmpDir + "/post-mysql-install.log";
|
||||||
|
|
||||||
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";
|
|
||||||
rtnCode = system(cmd.c_str());
|
rtnCode = system(cmd.c_str());
|
||||||
|
|
||||||
if (WEXITSTATUS(rtnCode) == 2)
|
if (WEXITSTATUS(rtnCode) == 2)
|
||||||
|
Reference in New Issue
Block a user