1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Merge pull request #1256 from drrtuy/RIP-postConfigure_2

RIP post configure 2
This commit is contained in:
Patrick LeBlanc
2020-06-05 12:17:43 -05:00
committed by GitHub
20 changed files with 96 additions and 60 deletions

View File

@ -47,6 +47,8 @@ install(PROGRAMS columnstore-post-install
mcs-stop-controllernode.sh
mcs-loadbrm.py
mcs-start-storagemanager.py
mariadb-columnstore-start.sh
mariadb-columnstore-stop.sh
DESTINATION ${ENGINE_BINDIR} COMPONENT columnstore-engine)
install(FILES mariadb-columnstore.service

View File

@ -5,13 +5,43 @@
# Post-install steps for columnstore install
running_systemd() {
if [ "$(ps --no-headers -o comm 1)" == "systemd" ]; then
if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then
echo 0
else
echo 1
fi
}
checkForError() {
# check for password error
grep "ERROR 1045" ${tmpDir}/mysql_install.log > ${tmpDir}/error.check
if [ `cat ${tmpDir}/error.check | wc -c` -ne 0 ]; then
echo "MySQL Password file missing or incorrect, check .my.cnf file"
rm -f ${tmpDir}/error.check
exit 2;
fi
rm -f ${tmpDir}/error.check
#---------------------------------------------------------------------------
# See if engine columnstore exist
#---------------------------------------------------------------------------
echo "checking for engine columnstore..."
su -s /bin/sh -c 'mysql --execute="show engines"' mysql 2> ${tmpDir}/post-mysql-install.log | grep -i columnstore
#
# Add compressiontype column to SYSCOLUMN if applicable
#
if [ $? -ne 0 ]; then
echo "columnstore doesn't exist"
exit 1
fi
echo "columnstore exist"
return 0;
}
rpmmode=install
user=`whoami 2>/dev/null`
@ -174,36 +204,40 @@ mkdir $lockdir >/dev/null 2>&1
rm -f $lockdir/columnstore
#check and get amazon env variables
aws=`which aws 2>/dev/null`
if [ -z "aws" ]; then
MCSgetCredentials.sh >/dev/null 2>&1
# This was the last place of postConfigure. RIP
/usr/sbin/install_mcs_mysql.sh --tmpdir=$tmpDir
# Restart MDB to enable plugin
systemctl cat mariadb.service > /dev/null 2>&1
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
systemctl restart mariadb.service > /dev/null 2>&1
else
pkill mysqld > /dev/null 2>&1
/usr/bin/mysqld_safe &
fi
postConfigure
checkForError
if [ $? -ne 0 ]; then
echo "ERROR: Invalid password in .my.cnf, or Columnstore plugin install missing"
fi
systemctl cat mariadb-columnstore.service > /dev/null 2>&1
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
systemctl start mariadb-columnstore
# Wait for all columnstore to be ready, DDLProc is final process in startup order
while [ -z "$(pgrep -x DDLProc)" ];
do
sleep 1
done
sleep 1
dbbuilder 7 > $tmpDir/dbbuilder.log 2>&1
fi
dbbuilder 7 > $tmpDir/dbbuilder.log
if [ $stop_mysqld -eq 1 ];then
# Make sure we stop mariadb since it wasn't running prior to columnstore installation
systemctl cat mariadb.service > /dev/null 2>&1
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
systemctl stop mariadb.service > /dev/null 2>&1
else
pkill mysqld
pkill mysqld > /dev/null 2>&1
fi
fi
sleep 2
exit 0

View File

@ -5,7 +5,7 @@
# pre-uninstall steps for columnstore install
running_systemd() {
if [ "$(ps --no-headers -o comm 1)" == "systemd" ]; then
if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then
echo 0
else
echo 1
@ -17,7 +17,7 @@ systemctl cat mariadb-columnstore.service > /dev/null 2>&1
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
systemctl stop mariadb-columnstore >/dev/null 2>&1
else
PROGS='StorageManager workernode controllernode PrimProc ExeMgr DMLProc DDLProc WriteEngineServer'
PROGS='PrimProc ExeMgr DMLProc DDLProc WriteEngineServer StorageManager controllernode workernode'
kill $(pidof $PROGS) > /dev/null
sleep 3
kill -9 $(pidof $PROGS) > /dev/null
@ -51,9 +51,6 @@ rm -rf /tmp/columnstore_tmp_files
lockdir=`mcsGetConfig Installation LockFileDirectory`
rm -f $lockdir/columnstore
# delete core files
#rm -f /var/log/mariadb/columnstore/corefiles/* > /dev/null 2>&1
#uninstall MariaDB Columnstore system logging
columnstoreSyslogSetup.sh uninstall >/dev/null 2>&1
@ -118,6 +115,9 @@ rm -f @ENGINE_SYSCONFDIR@/columnstore/AlarmConfig.xml.installSave
#remove OAMdbrootCheck file
rm -f /var/lib/columnstore/data*/OAMdbrootCheck > /dev/null 2>&1
rm -f /etc/rsyslog.d/49-columnstore.conf > /dev/null 2>&1
rm -rf /tmp/columnstore_tmp_files > /dev/null 2>&1
#tell user to run post configure script
echo " "
echo "Mariab Columnstore uninstall completed"

View File

@ -18,7 +18,7 @@
### END INIT INFO
running_systemd() {
if [ "$(ps --no-headers -o comm 1)" == "systemd" ]; then
if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then
echo 0
else
echo 1

View File

@ -0,0 +1,15 @@
#!/bin/bash
# This script allows to gracefully start MCS
/bin/systemctl start mcs-storagemanager
/bin/systemctl start mcs-loadbrm
/bin/systemctl start mcs-workernode
/bin/systemctl start mcs-controllernode
/bin/systemctl start mcs-primproc
/bin/systemctl start mcs-writeengineserver
/bin/systemctl start mcs-exemgr
/bin/systemctl start mcs-dmlproc
/bin/systemctl start mcs-ddlproc
exit 0

View File

@ -0,0 +1,14 @@
#!/bin/bash
# This script allows to gracefully shut down MCS
/bin/systemctl stop mcs-dmlproc
/bin/systemctl stop mcs-ddlproc
/bin/systemctl stop mcs-exemgr
/bin/systemctl stop mcs-writeengineserver
/bin/systemctl stop mcs-primproc
/bin/systemctl stop mcs-controllernode
/bin/systemctl stop mcs-workernode
/bin/systemctl stop mcs-storagemanager
exit 0

View File

@ -5,7 +5,8 @@ Description=mariadb-columnstore
Type=oneshot
# Execute a dummy program
ExecStart=/bin/true
ExecStart=@ENGINE_BINDIR@/mariadb-columnstore-start.sh
ExecStop=@ENGINE_BINDIR@/mariadb-columnstore-stop.sh
# This service shall be considered active after start
RemainAfterExit=yes

View File

@ -9,6 +9,3 @@ ExecStartPre=/usr/bin/env bash -c "systemctl start mcs-workernode"
ExecStart=@ENGINE_BINDIR@/controllernode
Restart=on-failure
ExecStop=@ENGINE_BINDIR@/mcs-stop-controllernode.sh $MAINPID
[Install]
WantedBy=mariadb-columnstore.service

View File

@ -8,6 +8,3 @@ Type=simple
ExecStart=@ENGINE_BINDIR@/DDLProc
Restart=on-failure
TimeoutStopSec=2
[Install]
WantedBy=mariadb-columnstore.service

View File

@ -8,6 +8,3 @@ Type=simple
ExecStart=@ENGINE_BINDIR@/DMLProc
Restart=on-failure
TimeoutStopSec=2
[Install]
WantedBy=mariadb-columnstore.service

View File

@ -8,6 +8,3 @@ Type=simple
ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/ExeMgr"
Restart=on-failure
TimeoutStopSec=2
[Install]
WantedBy=mariadb-columnstore.service

View File

@ -8,5 +8,4 @@ Type=simple
ExecStart=@ENGINE_BINDIR@/mcs-loadbrm.py
[Install]
WantedBy=mariadb-columnstore.service
WantedBy=mcs-workernode.service

View File

@ -10,6 +10,3 @@ ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc
ExecStartPost=/bin/sleep 2
Restart=on-failure
TimeoutStopSec=2
[Install]
WantedBy=mariadb-columnstore.service

View File

@ -1,7 +1,6 @@
#!/bin/bash
/bin/kill -15 "$1"
systemctl stop mcs-workernode --ignore-dependencies
timeout=$(mcsGetConfig SystemConfig DBRMTimeout)
while [ -n "$(pgrep -x controllernode)" ] && [ $timeout -gt 0 ]

View File

@ -10,7 +10,7 @@ ConditionPathExists=/etc/columnstore/storagemanager.cnf
Type=simple
ExecStartPre=@ENGINE_BINDIR@/mcs-start-storagemanager.py
ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/StorageManager"
ExecStop=/usr/bin/env bash -c "kill -15 $MAINPID"
[Install]
WantedBy=mariadb-columnstore.service
WantedBy=mcs-workernode.service

View File

@ -1,15 +1,12 @@
[Unit]
Description=mcs-workernode
PartOf=mariadb-columnstore.service
After=mcs-loadbrm.service
[Service]
Type=forking
ExecStart=@ENGINE_BINDIR@/workernode DBRM_Worker1
Restart=on-failure
ExecStop=-@ENGINE_BINDIR@/save_brm
ExecStop=/usr/bin/env bash -c "kill -15 $MAINPID"
ExecStopPost=-@ENGINE_BINDIR@/save_brm
ExecStopPost=/usr/bin/env bash -c "clearShm > /dev/null 2>&1"
TimeoutStopSec=2
[Install]
WantedBy=mariadb-columnstore.service
TimeoutStopSec=5

View File

@ -7,7 +7,4 @@ After=mcs-exemgr.service
Type=simple
ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/WriteEngineServer"
Restart=on-failure
TimeoutStopSec=2
[Install]
WantedBy=mariadb-columnstore.service
TimeoutStopSec=20