From 2915f83a46e0e087ce40ad73939a361999ea279e Mon Sep 17 00:00:00 2001 From: Roman Nozdrin Date: Thu, 4 Jun 2020 14:46:14 +0000 Subject: [PATCH] MCOL-3914 Replaced umbrella systemd service with a shell that starts/stops separate MCS systemd units. Add stop for StorageManager systemd unit. --- .gitignore | 1 + oam/install_scripts/CMakeLists.txt | 2 ++ oam/install_scripts/columnstore-post-install.in | 11 +---------- oam/install_scripts/columnstore-pre-uninstall.in | 7 ++----- oam/install_scripts/columnstore.in | 2 +- oam/install_scripts/mariadb-columnstore-start.sh | 15 +++++++++++++++ oam/install_scripts/mariadb-columnstore-stop.sh | 14 ++++++++++++++ .../mariadb-columnstore.service.in | 5 +++-- oam/install_scripts/mcs-controllernode.service.in | 3 --- oam/install_scripts/mcs-ddlproc.service.in | 3 --- oam/install_scripts/mcs-dmlproc.service.in | 3 --- oam/install_scripts/mcs-exemgr.service.in | 3 --- oam/install_scripts/mcs-loadbrm.service.in | 1 - oam/install_scripts/mcs-primproc.service.in | 3 --- oam/install_scripts/mcs-stop-controllernode.sh.in | 1 - oam/install_scripts/mcs-storagemanager.service.in | 2 +- oam/install_scripts/mcs-workernode.service.in | 9 +++------ .../mcs-writeengineserver.service.in | 5 +---- 18 files changed, 44 insertions(+), 46 deletions(-) create mode 100644 oam/install_scripts/mariadb-columnstore-start.sh create mode 100644 oam/install_scripts/mariadb-columnstore-stop.sh diff --git a/.gitignore b/.gitignore index 05ad703b0..2da248da3 100644 --- a/.gitignore +++ b/.gitignore @@ -145,6 +145,7 @@ oam/install_scripts/mcs-primproc.service oam/install_scripts/mcs-stop-controllernode.sh oam/install_scripts/mcs-workernode.service oam/install_scripts/mcs-writeengineserver.service +oam/install_scripts/mcs-storagemanager.service oam/install_scripts/mcs_module_installer.sh oam/install_scripts/slave-rep-columnstore.sh oam/install_scripts/startupTests.sh diff --git a/oam/install_scripts/CMakeLists.txt b/oam/install_scripts/CMakeLists.txt index 3e6b7762a..cffcdbc8b 100644 --- a/oam/install_scripts/CMakeLists.txt +++ b/oam/install_scripts/CMakeLists.txt @@ -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 diff --git a/oam/install_scripts/columnstore-post-install.in b/oam/install_scripts/columnstore-post-install.in index bad8b7a63..fd872a297 100755 --- a/oam/install_scripts/columnstore-post-install.in +++ b/oam/install_scripts/columnstore-post-install.in @@ -224,16 +224,7 @@ fi systemctl cat mariadb-columnstore.service > /dev/null 2>&1 if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then - systemctl start mcs-loadbrm - systemctl start mcs-workernode - systemctl start mcs-controllernode - systemctl start mcs-primproc - systemctl start mcs-exemgr - systemctl start mcs-storagemanager - systemctl start mcs-writeengineserver - systemctl start mcs-ddlproc - systemctl start mcs-dmlproc - + systemctl start mariadb-columnstore dbbuilder 7 > $tmpDir/dbbuilder.log fi diff --git a/oam/install_scripts/columnstore-pre-uninstall.in b/oam/install_scripts/columnstore-pre-uninstall.in index fbabbdb75..5b6e840b2 100755 --- a/oam/install_scripts/columnstore-pre-uninstall.in +++ b/oam/install_scripts/columnstore-pre-uninstall.in @@ -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='workernode controllernode PrimProc ExeMgr DMLProc DDLProc WriteEngineServer StorageManager' + 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 diff --git a/oam/install_scripts/columnstore.in b/oam/install_scripts/columnstore.in index c9f612af4..cc97bd663 100644 --- a/oam/install_scripts/columnstore.in +++ b/oam/install_scripts/columnstore.in @@ -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 diff --git a/oam/install_scripts/mariadb-columnstore-start.sh b/oam/install_scripts/mariadb-columnstore-start.sh new file mode 100644 index 000000000..b889600a6 --- /dev/null +++ b/oam/install_scripts/mariadb-columnstore-start.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# This script allows to gracefully start MCS + +/bin/systemctl start mcs-loadbrm +/bin/systemctl start mcs-workernode +/bin/systemctl start mcs-controllernode +/bin/systemctl start mcs-exemgr +/bin/systemctl start mcs-storagemanager +/bin/systemctl start mcs-writeengineserver +/bin/systemctl start mcs-primproc +/bin/systemctl start mcs-dmlproc +/bin/systemctl start mcs-ddlproc + +exit 0 diff --git a/oam/install_scripts/mariadb-columnstore-stop.sh b/oam/install_scripts/mariadb-columnstore-stop.sh new file mode 100644 index 000000000..4a5fe79bb --- /dev/null +++ b/oam/install_scripts/mariadb-columnstore-stop.sh @@ -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-primproc +/bin/systemctl stop mcs-writeengineserver +/bin/systemctl stop mcs-storagemanager +/bin/systemctl stop mcs-exemgr +/bin/systemctl stop mcs-controllernode +/bin/systemctl stop mcs-workernode + +exit 0 diff --git a/oam/install_scripts/mariadb-columnstore.service.in b/oam/install_scripts/mariadb-columnstore.service.in index 9eb786ace..4f78490b8 100644 --- a/oam/install_scripts/mariadb-columnstore.service.in +++ b/oam/install_scripts/mariadb-columnstore.service.in @@ -2,10 +2,11 @@ Description=mariadb-columnstore [Service] -Type=oneshot +Type=simple # 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 diff --git a/oam/install_scripts/mcs-controllernode.service.in b/oam/install_scripts/mcs-controllernode.service.in index 1ac114c68..6a8e40c5b 100644 --- a/oam/install_scripts/mcs-controllernode.service.in +++ b/oam/install_scripts/mcs-controllernode.service.in @@ -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 diff --git a/oam/install_scripts/mcs-ddlproc.service.in b/oam/install_scripts/mcs-ddlproc.service.in index c40703792..c839b4c9a 100644 --- a/oam/install_scripts/mcs-ddlproc.service.in +++ b/oam/install_scripts/mcs-ddlproc.service.in @@ -8,6 +8,3 @@ Type=simple ExecStart=@ENGINE_BINDIR@/DDLProc Restart=on-failure TimeoutStopSec=2 - -[Install] -WantedBy=mariadb-columnstore.service diff --git a/oam/install_scripts/mcs-dmlproc.service.in b/oam/install_scripts/mcs-dmlproc.service.in index 576fdce42..b0bb8ea96 100644 --- a/oam/install_scripts/mcs-dmlproc.service.in +++ b/oam/install_scripts/mcs-dmlproc.service.in @@ -8,6 +8,3 @@ Type=simple ExecStart=@ENGINE_BINDIR@/DMLProc Restart=on-failure TimeoutStopSec=2 - -[Install] -WantedBy=mariadb-columnstore.service diff --git a/oam/install_scripts/mcs-exemgr.service.in b/oam/install_scripts/mcs-exemgr.service.in index 439d3a6a0..8deab367a 100644 --- a/oam/install_scripts/mcs-exemgr.service.in +++ b/oam/install_scripts/mcs-exemgr.service.in @@ -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 diff --git a/oam/install_scripts/mcs-loadbrm.service.in b/oam/install_scripts/mcs-loadbrm.service.in index 620cedb9e..1684b85d1 100644 --- a/oam/install_scripts/mcs-loadbrm.service.in +++ b/oam/install_scripts/mcs-loadbrm.service.in @@ -8,5 +8,4 @@ Type=simple ExecStart=@ENGINE_BINDIR@/mcs-loadbrm.py [Install] -WantedBy=mariadb-columnstore.service WantedBy=mcs-workernode.service diff --git a/oam/install_scripts/mcs-primproc.service.in b/oam/install_scripts/mcs-primproc.service.in index bb5b843c8..16fd5552e 100644 --- a/oam/install_scripts/mcs-primproc.service.in +++ b/oam/install_scripts/mcs-primproc.service.in @@ -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 diff --git a/oam/install_scripts/mcs-stop-controllernode.sh.in b/oam/install_scripts/mcs-stop-controllernode.sh.in index a6de85db2..f1f258598 100644 --- a/oam/install_scripts/mcs-stop-controllernode.sh.in +++ b/oam/install_scripts/mcs-stop-controllernode.sh.in @@ -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 ] diff --git a/oam/install_scripts/mcs-storagemanager.service.in b/oam/install_scripts/mcs-storagemanager.service.in index 297d89687..358f69446 100644 --- a/oam/install_scripts/mcs-storagemanager.service.in +++ b/oam/install_scripts/mcs-storagemanager.service.in @@ -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 diff --git a/oam/install_scripts/mcs-workernode.service.in b/oam/install_scripts/mcs-workernode.service.in index 65862a360..ec6340429 100644 --- a/oam/install_scripts/mcs-workernode.service.in +++ b/oam/install_scripts/mcs-workernode.service.in @@ -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 diff --git a/oam/install_scripts/mcs-writeengineserver.service.in b/oam/install_scripts/mcs-writeengineserver.service.in index 3764c80ab..1947d1884 100644 --- a/oam/install_scripts/mcs-writeengineserver.service.in +++ b/oam/install_scripts/mcs-writeengineserver.service.in @@ -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