diff --git a/oam/install_scripts/module_installer.sh b/oam/install_scripts/module_installer.sh index c2c48af43..0f8d6ba14 100755 --- a/oam/install_scripts/module_installer.sh +++ b/oam/install_scripts/module_installer.sh @@ -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 diff --git a/oam/install_scripts/post-mysql-install b/oam/install_scripts/post-mysql-install index f70c3fc93..8a4c0291d 100755 --- a/oam/install_scripts/post-mysql-install +++ b/oam/install_scripts/post-mysql-install @@ -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 diff --git a/oam/install_scripts/post-mysqld-install b/oam/install_scripts/post-mysqld-install index e712b2813..27eba3d42 100755 --- a/oam/install_scripts/post-mysqld-install +++ b/oam/install_scripts/post-mysqld-install @@ -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. diff --git a/oamapps/postConfigure/helpers.cpp b/oamapps/postConfigure/helpers.cpp index 322ecb6c3..deedd4c60 100644 --- a/oamapps/postConfigure/helpers.cpp +++ b/oamapps/postConfigure/helpers.cpp @@ -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)