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

Change the way MCS runs SQL installing the plugin.

Clean MDB objects up uninstalling the plugin.
This commit is contained in:
Roman Nozdrin
2020-06-18 13:34:51 +00:00
parent 0cd56e7d01
commit d7bfef41bb
3 changed files with 42 additions and 15 deletions

View File

@ -10,8 +10,14 @@ for arg in "$@"; do
fi fi
done done
if [[ -f /etc/mysql/debian.cnf ]]; then
MDB="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
else
MDB="/usr/bin/mysql"
fi
# DELETE libcalmysql.so entries first as they are in ha_columnstore.so in 1.4.2 onwards # DELETE libcalmysql.so entries first as they are in ha_columnstore.so in 1.4.2 onwards
su -s /bin/sh -c 'mysql' mysql 2> ${tmpdir}/mysql_install.log <<EOD $MDB 2> ${tmpdir}/mysql_install.log <<EOD
DELETE FROM mysql.func WHERE dl='libcalmysql.so'; DELETE FROM mysql.func WHERE dl='libcalmysql.so';
INSERT INTO mysql.func VALUES ('calgetstats',0,'ha_columnstore.so','function'); INSERT INTO mysql.func VALUES ('calgetstats',0,'ha_columnstore.so','function');
INSERT INTO mysql.func VALUES ('calsettrace',2,'ha_columnstore.so','function'); INSERT INTO mysql.func VALUES ('calsettrace',2,'ha_columnstore.so','function');
@ -104,10 +110,10 @@ CREATE TABLE IF NOT EXISTS infinidb_querystats.priority
insert ignore into infinidb_querystats.priority values ('High', 100),('Medium', 66), ('Low', 33); insert ignore into infinidb_querystats.priority values ('High', 100),('Medium', 66), ('Low', 33);
EOD EOD
su -s /bin/sh -c 'mysql <@ENGINE_SUPPORTDIR@/syscatalog_mysql.sql' mysql 2>/dev/null $MDB <@ENGINE_SUPPORTDIR@/syscatalog_mysql.sql 2>/dev/null
su -s /bin/sh -c 'mysql <@ENGINE_SUPPORTDIR@/calsetuserpriority.sql' mysql 2>/dev/null $MDB <@ENGINE_SUPPORTDIR@/calsetuserpriority.sql 2>/dev/null
su -s /bin/sh -c 'mysql <@ENGINE_SUPPORTDIR@/calremoveuserpriority.sql' mysql 2>/dev/null $MDB <@ENGINE_SUPPORTDIR@/calremoveuserpriority.sql 2>/dev/null
su -s /bin/sh -c 'mysql <@ENGINE_SUPPORTDIR@/calshowprocesslist.sql' mysql 2>/dev/null $MDB <@ENGINE_SUPPORTDIR@/calshowprocesslist.sql 2>/dev/null
su -s /bin/sh -c 'mysql <@ENGINE_SUPPORTDIR@/columnstore_info.sql' mysql 2>/dev/null $MDB <@ENGINE_SUPPORTDIR@/columnstore_info.sql 2>/dev/null

View File

@ -24,13 +24,21 @@ find_env_var() {
echo $ENV_VAR echo $ENV_VAR
} }
if [[ -f /etc/mysql/debian.cnf ]]; then
MDB="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
else
MDB="/usr/bin/mysql"
fi
checkForError() { checkForError() {
# check for password error # check for password error
grep "ERROR 1045" ${tmpDir}/mysql_install.log > ${tmpDir}/error.check grep "ERROR 1045" ${tmpDir}/mysql_install.log > ${tmpDir}/error.check
if [ `cat ${tmpDir}/error.check | wc -c` -ne 0 ]; then if [ `cat ${tmpDir}/error.check | wc -c` -ne 0 ]; then
echo "MySQL Password file missing or incorrect, check .my.cnf file" echo "There were authentication issues running install_mcs_mysql.sh \
script. The log is available in ${tmpDir}/mysql_install.log. Please re-run \
columnstore-post-install manually after solving the authentication issues."
rm -f ${tmpDir}/error.check rm -f ${tmpDir}/error.check
exit 2; return 2;
fi fi
rm -f ${tmpDir}/error.check rm -f ${tmpDir}/error.check
@ -39,14 +47,14 @@ checkForError() {
# See if engine columnstore exist # See if engine columnstore exist
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
echo "checking for engine columnstore..." echo "checking for engine columnstore..."
su -s /bin/sh -c 'mysql --execute="show engines"' mysql 2> ${tmpDir}/post-mysql-install.log | grep -i columnstore $MDB --execute="show engines" 2> ${tmpDir}/post-mysql-install.log | grep -i columnstore >> ${tmpDir}/post-mysql-install.log &2>1
# #
# Add compressiontype column to SYSCOLUMN if applicable # Add compressiontype column to SYSCOLUMN if applicable
# #
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "columnstore doesn't exist" echo "columnstore doesn't exist"
exit 1 return 1
fi fi
echo "columnstore exist" echo "columnstore exist"
@ -235,11 +243,9 @@ fi
checkForError checkForError
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "ERROR: Invalid password in .my.cnf, or Columnstore plugin install missing" echo "There was an error installing MariaDB ColumnStore engine plugin. \
fi Continue to install the engine though. \
Please resolve the issues and run necessary scripts manually."
if [ $? -ne 0 ]; then
echo "ERROR: Invalid password in .my.cnf, or Columnstore plugin install missing"
fi fi
if [ -z "$MCS_USE_S3_STORAGE" ]; then if [ -z "$MCS_USE_S3_STORAGE" ]; then
@ -283,6 +289,7 @@ fi
systemctl cat mariadb-columnstore.service > /dev/null 2>&1 systemctl cat mariadb-columnstore.service > /dev/null 2>&1
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
echo "Populating the engine initial system catalog."
systemctl start mariadb-columnstore systemctl start mariadb-columnstore
sleep 1 sleep 1
dbbuilder 7 > $tmpDir/dbbuilder.log 2>&1 dbbuilder 7 > $tmpDir/dbbuilder.log 2>&1

View File

@ -12,6 +12,20 @@ running_systemd() {
fi fi
} }
if [[ -f /etc/mysql/debian.cnf ]]; then
MDB="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
else
MDB="/usr/bin/mysql"
fi
$MDB -e 'DROP DATABASE IF EXISTS infinidb_querystats;' 2>/dev/null
$MDB -e 'DELETE FROM mysql.func WHERE dl="libcalmysql.so"' 2>/dev/null
$MDB -e 'DROP DATABASE IF EXISTS calpontsys;' 2>/dev/null
$MDB -e 'DROP PROCEDURE IF EXISTS infinidb_querystats.calSetUserPriority;' 2>/dev/null
$MDB -e "DROP PROCEDURE IF EXISTS infinidb_querystats.calRemoveUserPriority(IN host VARCHAR(50), IN usr VARCHAR(50))" 2>/dev/null
$MDB -e "DROP PROCEDURE IF EXISTS infinidb_querystats.calShowProcessList;"2>/dev/null
$MDB -e "DROP DATABASE IF EXISTS columnstore_info;" 2>/dev/null
# Test we are using systemd # Test we are using systemd
systemctl cat mariadb-columnstore.service > /dev/null 2>&1 systemctl cat mariadb-columnstore.service > /dev/null 2>&1
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then