1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00
This commit is contained in:
David Hill
2018-09-19 14:01:08 -05:00
parent 9e64034347
commit 45b20b4a9a
6 changed files with 1145 additions and 659 deletions

View File

@ -63,10 +63,18 @@ if [ $cloud = "amazon-ec2" ] || [ $cloud = "amazon-vpc" ]; then
if [ $module = "pm" ]; then if [ $module = "pm" ]; then
if test -f $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab ; then if test -f $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab ; then
echo "Setup fstab on Module" echo "Setup fstab on Module"
touch /etc/fstab if [ $user = "root" ]; then
rm -f /etc/fstab.columnstoreSave touch /etc/fstab
cp /etc/fstab /etc/fstab.columnstoreSave rm -f /etc/fstab.columnstoreSave
cat $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab >> /etc/fstab cp /etc/fstab /etc/fstab.columnstoreSave
cat $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab >> /etc/fstab
else
sudo touch /etc/fstab
sudo chmod 666 /etc/fstab
sudo rm -f /etc/fstab.columnstoreSave
sudo cp /etc/fstab /etc/fstab.columnstoreSave
sudo cat $COLUMNSTORE_INSTALL_DIR/local/etc/pm1/fstab >> /etc/fstab
fi
fi fi
fi fi
fi fi
@ -85,8 +93,13 @@ if [ $module = "um" ]; then
echo "Setup UM Volume Mount" echo "Setup UM Volume Mount"
device=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation UMVolumeDeviceName$mid` device=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation UMVolumeDeviceName$mid`
mkdir -p $COLUMNSTORE_INSTALL_DIR/mysql/db > /dev/null 2>&1 mkdir -p $COLUMNSTORE_INSTALL_DIR/mysql/db > /dev/null 2>&1
mount $device $COLUMNSTORE_INSTALL_DIR/mysql/db -t ext2 -o noatime,nodiratime,noauto if [ $user = "root" ]; then
chown mysql:mysql -R $COLUMNSTORE_INSTALL_DIR/mysql > /dev/null 2>&1 mount $device $COLUMNSTORE_INSTALL_DIR/mysql/db -t ext2 -o noatime,nodiratime,noauto
chown mysql:mysql -R $COLUMNSTORE_INSTALL_DIR/mysql > /dev/null 2>&1
else
sudo mount $device $COLUMNSTORE_INSTALL_DIR/mysql/db -t ext2 -o noatime,nodiratime,noauto,user
sudo chown $user:$user -R $COLUMNSTORE_INSTALL_DIR/mysql > /dev/null 2>&1
fi
fi fi
fi fi
fi fi
@ -148,18 +161,16 @@ if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $Ser
fi fi
fi fi
if [ $user == "root" ]; then $COLUMNSTORE_INSTALL_DIR/bin/syslogSetup.sh check > /tmp/syslogSetup-check.log 2>&1
$COLUMNSTORE_INSTALL_DIR/bin/syslogSetup.sh check > /tmp/syslogSetup-check.log 2>&1 if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then # try setup again
# try setup again $COLUMNSTORE_INSTALL_DIR/bin/syslogSetup.sh install > /tmp/syslogSetup-install.log 2>&1
$COLUMNSTORE_INSTALL_DIR/bin/syslogSetup.sh install > /tmp/syslogSetup-install.log 2>&1 if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then echo "WARNING: syslogSetup.sh check failed: check /tmp/syslogSetup-check.log"
echo "WARNING: syslogSetup.sh check failed: check /tmp/syslogSetup-check.log" exit 2
exit 2 fi
fi
fi
fi fi
#setup rc.local #setup rc.local
if [ -f /etc/rc.d ]; then if [ -f /etc/rc.d ]; then
RCFILE=/etc/rc.d/rc.local RCFILE=/etc/rc.d/rc.local
@ -168,9 +179,40 @@ else
fi fi
touch $RCFILE touch $RCFILE
echo "add deadline to rc.local"
if [ $module = "um" ]; then
if [ $user = "root" ]; then
echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
echo "done" >> $RCFILE
else
sudo echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
sudo echo "done" >> $RCFILE
fi
else
if [ $user = "root" ]; then
echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
echo "done" >> $RCFILE
echo "for scsi_dev in \`mount | awk '/columnstore\\/data/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
echo "done" >> $RCFILE
else
sudo echo "for scsi_dev in \`mount | awk '/mnt\\/tmp/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
sudo echo "done" >> $RCFILE
sudo echo "for scsi_dev in \`mount | awk '/columnstore\\/data/ {print $1}' | awk -F/ '{print $3}' | sed 's/[0-9]*$//'\`; do" >> $RCFILE
sudo echo "echo deadline > /sys/block/$scsi_dev/queue/scheduler" >> $RCFILE
sudo echo "done" >> $RCFILE
fi
fi
if [ $user != "root" ]; then if [ $user != "root" ]; then
echo "uncomment runuser in rc.local" echo "uncomment runuser in rc.local"
sed -i -e 's/#MCS//g' /etc/rc.d/rc.local >/dev/null 2>&1 sudo sed -i -e 's/#sudo runuser/sudo runuser/g' $RCFILE >/dev/null 2>&1
fi fi
echo "!!!Module Installation Successfully Completed!!!" echo "!!!Module Installation Successfully Completed!!!"

View File

@ -8,6 +8,10 @@ prefix=/usr/local
installdir=$prefix/mariadb/columnstore installdir=$prefix/mariadb/columnstore
rpmmode=install rpmmode=install
user=`whoami 2>/dev/null` user=`whoami 2>/dev/null`
SUDO=" "
if [ $user != "root" ]; then
SUDO="sudo "
fi
quiet=0 quiet=0
@ -89,53 +93,53 @@ if [ -f libstdc++.so.6.0.14 ]; then
fi fi
# softlink for libperl.sp, used by cplogger # softlink for libperl.sp, used by cplogger
ln -s /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so >/dev/null 2>&1 $SUDO ln -s /usr/lib64/perl5/CORE/libperl.so /usr/lib64/libperl.so >/dev/null 2>&1
#setup profile files
profileFileAlias=/etc/profile.d/columnstoreAlias.sh
profileFileEnv=/etc/profile.d/columnstoreEnv.sh
if [ $installdir != "/usr/local/mariadb/columnstore" ]; then if [ $installdir != "/usr/local/mariadb/columnstore" ]; then
sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstoreAlias sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstoreAlias
fi fi
if [ $user != "root" ]; then if [ $user != "root" ]; then
profileFile=$prefix/.bash_profile sudo rm -f $profileFileEnv
sudo rm -f $profileFileAlias
if [ ! -f ${profileFile}_backup ]; then
cp $profileFile ${profileFile}_backup sudo touch $profileFileEnv
fi sudo chmod 666 $profileFileEnv
egrep -qs 'MariaDB Columnstore Non-Root' ${profileFileEnv}
egrep -qs 'MariaDB Columnstore Non-Root Environment Variables' ${profileFile}
rc1=$? rc1=$?
if [ $rc1 -ne 0 ]; then if [ $rc1 -ne 0 ]; then
echo " " >> ${profileFile} sudo echo " " >> ${profileFileEnv}
echo "# MariaDB Columnstore Non-Root Environment Variables" >> ${profileFile} sudo echo "# MariaDB Columnstore Non-Root Environment Variables" >> ${profileFileEnv}
echo "export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR" >> ${profileFile} sudo echo "export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR" >> ${profileFileEnv}
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib" >> ${profileFile} sudo echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COLUMNSTORE_INSTALL_DIR/lib:$COLUMNSTORE_INSTALL_DIR/mysql/lib" >> ${profileFileEnv}
. ${profileFileEnv}
fi fi
egrep -qs 'MariaDB Columnstore Non-Root Alias Variables' ${profileFile} sudo /bin/cp -f $installdir/bin/columnstoreAlias $profileFileAlias
rc1=$? sudo chmod 666 $profileFileAlias
if [ $rc1 -ne 0 ]; then
echo " " >> ${profileFile}
echo "# MariaDB Columnstore Non-Root Alias Variables" >> ${profileFile}
cat $installdir/bin/columnstoreAlias >> ${profileFile}
fi
#source the file
. ${profileFile}
else else
/bin/cp -f $installdir/bin/columnstoreAlias /etc/profile.d/columnstoreAlias.sh /bin/cp -f $installdir/bin/columnstoreAlias $profileFileAlias
chmod 644 /etc/profile.d/columnstoreAlias.sh >/dev/null 2>&1 chmod 644 $profileFileAlias
fi fi
cd / cd /
test -d /var/log/mariadb || mkdir /var/log/mariadb >/dev/null 2>&1 test -d /var/log/mariadb || $SUDO mkdir /var/log/mariadb >/dev/null 2>&1
test -d /var/log/mariadb/columnstore || mkdir /var/log/mariadb/columnstore >/dev/null 2>&1 test -d /var/log/mariadb/columnstore || $SUDO mkdir /var/log/mariadb/columnstore >/dev/null 2>&1
if [ $user != "root" ]; then
$SUDO chmod -R 777 /var/log/mariadb >/dev/null 2>&1
$SUDO chown -R $user:$user /var/log/mariadb >/dev/null 2>&1
fi
test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1 test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1
test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1 test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1
test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1 test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1
test -h /var/log/mariadb/columnstore/data && rm -f /var/log/mariadb/columnstore/data test -h /var/log/mariadb/columnstore/data && rm -f /var/log/mariadb/columnstore/data
chmod 755 /var/log/mariadb/columnstore/corefiles > /dev/null 2>&1
# make sure trace dir is world-writable and sticky # make sure trace dir is world-writable and sticky
test -d $installdir/data || mkdir $installdir/data test -d $installdir/data || mkdir $installdir/data
test -d $installdir/data1 || mkdir $installdir/data1 test -d $installdir/data1 || mkdir $installdir/data1
@ -158,8 +162,13 @@ rm -f $installdir/data/bulk/tmpjob/* >/dev/null 2>&1
#create columnstore temp file directory #create columnstore temp file directory
mkdir -p /tmp/columnstore_tmp_files >/dev/null 2>&1 mkdir -p /tmp/columnstore_tmp_files >/dev/null 2>&1
#setup core file directory and link
mkdir /var/log/mariadb/columnstore/corefiles > /dev/null 2>&1
chmod 777 /var/log/mariadb/columnstore/corefiles > /dev/null 2>&1
#create mount directories #create mount directories
mkdir /mnt/tmp > /dev/null 2>&1 mkdir /mnt/tmp > /dev/null 2>&1
mkdir /var/log/mariadb/columnstore/data/archive > /dev/null 2>&1
# remove mysql archive log # remove mysql archive log
test -d $installdir/mysql/db || mkdir -p $installdir/mysql/db test -d $installdir/mysql/db || mkdir -p $installdir/mysql/db
@ -168,6 +177,7 @@ rm -rf $installdir/mysql/db/columnstore_log_archive > /dev/null 2>&1
# delete Columnstore shared memory segments # delete Columnstore shared memory segments
$installdir/bin/clearShm > /dev/null 2>&1 $installdir/bin/clearShm > /dev/null 2>&1
systemctl=`which systemctl 2>/dev/null`
#check and create rc.local file if missing #check and create rc.local file if missing
if [ -f /etc/rc.d ]; then if [ -f /etc/rc.d ]; then
@ -180,16 +190,22 @@ if [ $user = "root" ]; then
touch $RCFILE touch $RCFILE
chmod +x $RCFILE chmod +x $RCFILE
else else
printf '%s\n' '#!/bin/bash' "#" | tee -a $RCFILE > /dev/null 2>&1 $SUDO touch $RCFILE
$SUDO chmod 777 $RCFILE
$SUDO printf '%s\n' '#!/bin/bash' "#" | $SUDO tee -a $RCFILE > /dev/null 2>&1
if [ -n "$systemctl" ]; then
$SUDO systemctl start rc-local >/dev/null 2>&1
$SUDO systemctl enable rc-local >/dev/null 2>&1
fi
fi fi
if [ $user = "root" ]; then
#setup the columnstore service script
rm -f /etc/init.d/columnstore >/dev/null 2>&1
rm -f /etc/init.d/mysql-Columnstore >/dev/null 2>&1
rm -f /etc/default/columnstore
systemctl=`which systemctl 2>/dev/null` #setup the columnstore service script
rm -f /etc/init.d/columnstore >/dev/null 2>&1
rm -f /etc/init.d/mysql-Columnstore >/dev/null 2>&1
if [ $user = "root" ]; then
if [ -n "$systemctl" ]; then if [ -n "$systemctl" ]; then
chmod 644 $installdir/bin/columnstore.service chmod 644 $installdir/bin/columnstore.service
@ -219,46 +235,30 @@ fi
if [ $user = "root" ]; then if [ $user = "root" ]; then
$installdir/bin/syslogSetup.sh install > /tmp/syslog_install.log 2>&1 $installdir/bin/syslogSetup.sh install > /tmp/syslog_install.log 2>&1
rm -f /etc/default/columnstore
#check if MariaDB Columnstore system logging was setup
cat /tmp/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
if [ $? -eq 0 ]; then
cat /tmp/syslog_install.log
fi
else else
sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstore.def sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstore.def
sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstoreLogRotate sed -i -e s@/usr/local/mariadb/columnstore@$installdir@g $installdir/bin/columnstoreLogRotate
cp $installdir/bin/columnstore.def /etc/default/columnstore $SUDO cp $installdir/bin/columnstore.def /etc/default/columnstore
sed -i -e s@prefix=/home/guest@prefix=$prefix@g $installdir/bin/* sed -i -e s@prefix=/home/guest@prefix=$prefix@g $installdir/bin/*
chown $user:$user $installdir/etc/Columnstore.xml $SUDO chmod 777 /tmp
$installdir/bin/syslogSetup.sh --installdir=$installdir install > /tmp/syslog_install.log 2>&1
echo "" $SUDO chown $user:$user $installdir/etc/Columnstore.xml
echo "NOTE: For non-root install, you will need to run the following command as root user to" $SUDO mkdir /var/lock/subsys > /dev/null 2>&1
echo " setup the MariaDB ColumnStore System Logging" $SUDO chmod 777 /var/lock/subsys > /dev/null 2>&1
echo "" $SUDO rm -f /var/lock/subsys/mysql-Columnstore
echo " $installdir/bin/syslogSetup.sh --installdir=$installdir --user=$user install" $SUDO chmod 666 /etc/fstab
echo ""
fi fi
#determine lock file directory #check if MariaDB Columnstore system logging was setup
cat /tmp/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
# Lock directory for root user if [ $? -eq 0 ]; then
lockdir='/var/lock/subsys' cat /tmp/syslog_install.log
if [ $user != "root" ];then
# Lock directory for non-root user
lockdir=$prefix/.lock
fi fi
$installdir/bin/setConfig -d Installation LockFileDirectory $lockdir
mkdir $lockdir >/dev/null 2>&1
rm -f $lockdir/mysql-Columnstore
rm -f $lockdir/columnstore
#backup copy of Alarm Config File #backup copy of Alarm Config File
/bin/cp -f $installdir/etc/AlarmConfig.xml $installdir/etc/AlarmConfig.xml.installSave > /dev/null 2>&1 /bin/cp -f $installdir/etc/AlarmConfig.xml $installdir/etc/AlarmConfig.xml.installSave > /dev/null 2>&1
@ -275,7 +275,6 @@ if [ $user = "root" ]; then
else else
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib $installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****" LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib $installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****"
fi fi
#setup hadoop #setup hadoop
hadoop=`which hadoop 2>/dev/null` hadoop=`which hadoop 2>/dev/null`
if [ -z "$hadoop" ]; then if [ -z "$hadoop" ]; then

View File

@ -463,7 +463,7 @@ void ALARMManager::sendAlarmReport (const char* componentID, int alarmID, int st
int pid = getpid(); int pid = getpid();
int tid = gettid(); int tid = gettid();
// get reporting Pprocess Name // get reporting Process Name
string processName; string processName;
if ( repProcessName.empty()) if ( repProcessName.empty())
@ -505,8 +505,39 @@ void ALARMManager::sendAlarmReport (const char* componentID, int alarmID, int st
// shutdown connection // shutdown connection
procmgr.shutdown(); procmgr.shutdown();
} }
catch (std::runtime_error& e)
{
LoggingID lid(11);
MessageLog ml(lid);
Message msg;
Message::Args args;
args.add("sendAlarmReport error:");
args.add(e.what());
msg.format(args);
ml.logDebugMessage(msg);
}
catch (std::exception& e)
{
LoggingID lid(11);
MessageLog ml(lid);
Message msg;
Message::Args args;
args.add("sendAlarmReport error:");
args.add(e.what());
msg.format(args);
ml.logDebugMessage(msg);
}
catch (...) catch (...)
{} {
LoggingID lid(11);
MessageLog ml(lid);
Message msg;
Message::Args args;
args.add("sendAlarmReport error:");
args.add("general failure");
msg.format(args);
ml.logDebugMessage(msg);
}
return; return;
#endif //SKIP_ALARM #endif //SKIP_ALARM

File diff suppressed because it is too large Load Diff

View File

@ -338,11 +338,12 @@ int main(int argc, char** argv)
// check if standby never replied, if so, shutdown // check if standby never replied, if so, shutdown
if ( count >= 120 ) if ( count >= 120 )
{ {
log.writeLog(__LINE__, "Standby PM not responding, columnstore shutting down", LOG_TYPE_CRITICAL); log.writeLog(__LINE__, "Standby PM not responding, infinidb shutting down", LOG_TYPE_CRITICAL);
//Set the alarm, commented out. alarm require ProcMgr //Set the alarm
//aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET); // aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET);
sleep (1); // sleep (1);
string cmd = startup::StartUp::installDir() + "/bin/columnstore stop > /dev/null 2>&1";
string cmd = startup::StartUp::installDir() + "/bin/infinidb stop > /dev/null 2>&1";
system(cmd.c_str()); system(cmd.c_str());
} }
@ -369,8 +370,7 @@ int main(int argc, char** argv)
sysConfig->setConfig("ProcMgr_Alarm", "IPAddr", IPaddr); sysConfig->setConfig("ProcMgr_Alarm", "IPAddr", IPaddr);
log.writeLog(__LINE__, "set ProcMgr IPaddr to Old Standby Module: " + IPaddr, LOG_TYPE_DEBUG); log.writeLog(__LINE__, "set ProcMgr IPaddr to Old Standby Module: " + IPaddr, LOG_TYPE_DEBUG);
//update MariaDB ColumnStore Config table
//update Calpont Config table
try try
{ {
sysConfig->write(); sysConfig->write();
@ -437,7 +437,7 @@ int main(int argc, char** argv)
} }
catch (...) catch (...)
{ {
log.writeLog(__LINE__, "waiting for good return from getModuleStatus", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "wating for good return from getModuleStatus", LOG_TYPE_DEBUG);
sleep (1); sleep (1);
} }
} }
@ -553,9 +553,9 @@ int main(int argc, char** argv)
if ( retry == 20 ) if ( retry == 20 )
{ {
log.writeLog(__LINE__, "Check DB mounts failed, shutting down", LOG_TYPE_CRITICAL); log.writeLog(__LINE__, "Check DB mounts failed, shutting down", LOG_TYPE_CRITICAL);
//Set the alarm, commented out. alarm require ProcMgr //Set the alarm
//aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET); // aMonitor.sendAlarm(config.moduleName().c_str(), STARTUP_DIAGNOTICS_FAILURE, SET);
sleep (1); // sleep (1);
string cmd = startup::StartUp::installDir() + "/bin/columnstore stop > /dev/null 2>&1"; string cmd = startup::StartUp::installDir() + "/bin/columnstore stop > /dev/null 2>&1";
system(cmd.c_str()); system(cmd.c_str());
} }
@ -582,7 +582,7 @@ int main(int argc, char** argv)
while (!mainResumeFlag) while (!mainResumeFlag)
{ {
log.writeLog(__LINE__, "WAITING FOR mainResumeFlag to be set", LOG_TYPE_DEBUG); log.writeLog(__LINE__, "WATING FOR mainResumeFlag to be set", LOG_TYPE_DEBUG);
sleep(1); sleep(1);
} }
@ -774,11 +774,11 @@ int main(int argc, char** argv)
if ( ret != 0 ) if ( ret != 0 )
log.writeLog(__LINE__, "pthread_create failed, return code = " + oam.itoa(ret), LOG_TYPE_ERROR); log.writeLog(__LINE__, "pthread_create failed, return code = " + oam.itoa(ret), LOG_TYPE_ERROR);
//mysql status monitor thread //mysqld status monitor thread
if ( ( config.ServerInstallType() != oam::INSTALL_COMBINE_DM_UM_PM ) || if ( config.moduleType() == "um" ||
(PMwithUM == "y") ) ( config.moduleType() == "pm" && config.ServerInstallType() == oam::INSTALL_COMBINE_DM_UM_PM ) ||
( config.moduleType() == "pm" && PMwithUM == "y") )
{ {
pthread_t mysqlThread; pthread_t mysqlThread;
ret = pthread_create (&mysqlThread, NULL, (void* (*)(void*)) &mysqlMonitorThread, NULL); ret = pthread_create (&mysqlThread, NULL, (void* (*)(void*)) &mysqlMonitorThread, NULL);
@ -1131,6 +1131,9 @@ static void messageThread(MonitorConfig config)
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1"; string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
if ( !rootUser)
cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1";
system(cmd.c_str()); system(cmd.c_str());
for (;;) for (;;)
@ -1223,7 +1226,7 @@ static void mysqlMonitorThread(MonitorConfig config)
catch (...) catch (...)
{} {}
sleep(10); sleep(5);
} }
} }
@ -1460,7 +1463,7 @@ static void chldHandleThread(MonitorConfig config)
(*listPtr).processID != 0 ) || (*listPtr).processID != 0 ) ||
( (*listPtr).state == oam::ACTIVE && (*listPtr).processID == 0 ) ) ( (*listPtr).state == oam::ACTIVE && (*listPtr).processID == 0 ) )
{ {
log.writeLog(__LINE__, "*****Calpont Process Restarting: " + (*listPtr).ProcessName + ", old PID = " + oam.itoa((*listPtr).processID), LOG_TYPE_CRITICAL); log.writeLog(__LINE__, "*****MariaDB ColumnStore Process Restarting: " + (*listPtr).ProcessName + ", old PID = " + oam.itoa((*listPtr).processID), LOG_TYPE_CRITICAL);
if ( (*listPtr).dieCounter >= processRestartCount || if ( (*listPtr).dieCounter >= processRestartCount ||
processRestartCount == 0) processRestartCount == 0)
@ -1520,7 +1523,7 @@ static void chldHandleThread(MonitorConfig config)
{} {}
// check if process failover is needed due to process outage // check if process failover is needed due to process outage
aMonitor.checkProcessFailover((*listPtr).ProcessName); aMonitor.checkModuleFailover((*listPtr).ProcessName);
//check the db health //check the db health
if (DBFunctionalMonitorFlag == "y" ) if (DBFunctionalMonitorFlag == "y" )
@ -1602,7 +1605,7 @@ static void chldHandleThread(MonitorConfig config)
(*listPtr).processID = 0; (*listPtr).processID = 0;
// check if process failover is needed due to process outage // check if process failover is needed due to process outage
aMonitor.checkProcessFailover((*listPtr).ProcessName); aMonitor.checkModuleFailover((*listPtr).ProcessName);
break; break;
} }
else else
@ -1678,7 +1681,7 @@ static void chldHandleThread(MonitorConfig config)
} }
//Log this event //Log this event
log.writeLog(__LINE__, "Calpont Process " + (*listPtr).ProcessName + restartStatus, LOG_TYPE_INFO); log.writeLog(__LINE__, "MariaDB ColumnStore Process " + (*listPtr).ProcessName + restartStatus, LOG_TYPE_INFO);
} }
} }
} }
@ -2360,7 +2363,10 @@ static void statusControlThread()
string port = sysConfig->getConfig(portName, "Port"); string port = sysConfig->getConfig(portName, "Port");
string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1"; string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1";
system(cmd.c_str()); if ( !rootUser)
cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1";
system(cmd.c_str());
} }
catch (...) catch (...)
{ {
@ -2701,6 +2707,9 @@ void processStatusMSG(messageqcpp::IOSocket* cfIos)
memcpy(fShmSystemStatus[0].StateChangeDate, oam.getCurrentTime().c_str(), DATESIZE); memcpy(fShmSystemStatus[0].StateChangeDate, oam.getCurrentTime().c_str(), DATESIZE);
log.writeLog(__LINE__, "statusControl: REQUEST RECEIVED: Set System State = " + oamState[state], LOG_TYPE_DEBUG); log.writeLog(__LINE__, "statusControl: REQUEST RECEIVED: Set System State = " + oamState[state], LOG_TYPE_DEBUG);
} }
BRM::DBRM dbrm;
dbrm.setSystemQueryReady(true);
} }
} }
break; break;

View File

@ -484,7 +484,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
log.writeLog(__LINE__, "MSG RECEIVED: Stop process request on " + processName); log.writeLog(__LINE__, "MSG RECEIVED: Stop process request on " + processName);
int requestStatus = API_SUCCESS; int requestStatus = API_SUCCESS;
// check for mysql // check for mysqld
if ( processName == "mysqld" ) if ( processName == "mysqld" )
{ {
try try
@ -553,7 +553,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
msg >> manualFlag; msg >> manualFlag;
log.writeLog(__LINE__, "MSG RECEIVED: Start process request on: " + processName); log.writeLog(__LINE__, "MSG RECEIVED: Start process request on: " + processName);
// check for mysql // check for mysqld
if ( processName == "mysqld" ) if ( processName == "mysqld" )
{ {
try try
@ -684,7 +684,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
log.writeLog(__LINE__, "MSG RECEIVED: Restart process request on " + processName); log.writeLog(__LINE__, "MSG RECEIVED: Restart process request on " + processName);
int requestStatus = API_SUCCESS; int requestStatus = API_SUCCESS;
// check for mysql restart // check for mysqld restart
if ( processName == "mysqld" ) if ( processName == "mysqld" )
{ {
try try
@ -933,7 +933,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
log.writeLog(__LINE__, "Error running DBRM clearShm", LOG_TYPE_ERROR); log.writeLog(__LINE__, "Error running DBRM clearShm", LOG_TYPE_ERROR);
} }
//stop the mysql daemon //stop the mysqld daemon
try try
{ {
oam.actionMysqlCalpont(MYSQL_STOP); oam.actionMysqlCalpont(MYSQL_STOP);
@ -1063,21 +1063,14 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
int requestStatus = oam::API_SUCCESS; int requestStatus = oam::API_SUCCESS;
log.writeLog(__LINE__, "MSG RECEIVED: Start All process request..."); log.writeLog(__LINE__, "MSG RECEIVED: Start All process request...");
// change permissions on /dev/shm //start the mysqld daemon
string cmd = "chmod 755 /dev/shm >/dev/null 2>&1";
if ( !rootUser)
cmd = "chmod 777 /dev/shm >/dev/null 2>&1";
system(cmd.c_str());
//start the mysql daemon
try try
{ {
oam.actionMysqlCalpont(MYSQL_START); oam.actionMysqlCalpont(MYSQL_START);
} }
catch (...) catch (...)
{ {
// mysqld didn't start, return with error
// mysql didn't start, return with error // mysql didn't start, return with error
log.writeLog(__LINE__, "STARTALL: MySQL failed to start, start-module failure", LOG_TYPE_CRITICAL); log.writeLog(__LINE__, "STARTALL: MySQL failed to start, start-module failure", LOG_TYPE_CRITICAL);
@ -1268,7 +1261,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
// error in launching a process // error in launching a process
if ( requestStatus == oam::API_FAILURE && if ( requestStatus == oam::API_FAILURE &&
(*listPtr).RunType == SIMPLEX) (*listPtr).RunType == SIMPLEX)
checkProcessFailover((*listPtr).ProcessName); checkModuleFailover((*listPtr).ProcessName);
else else
break; break;
} }
@ -1366,7 +1359,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
//send down notification //send down notification
oam.sendDeviceNotification(config.moduleName(), MODULE_DOWN); oam.sendDeviceNotification(config.moduleName(), MODULE_DOWN);
//stop the mysql daemon and then columnstore //stop the mysqld daemon and then columnstore
try { try {
oam.actionMysqlCalpont(MYSQL_STOP); oam.actionMysqlCalpont(MYSQL_STOP);
} }
@ -1548,7 +1541,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
} }
} }
// install mysql rpms if being reconfigured as a um // install mysqld rpms if being reconfigured as a um
if ( reconfigureModuleName.find("um") != string::npos ) if ( reconfigureModuleName.find("um") != string::npos )
{ {
string cmd = startup::StartUp::installDir() + "/bin/post-mysqld-install >> /tmp/rpminstall"; string cmd = startup::StartUp::installDir() + "/bin/post-mysqld-install >> /tmp/rpminstall";
@ -1769,10 +1762,20 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
if (!oam.checkLogStatus("/tmp/umount.txt", "busy")) if (!oam.checkLogStatus("/tmp/umount.txt", "busy"))
break; break;
cmd = "lsof " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1"; if ( rootUser)
system(cmd.c_str()); {
cmd = "fuser -muvf " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1"; cmd = "lsof " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1";
system(cmd.c_str()); system(cmd.c_str());
cmd = "fuser -muvf " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1";
system(cmd.c_str());
}
else
{
cmd = "sudo lsof " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1";
system(cmd.c_str());
cmd = "sudo fuser -muvf " + startup::StartUp::installDir() + "/data" + dbrootID + " >> /tmp/umount.txt 2>&1";
system(cmd.c_str());
}
sleep(2); sleep(2);
//Flush the cache //Flush the cache
@ -1831,7 +1834,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
if ( !rootUser) if ( !rootUser)
{ {
cmd = "chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /dev/null"; cmd = "sudo chown -R " + USER + ":" + USER + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /dev/null";
system(cmd.c_str()); system(cmd.c_str());
} }
@ -1873,7 +1876,15 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
if (WEXITSTATUS(status) != 0 ) if (WEXITSTATUS(status) != 0 )
{ {
cmd = "echo " + entry + " >> /etc/fstab"; if ( rootUser)
{
cmd = "echo " + entry + " >> /etc/fstab";
}
else
{
cmd = "sudo echo " + entry + " >> /etc/fstab";
}
system(cmd.c_str()); system(cmd.c_str());
log.writeLog(__LINE__, "Add line entry to /etc/fstab : " + entry); log.writeLog(__LINE__, "Add line entry to /etc/fstab : " + entry);
@ -1885,7 +1896,14 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
if (WEXITSTATUS(status) != 0 ) if (WEXITSTATUS(status) != 0 )
{ {
cmd = "echo " + entry + " >> " + startup::StartUp::installDir() + "/local/etc/pm1/fstab"; if ( rootUser)
{
cmd = "echo " + entry + " >> " + startup::StartUp::installDir() + "/local/etc/pm1/fstab";
}
else
{
cmd = "sudo echo " + entry + " >> " + startup::StartUp::installDir() + "/local/etc/pm1/fstab";
}
system(cmd.c_str()); system(cmd.c_str());
@ -1897,7 +1915,14 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
string::size_type pos1 = entry.find(" ", pos + 1); string::size_type pos1 = entry.find(" ", pos + 1);
string directory = entry.substr(pos + 1, pos1 - pos); string directory = entry.substr(pos + 1, pos1 - pos);
cmd = "mkdir " + directory; if ( rootUser)
{
cmd = "mkdir " + directory;
}
else
{
cmd = "sudo mkdir " + directory;
}
system(cmd.c_str()); system(cmd.c_str());
log.writeLog(__LINE__, "create directory: " + directory); log.writeLog(__LINE__, "create directory: " + directory);
@ -3109,7 +3134,7 @@ int ProcessMonitor::updateLog(std::string action, std::string level)
//if non-root, change file permissions so we can update it //if non-root, change file permissions so we can update it
if ( !rootUser) if ( !rootUser)
{ {
string cmd = "chmod 666 " + fileName + " > /dev/null"; string cmd = "sudo chmod 666 " + fileName + " > /dev/null";
system(cmd.c_str()); system(cmd.c_str());
} }
@ -4938,20 +4963,19 @@ std::string ProcessMonitor::sendMsgProcMon1( std::string module, ByteStream msg,
} }
/****************************************************************************************** /******************************************************************************************
* @brief checkProcessFailover * @brief checkModuleFailover
* *
* purpose: check if process failover is needed due to a process outage * purpose: check if module failover is needed due to a process outage
* *
******************************************************************************************/ ******************************************************************************************/
void ProcessMonitor::checkProcessFailover( std::string processName) void ProcessMonitor::checkModuleFailover( std::string processName)
{ {
Oam oam; Oam oam;
//force failover on certain processes //force failover on certain processes
if ( processName == "DDLProc" || if ( processName == "DDLProc" ||
processName == "DMLProc" ) processName == "DMLProc" ) {
{ log.writeLog(__LINE__, "checkModuleFailover: process failover, process outage of " + processName, LOG_TYPE_CRITICAL);
log.writeLog(__LINE__, "checkProcessFailover: process failover, process outage of " + processName, LOG_TYPE_CRITICAL);
try try
{ {
@ -4974,27 +4998,36 @@ void ProcessMonitor::checkProcessFailover( std::string processName)
systemprocessstatus.processstatus[i].ProcessOpState == oam::FAILED ) systemprocessstatus.processstatus[i].ProcessOpState == oam::FAILED )
{ {
// found a AVAILABLE mate, start it // found a AVAILABLE mate, start it
log.writeLog(__LINE__, "start process on module " + systemprocessstatus.processstatus[i].Module, LOG_TYPE_DEBUG); log.writeLog(__LINE__, "Change UM Master to module " + systemprocessstatus.processstatus[i].Module, LOG_TYPE_DEBUG);
log.writeLog(__LINE__, "Disable local UM module " + config.moduleName(), LOG_TYPE_DEBUG);
log.writeLog(__LINE__, "Stop local UM module " + config.moduleName(), LOG_TYPE_DEBUG);
log.writeLog(__LINE__, "Disable Local will Enable UM module " + systemprocessstatus.processstatus[i].Module, LOG_TYPE_DEBUG);
oam::DeviceNetworkConfig devicenetworkconfig;
oam::DeviceNetworkList devicenetworklist;
devicenetworkconfig.DeviceName = config.moduleName();
devicenetworklist.push_back(devicenetworkconfig);
try try
{ {
oam.setSystemConfig("PrimaryUMModuleName", systemprocessstatus.processstatus[i].Module); oam.stopModule(devicenetworklist, oam::FORCEFUL, oam::ACK_YES);
log.writeLog(__LINE__, "success stopModule on module " + config.moduleName(), LOG_TYPE_DEBUG);
//distribute config file try
oam.distributeConfigFile("system"); {
sleep(1); oam.disableModule(devicenetworklist);
} log.writeLog(__LINE__, "success disableModule on module " + config.moduleName(), LOG_TYPE_DEBUG);
catch (...) {} }
catch (exception& e)
try {
{ log.writeLog(__LINE__, "failed disableModule on module " + config.moduleName(), LOG_TYPE_ERROR);
oam.startProcess(systemprocessstatus.processstatus[i].Module, processName, FORCEFUL, ACK_YES); }
log.writeLog(__LINE__, "success start process on module " + systemprocessstatus.processstatus[i].Module, LOG_TYPE_DEBUG);
}
catch (exception& e)
{
log.writeLog(__LINE__, "failed start process on module " + systemprocessstatus.processstatus[i].Module, LOG_TYPE_ERROR);
} }
catch (exception& e)
{
log.writeLog(__LINE__, "failed stopModule on module " + config.moduleName(), LOG_TYPE_ERROR);
}
break; break;
} }
@ -5011,9 +5044,6 @@ void ProcessMonitor::checkProcessFailover( std::string processName)
// log.writeLog(__LINE__, "EXCEPTION ERROR on getProcessStatus: Caught unknown exception!", LOG_TYPE_ERROR); // log.writeLog(__LINE__, "EXCEPTION ERROR on getProcessStatus: Caught unknown exception!", LOG_TYPE_ERROR);
} }
} }
return;
} }
/****************************************************************************************** /******************************************************************************************
@ -5194,10 +5224,16 @@ int ProcessMonitor::changeMyCnf(std::string type)
// set owner and permission // set owner and permission
string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1"; string cmd = "chmod 664 " + mycnfFile + " >/dev/null 2>&1";
if ( !rootUser)
cmd = "sudo chmod 644 " + mycnfFile + " >/dev/null 2>&1";
system(cmd.c_str()); system(cmd.c_str());
cmd = "chown mysql:mysql " + mycnfFile + " >/dev/null 2>&1"; cmd = "chown mysql:mysql " + mycnfFile + " >/dev/null 2>&1";
if ( !rootUser)
cmd = "sudo chown mysql:mysql " + mycnfFile + " >/dev/null 2>&1";
system(cmd.c_str()); system(cmd.c_str());
// restart mysql // restart mysql
@ -5951,7 +5987,10 @@ bool ProcessMonitor::amazonVolumeCheck(int dbrootID)
{ {
string cmd; string cmd;
cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /tmp/um_mount.log"; if ( rootUser)
cmd = "mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /tmp/um_mount.log";
else
cmd = "sudo mount " + deviceName + " " + startup::StartUp::installDir() + "/mysql/db -t ext2 -o defaults > /tmp/um_mount.log";
system(cmd.c_str()); system(cmd.c_str());
log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG); log.writeLog(__LINE__, "mount cmd: " + cmd, LOG_TYPE_DEBUG);
@ -6360,7 +6399,7 @@ int ProcessMonitor::checkDataMount()
if ( !rootUser) if ( !rootUser)
{ {
cmd = "chown -R " + USER + ":" + USER + " " + dbroot + " > /dev/null"; cmd = "sudo chown -R " + USER + ":" + USER + " " + dbroot + " > /dev/null";
system(cmd.c_str()); system(cmd.c_str());
} }
@ -6534,13 +6573,23 @@ int ProcessMonitor::glusterAssign(std::string dbrootID)
moduleIPAddr = sysConfig->getConfig("SystemModuleConfig", dataDupIPaddr); moduleIPAddr = sysConfig->getConfig("SystemModuleConfig", dataDupIPaddr);
} }
command = "mount -tglusterfs -odirect-io-mode=enable " + moduleIPAddr + ":/dbroot" + if ( rootUser)
{
command = "mount -tglusterfs -odirect-io-mode=enable " + moduleIPAddr + ":/dbroot" +
dbrootID + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterAssign.txt 2>&1"; dbrootID + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterAssign.txt 2>&1";
}
else
{
command = "sudo mount -tglusterfs -odirect-io-mode=enable " + moduleIPAddr + ":/dbroot" +
dbrootID + " " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterAssign.txt 2>&1";
}
int ret = system(command.c_str()); int ret = system(command.c_str());
if ( WEXITSTATUS(ret) != 0 ) if ( WEXITSTATUS(ret) != 0 )
{ {
log.writeLog(__LINE__, "glusterAssign mount failure: dbroot: " + dbrootID + " error: " + oam.itoa(WEXITSTATUS(ret)), LOG_TYPE_ERROR);
ifstream in("/tmp/glusterAssign.txt"); ifstream in("/tmp/glusterAssign.txt");
in.seekg(0, std::ios::end); in.seekg(0, std::ios::end);
int size = in.tellg(); int size = in.tellg();
@ -6575,12 +6624,21 @@ int ProcessMonitor::glusterUnassign(std::string dbrootID)
log.writeLog(__LINE__, "glusterUnassign called: " + dbrootID, LOG_TYPE_DEBUG); log.writeLog(__LINE__, "glusterUnassign called: " + dbrootID, LOG_TYPE_DEBUG);
command = "umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterUnassign.txt 2>&1"; if ( rootUser)
{
command = "umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterUnassign.txt 2>&1";
}
else
{
command = "sudo umount -f " + startup::StartUp::installDir() + "/data" + dbrootID + " > /tmp/glusterUnassign.txt 2>&1";
}
int ret = system(command.c_str()); int ret = system(command.c_str());
if ( WEXITSTATUS(ret) != 0 ) if ( WEXITSTATUS(ret) != 0 )
{ {
log.writeLog(__LINE__, "glusterUnassign mount failure: dbroot: " + dbrootID + " error: " + oam.itoa(WEXITSTATUS(ret)), LOG_TYPE_ERROR);
ifstream in("/tmp/glusterUnassign.txt"); ifstream in("/tmp/glusterUnassign.txt");
in.seekg(0, std::ios::end); in.seekg(0, std::ios::end);
int size = in.tellg(); int size = in.tellg();