You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-520
This commit is contained in:
@ -1,74 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# generic InfiniDB Disable Replication script.
|
|
||||||
#
|
|
||||||
# Notes: This script gets run by ProcMon:
|
|
||||||
|
|
||||||
# check log for error
|
|
||||||
checkForError() {
|
|
||||||
grep ERROR /tmp/disable-rep-status.log > /tmp/error.check
|
|
||||||
if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then
|
|
||||||
echo "ERROR: check log file: /tmp/disable-rep-status.log"
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
}
|
|
||||||
|
|
||||||
prefix=/usr/local
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
pwprompt=
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then
|
|
||||||
prefix="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
elif [ `expr -- "$arg" : '--password='` -eq 11 ]; then
|
|
||||||
password="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
pwprompt="--password=$password"
|
|
||||||
elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then
|
|
||||||
installdir="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
prefix=`dirname $installdir`
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
test -f $installdir/post/functions && . $installdir/post/functions
|
|
||||||
|
|
||||||
>/tmp/disable-rep-status.log
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run stop slave command
|
|
||||||
#
|
|
||||||
echo "Run stop slave command" >>/tmp/disable-rep-status.log
|
|
||||||
cat >/tmp/idb_disable-rep.sql <<EOD
|
|
||||||
stop slave;
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run reset slave command
|
|
||||||
#
|
|
||||||
echo "Run start slave command" >>/tmp/disable-rep-status.log
|
|
||||||
cat >/tmp/idb_disable-rep.sql <<EOD
|
|
||||||
reset slave;
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_disable-rep.sql >>/tmp/disable-rep-status.log
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
#alls good, 'OK' for success
|
|
||||||
echo "OK"
|
|
||||||
exit 0
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# $Id: install-infinidb.sh 421 2007-04-05 15:46:55Z dhill $
|
|
||||||
#
|
|
||||||
# install-infinidb.sh dummy EE version
|
|
||||||
|
|
||||||
echo " " 1>&2
|
|
||||||
echo " This install-infinidb.sh script is only used to install the Community Edition." 1>&2
|
|
||||||
echo " Please use the 'postConfigure' for installing the Enterprise Edition." 1>&2
|
|
||||||
echo " Check the Calpont InfiniDB Installation Document for further details." 1>&2
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# generic InfiniDB Master Replication script.
|
|
||||||
#
|
|
||||||
# Notes: This script gets run by ProcMon during installs and upgrades:
|
|
||||||
|
|
||||||
# check log for error
|
|
||||||
checkForError() {
|
|
||||||
grep ERROR /tmp/master-rep-status-$hostipaddr.log > /tmp/error.check
|
|
||||||
if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then
|
|
||||||
echo "ERROR: check log file: /tmp/master-rep-status-$hostipaddr.log"
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
}
|
|
||||||
|
|
||||||
prefix=/usr/local
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
pwprompt=
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then
|
|
||||||
prefix="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
elif [ `expr -- "$arg" : '--password='` -eq 11 ]; then
|
|
||||||
password="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
pwprompt="--password=$password"
|
|
||||||
elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then
|
|
||||||
installdir="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
prefix=`dirname $installdir`
|
|
||||||
elif [ `expr -- "$arg" : '--hostIP='` -eq 9 ]; then
|
|
||||||
hostipaddr="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
test -f $installdir/post/functions && . $installdir/post/functions
|
|
||||||
|
|
||||||
repUser="idbrep"
|
|
||||||
password="Calpont1"
|
|
||||||
|
|
||||||
>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
|
|
||||||
#
|
|
||||||
# Create Replication User
|
|
||||||
#
|
|
||||||
echo "Create Replication User $repUser for node $hostipaddr" >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
cat >/tmp/idb_master-rep.sql <<EOD
|
|
||||||
CREATE USER '$repUser'@'$hostipaddr' IDENTIFIED BY '$password';
|
|
||||||
GRANT REPLICATION SLAVE ON *.* TO '$repUser'@'$hostipaddr';
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
#
|
|
||||||
# Grant table access for created user
|
|
||||||
#
|
|
||||||
echo "Grant table access for $repUser for node $hostipaddr" >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
cat >/tmp/idb_master-rep.sql <<EOD
|
|
||||||
use mysql
|
|
||||||
grant all on *.* to '$repUser'@'$hostipaddr' identified by 'Calpont1';
|
|
||||||
grant REPLICATION SLAVE on *.* to '$repUser'@'$hostipaddr' identified by 'Calpont1';
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run SHOW MASTER STATUS
|
|
||||||
#
|
|
||||||
echo "Run SHOW MASTER STATUS to node log" >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
cat >/tmp/idb_master-rep.sql <<EOD
|
|
||||||
SHOW MASTER STATUS
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
echo "Run SHOW MASTER STATUS to master status log /tmp/show-master-status.log" >>/tmp/master-rep-status-$hostipaddr.log
|
|
||||||
cat >/tmp/idb_master-rep.sql <<EOD
|
|
||||||
SHOW MASTER STATUS
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_master-rep.sql >/tmp/show-master-status.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_master-rep.sql >>/tmp/show-master-status.log
|
|
||||||
|
|
||||||
|
|
||||||
#alls good, 'OK' for success
|
|
||||||
echo "OK"
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
|
|
@ -167,8 +167,15 @@ mkdir -p $installdir/data/bulk/rollback >/dev/null 2>&1
|
|||||||
mkdir -p $installdir/data/bulk/tmpjob >/dev/null 2>&1
|
mkdir -p $installdir/data/bulk/tmpjob >/dev/null 2>&1
|
||||||
rm -f $installdir/data/bulk/tmpjob/* >/dev/null 2>&1
|
rm -f $installdir/data/bulk/tmpjob/* >/dev/null 2>&1
|
||||||
|
|
||||||
|
#get temp directory
|
||||||
|
tmpDir="/tmp"
|
||||||
|
if [ $user != "root" ]; then
|
||||||
|
tmpDir=$HOME"./tmp"
|
||||||
|
mkdir $tmpDir >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
#create columnstore temp file directory
|
#create columnstore temp file directory
|
||||||
mkdir -p /tmp/columnstore_tmp_files >/dev/null 2>&1
|
mkdir -p $tmpDir/columnstore_tmp_files >/dev/null 2>&1
|
||||||
|
|
||||||
#create mount directories
|
#create mount directories
|
||||||
mkdir /mnt/tmp > /dev/null 2>&1
|
mkdir /mnt/tmp > /dev/null 2>&1
|
||||||
@ -180,7 +187,6 @@ 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
|
||||||
|
|
||||||
|
|
||||||
#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
|
||||||
RCFILE=/etc/rc.d/rc.local
|
RCFILE=/etc/rc.d/rc.local
|
||||||
@ -230,20 +236,20 @@ if [ $user = "root" ]; then
|
|||||||
fi
|
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 > $tmpDir/syslog_install.log 2>&1
|
||||||
|
|
||||||
#check if MariaDB Columnstore system logging was setup
|
#check if MariaDB Columnstore system logging was setup
|
||||||
cat /tmp/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
|
cat $tmpDir/syslog_install.log | grep 'No System Logging' >/dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
cat /tmp/syslog_install.log
|
cat $tmpDir/syslog_install.log
|
||||||
fi
|
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
|
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
|
chown $user:$user $installdir/etc/Columnstore.xml
|
||||||
|
|
||||||
@ -330,7 +336,7 @@ else
|
|||||||
chmod 755 $installdir/bin/setenv-hdfs-20
|
chmod 755 $installdir/bin/setenv-hdfs-20
|
||||||
|
|
||||||
. $installdir/bin/setenv-hdfs-20
|
. $installdir/bin/setenv-hdfs-20
|
||||||
$installdir/bin/hdfsCheck $installdir/lib/hdfs-20.so > /tmp/hdfs-20-test.log 2>&1
|
$installdir/bin/hdfsCheck $installdir/lib/hdfs-20.so > $tmpDir/hdfs-20-test.log 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
#Passed set in config file
|
#Passed set in config file
|
||||||
$installdir/bin/setConfig -d SystemConfig DataFilePlugin $installdir/lib/hdfs-20.so
|
$installdir/bin/setConfig -d SystemConfig DataFilePlugin $installdir/lib/hdfs-20.so
|
||||||
@ -397,7 +403,7 @@ EOD
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
. $installdir/bin/setenv-hdfs-12
|
. $installdir/bin/setenv-hdfs-12
|
||||||
$installdir/bin/hdfsCheck $installdir/lib/hdfs-12.so > /tmp/hdfs-12-test.log 2>&1
|
$installdir/bin/hdfsCheck $installdir/lib/hdfs-12.so > $tmpDir/hdfs-12-test.log 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
#Passed set in config file
|
#Passed set in config file
|
||||||
$installdir/bin/setConfig -d SystemConfig DataFilePlugin $installdir/lib/hdfs-12.so
|
$installdir/bin/setConfig -d SystemConfig DataFilePlugin $installdir/lib/hdfs-12.so
|
||||||
|
@ -67,7 +67,14 @@ if [ $user == "root" ]; then
|
|||||||
rm -f /var/log/mariadb/columnstore/activeAlarms > /dev/null 2>&1
|
rm -f /var/log/mariadb/columnstore/activeAlarms > /dev/null 2>&1
|
||||||
rm -f /var/log/mariadb/columnstore/*.log1 > /dev/null 2>&1
|
rm -f /var/log/mariadb/columnstore/*.log1 > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
rm -rf $installdir/mysql/db/columnstore_log_archive > /dev/null 2>&1
|
rm -rf $installdir/mysql/db/columnstore_log_archive > /dev/null 2>&1\
|
||||||
|
|
||||||
|
#get temp directory
|
||||||
|
tmpDir="/tmp"
|
||||||
|
if [ $user != "root" ]; then
|
||||||
|
tmpDir=$HOME"./tmp"
|
||||||
|
mkdir $tmpDir >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
# delete Mariab Columnstore shared memory segments
|
# delete Mariab Columnstore shared memory segments
|
||||||
$installdir/bin/clearShm > /dev/null 2>&1
|
$installdir/bin/clearShm > /dev/null 2>&1
|
||||||
@ -75,15 +82,15 @@ $installdir/bin/clearShm > /dev/null 2>&1
|
|||||||
# delete tmp files
|
# delete tmp files
|
||||||
rm -f $installdir/local/*.columnstore
|
rm -f $installdir/local/*.columnstore
|
||||||
rm -rf $installdir/local/etc/
|
rm -rf $installdir/local/etc/
|
||||||
rm -rf /tmp/bucketreuse
|
rm -rf $tmpDir/bucketreuse
|
||||||
rm -f /tmp/columnstore.txt
|
rm -f $tmpDir/columnstore.txt
|
||||||
rm -f /tmp/dbbuilder.*
|
rm -f $tmpDir/dbbuilder.*
|
||||||
rm -f /tmp/dbrmfiles
|
rm -f $tmpDir/dbrmfiles
|
||||||
rm -f /tmp/pkgcheck
|
rm -f $tmpDir/pkgcheck
|
||||||
rm -f /tmp/upgrade-status.log.*
|
rm -f $tmpDir/upgrade-status.log.*
|
||||||
rm -f /tmp/mount.log
|
rm -f $tmpDir/mount.log
|
||||||
rm -f $installdir/data/bulk/tmpjob/* >/dev/null 2>&1
|
rm -f $installdir/data/bulk/tmpjob/* >/dev/null 2>&1
|
||||||
rm -rf /tmp/columnstore_tmp_files
|
rm -rf $tmpDir/columnstore_tmp_files
|
||||||
rm -f $installdir/local/moveDbrootTransactionLog
|
rm -f $installdir/local/moveDbrootTransactionLog
|
||||||
|
|
||||||
lockdir=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation LockFileDirectory`
|
lockdir=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation LockFileDirectory`
|
||||||
|
@ -1,119 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# generic InfiniDB Slave Replication script.
|
|
||||||
#
|
|
||||||
# Notes: This script gets run by ProcMon during installs and upgrades:
|
|
||||||
|
|
||||||
# check log for error
|
|
||||||
checkForError() {
|
|
||||||
grep ERROR /tmp/slave-rep-status.log > /tmp/error.check
|
|
||||||
if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then
|
|
||||||
echo "ERROR: check log file: /tmp/slave-rep-status.log"
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
}
|
|
||||||
|
|
||||||
prefix=/usr/local
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
pwprompt=
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then
|
|
||||||
prefix="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
elif [ `expr -- "$arg" : '--password='` -eq 11 ]; then
|
|
||||||
password="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
pwprompt="--password=$password"
|
|
||||||
elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then
|
|
||||||
installdir="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
prefix=`dirname $installdir`
|
|
||||||
elif [ `expr -- "$arg" : '--masteripaddr='` -eq 15 ]; then
|
|
||||||
masteripaddr="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
elif [ `expr -- "$arg" : '--masterlogfile='` -eq 16 ]; then
|
|
||||||
masterlogfile="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
elif [ `expr -- "$arg" : '--masterlogpos='` -eq 15 ]; then
|
|
||||||
masterlogpos="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
elif [ `expr -- "$arg" : '--port='` -eq 7 ]; then
|
|
||||||
port="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
test -f $installdir/post/functions && . $installdir/post/functions
|
|
||||||
|
|
||||||
repUser="idbrep"
|
|
||||||
password="Calpont1"
|
|
||||||
|
|
||||||
>/tmp/slave-rep-status.log
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run stop slave command
|
|
||||||
#
|
|
||||||
echo "Run stop slave command" >>/tmp/slave-rep-status.log
|
|
||||||
cat >/tmp/idb_slave-rep.sql <<EOD
|
|
||||||
stop slave;
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run Change Master Command
|
|
||||||
#
|
|
||||||
echo "Run Change Master Command" >>/tmp/slave-rep-status.log
|
|
||||||
cat >/tmp/idb_slave-rep.sql <<EOD
|
|
||||||
CHANGE MASTER TO
|
|
||||||
MASTER_HOST='$masteripaddr',
|
|
||||||
MASTER_USER='$repUser',
|
|
||||||
MASTER_PASSWORD='$password',
|
|
||||||
MASTER_PORT=$port,
|
|
||||||
MASTER_LOG_FILE='$masterlogfile',
|
|
||||||
MASTER_LOG_POS=$masterlogpos;
|
|
||||||
MASTER_USE_GTID=$masterlogpos;
|
|
||||||
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run start slave command
|
|
||||||
#
|
|
||||||
echo "Run start slave command" >>/tmp/slave-rep-status.log
|
|
||||||
cat >/tmp/idb_slave-rep.sql <<EOD
|
|
||||||
start slave;
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run SHOW SLAVE STATUS
|
|
||||||
#
|
|
||||||
echo "Run SHOW SLAVE STATUS to node log" >>/tmp/slave-rep-status.log
|
|
||||||
cat >/tmp/idb_slave-rep.sql <<EOD
|
|
||||||
SHOW SLAVE STATUS\G
|
|
||||||
EOD
|
|
||||||
|
|
||||||
cat /tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-extra-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_slave-rep.sql >>/tmp/slave-rep-status.log
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
#alls good, 'OK' for success
|
|
||||||
echo "OK"
|
|
||||||
exit 0
|
|
@ -1,444 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# generic InfiniDB upgrade script.
|
|
||||||
#
|
|
||||||
# Notes: This script gets run every time InfiniDB starts up so it needs to be:
|
|
||||||
# 1) able to only do stuff once if needed and nothing if not needed
|
|
||||||
# 2) reasonably fast when there's nothing to do
|
|
||||||
|
|
||||||
# check log for error
|
|
||||||
checkForError() {
|
|
||||||
grep ERROR /tmp/upgrade-status.log.$$ > /tmp/error.check
|
|
||||||
if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then
|
|
||||||
echo "ERROR: check log file: /tmp/upgrade-status.log.$$"
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "x$1" != xdoupgrade ]; then
|
|
||||||
echo "Don't run this script by hand! You probably want to use install-infinidb.sh." 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
prefix=/usr/local
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
pwprompt=
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then
|
|
||||||
prefix="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
elif [ `expr -- "$arg" : '--password='` -eq 11 ]; then
|
|
||||||
password="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
pwprompt="--password=$password"
|
|
||||||
elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then
|
|
||||||
installdir="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
prefix=`dirname $installdir`
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
test -f $installdir/post/functions && . $installdir/post/functions
|
|
||||||
|
|
||||||
mt=`module_type`
|
|
||||||
mid=`module_id`
|
|
||||||
|
|
||||||
# for CE version
|
|
||||||
if [ -z "$mt" ]; then
|
|
||||||
mt=pm
|
|
||||||
fi
|
|
||||||
if [ -z "$mid" ]; then
|
|
||||||
mid=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
has_um=`$installdir/bin/getConfig SystemModuleConfig ModuleCount2`
|
|
||||||
if [ -z "$has_um" ]; then
|
|
||||||
has_um=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
>/tmp/upgrade-status.log.$$
|
|
||||||
echo "mt = $mt" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "mid = $mid" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "has_um = $has_um" >>/tmp/upgrade-status.log.$$
|
|
||||||
|
|
||||||
#This upgrade only for UM or PM with no UM
|
|
||||||
if [ $has_um -eq 0 -o "x$mt" = xum ]; then
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if compressiontype column is in SYSCOLUMN
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
echo "checking calpontsys for compressiontype..." >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep compressiontype >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Add compressiontype column to SYSCOLUMN if applicable
|
|
||||||
#
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "calpontsys needs upgrade for compressiontype" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "added compressiontype column" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
alter table syscolumn add compressiontype int comment 'schema sync only';
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
if [ $mid -eq 1 ]; then
|
|
||||||
echo "update compressiontype to backend" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
select calonlinealter('alter table syscolumn add (compressiontype int)') as xxx;
|
|
||||||
update syscolumn set compressiontype=0 where compressiontype is null;
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that compressiontype was successfully added to SYSCOLUMN
|
|
||||||
#
|
|
||||||
rm -f /tmp/idb_upgrade.sql
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep compressiontype >/tmp/upgrade-status-1.log 2>&1
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding compressiontype to SYSCOLUMN!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -ne 1 ]; then
|
|
||||||
echo "FAILED adding compressiontype to SYSCOLUMN!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that compressiontype (OID 1041) was successfully added to BRM
|
|
||||||
#
|
|
||||||
if [ $has_um -eq 0 ]; then
|
|
||||||
$installdir/bin/editem -o1041 1>/tmp/upgrade-status-1.log 2>/dev/null
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding compressiontype to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -lt 2 ]; then
|
|
||||||
echo "FAILED adding compressiontype to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if autoincrement column is in SYSTABLE
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
echo "checking calpontsys for autoincrement..." >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe systable;' \
|
|
||||||
calpontsys | grep autoincrement >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Add autoincrement column to SYSTABLE if applicable
|
|
||||||
#
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "calpontsys needs upgrade for autoincrement" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "add autoincrement columns" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
alter table systable add autoincrement int comment 'schema sync only';
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
if [ $mid -eq 1 ]; then
|
|
||||||
echo "update autoincrement to backend" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
select calonlinealter('alter table systable add (autoincrement int)') as xxx;
|
|
||||||
update systable set autoincrement=0 where autoincrement is null;
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
#Verify that autoincrement was successfully added to SYSTABLE
|
|
||||||
#
|
|
||||||
rm -f /tmp/idb_upgrade.sql
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe systable;' \
|
|
||||||
calpontsys | grep autoincrement >/tmp/upgrade-status-1.log 2>&1
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding autoincrement to SYSTABLE!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -ne 1 ]; then
|
|
||||||
echo "FAILED adding autoincrement to SYSTABLE!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that autoincrement (OID 1011) was successfully added to BRM
|
|
||||||
#
|
|
||||||
if [ $has_um -eq 0 ]; then
|
|
||||||
$installdir/bin/editem -o1011 1>/tmp/upgrade-status-1.log 2>/dev/null
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding autoincrement to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ "x$cnt" = x ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -lt 2 ]; then
|
|
||||||
echo "FAILED adding autoincrement to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if nextvalue column is in SYSCOLUMN
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
echo "checking calpontsys for nextvalue..." >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep nextvalue >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Add nextvalue column to SYSCOLUMN if applicable.
|
|
||||||
# Also set old autoincrement column in SYSCOLUMN to 'n'.
|
|
||||||
#
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "calpontsys needs upgrade for nextvalue" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "add nextvalue columns" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
alter table syscolumn add nextvalue bigint comment 'schema sync only';
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
if [ $mid -eq 1 ]; then
|
|
||||||
echo "update nextvalue to backend" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
select calonlinealter('alter table syscolumn add (nextvalue bigint)') as xxx;
|
|
||||||
update syscolumn set nextvalue=1 where nextvalue is null;
|
|
||||||
update syscolumn set autoincrement='n' where autoincrement is null;
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that nextvalue was successfully added to SYSCOLUMN
|
|
||||||
#
|
|
||||||
rm -f /tmp/idb_upgrade.sql
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep nextvalue >/tmp/upgrade-status-1.log 2>&1
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding nextvalue to SYSCOLUMN!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -ne 1 ]; then
|
|
||||||
echo "FAILED adding nextvalue to SYSCOLUMN!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that nextvalue (OID 1042) was successfully added to BRM
|
|
||||||
#
|
|
||||||
if [ $has_um -eq 0 ]; then
|
|
||||||
$installdir/bin/editem -o1042 1>/tmp/upgrade-status-1.log 2>/dev/null
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding nextvalue to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ "x$cnt" = x ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -lt 2 ]; then
|
|
||||||
echo "FAILED adding nextvalue to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if systable schema and tablename columns are varchar(128).
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
recreate=0
|
|
||||||
echo "checking calpontsys.systable schema and tablename for varchar(128)..." >>/tmp/upgrade-status.log.$$
|
|
||||||
colCount=` \
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe systable;' \
|
|
||||||
calpontsys | egrep "schema|tablename" | grep "varchar(128)" | wc -l`
|
|
||||||
if [ $colCount -ne 2 ]; then
|
|
||||||
recreate=1
|
|
||||||
echo "calpontsys needs upgrade to expand systable schema and tablename" >>/tmp/upgrade-status.log.$$
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if syscolumn schema, tablename, and columname columns are varchar(128).
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
if [ $recreate -eq 0 ]; then
|
|
||||||
echo "checking calpontsys.syscolumn schema, tablename, columnname for varchar(128)..." >>/tmp/upgrade-status.log.$$
|
|
||||||
colCount=` \
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | egrep "schema|tablename|columnname" | grep "varchar(128)" | wc -l`
|
|
||||||
if [ $colCount -ne 3 ]; then
|
|
||||||
recreate=1
|
|
||||||
echo "calpontsys needs upgrade to expand syscolumn schema, tablename, and columnname" >>/tmp/upgrade-status.log.$$
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if defaultvalue column in SYSCOLUMN is varchar(64)
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
if [ $recreate -eq 0 ]; then
|
|
||||||
echo "checking calpontsys for defaultvalue varchar(64)..." >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep defaultvalue | grep 'varchar(64)' >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
recreate=1
|
|
||||||
echo "calpontsys needs upgrade to change defaultvalue" >>/tmp/upgrade-status.log.$$
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Change defaultvalue column to varchar(64) if applicable
|
|
||||||
#
|
|
||||||
if [ $recreate -ne 0 ]; then
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
drop table if exists systable restrict;
|
|
||||||
drop table if exists syscolumn restrict;
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
echo "create systable and syscolumn with schema sync only" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat $installdir/mysql/syscatalog_mysql.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys <$installdir/mysql/syscatalog_mysql.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify column widths:
|
|
||||||
# varchar(64) for syscolumn.defaultvalue
|
|
||||||
# varchar(128) for systable (schema, tablename) and syscolumn (schema, tablename, and columnname).
|
|
||||||
#
|
|
||||||
rm -f /tmp/idb_upgrade.sql
|
|
||||||
echo "verify column widths" >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep defaultvalue | grep 'varchar(64)' >/tmp/upgrade-status-1.log 2>&1
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe systable; describe syscolumn;' \
|
|
||||||
calpontsys | egrep "schema|tablename|columnname" | grep 'varchar(128)' >>/tmp/upgrade-status-1.log 2>&1
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -ne 6 ]; then
|
|
||||||
echo "FAILED width of schema, tablename, columnname, defaultvalue verification!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "OK"
|
|
@ -1,444 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# generic InfiniDB upgrade script.
|
|
||||||
#
|
|
||||||
# Notes: This script gets run every time InfiniDB starts up so it needs to be:
|
|
||||||
# 1) able to only do stuff once if needed and nothing if not needed
|
|
||||||
# 2) reasonably fast when there's nothing to do
|
|
||||||
|
|
||||||
# check log for error
|
|
||||||
checkForError() {
|
|
||||||
grep ERROR /tmp/upgrade-status.log.$$ > /tmp/error.check
|
|
||||||
if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then
|
|
||||||
echo "ERROR: check log file: /tmp/upgrade-status.log.$$"
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
rm -f /tmp/error.check
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "x$1" != xdoupgrade ]; then
|
|
||||||
echo "Don't run this script by hand! You probably want to use install-infinidb.sh." 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
prefix=/usr/local
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
pwprompt=
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then
|
|
||||||
prefix="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
installdir=$prefix/mariadb/columnstore
|
|
||||||
elif [ `expr -- "$arg" : '--password='` -eq 11 ]; then
|
|
||||||
password="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
pwprompt="--password=$password"
|
|
||||||
elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then
|
|
||||||
installdir="`echo $arg | awk -F= '{print $2}'`"
|
|
||||||
prefix=`dirname $installdir`
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
test -f $installdir/post/functions && . $installdir/post/functions
|
|
||||||
|
|
||||||
mt=`module_type`
|
|
||||||
mid=`module_id`
|
|
||||||
|
|
||||||
# for CE version
|
|
||||||
if [ -z "$mt" ]; then
|
|
||||||
mt=pm
|
|
||||||
fi
|
|
||||||
if [ -z "$mid" ]; then
|
|
||||||
mid=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
has_um=`$installdir/bin/getConfig SystemModuleConfig ModuleCount2`
|
|
||||||
if [ -z "$has_um" ]; then
|
|
||||||
has_um=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
>/tmp/upgrade-status.log.$$
|
|
||||||
echo "mt = $mt" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "mid = $mid" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "has_um = $has_um" >>/tmp/upgrade-status.log.$$
|
|
||||||
|
|
||||||
#This upgrade only for UM or PM with no UM
|
|
||||||
if [ $has_um -eq 0 -o "x$mt" = xum ]; then
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if compressiontype column is in SYSCOLUMN
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
echo "checking calpontsys for compressiontype..." >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep compressiontype >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Add compressiontype column to SYSCOLUMN if applicable
|
|
||||||
#
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "calpontsys needs upgrade for compressiontype" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "added compressiontype column" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
alter table syscolumn add compressiontype int comment 'schema sync only';
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
if [ $mid -eq 1 ]; then
|
|
||||||
echo "update compressiontype to backend" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
select calonlinealter('alter table syscolumn add (compressiontype int)') as xxx;
|
|
||||||
update syscolumn set compressiontype=0 where compressiontype is null;
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that compressiontype was successfully added to SYSCOLUMN
|
|
||||||
#
|
|
||||||
rm -f /tmp/idb_upgrade.sql
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep compressiontype >/tmp/upgrade-status-1.log 2>&1
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding compressiontype to SYSCOLUMN!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -ne 1 ]; then
|
|
||||||
echo "FAILED adding compressiontype to SYSCOLUMN!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that compressiontype (OID 1041) was successfully added to BRM
|
|
||||||
#
|
|
||||||
if [ $has_um -eq 0 ]; then
|
|
||||||
$installdir/bin/editem -o1041 1>/tmp/upgrade-status-1.log 2>/dev/null
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding compressiontype to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -lt 2 ]; then
|
|
||||||
echo "FAILED adding compressiontype to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if autoincrement column is in SYSTABLE
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
echo "checking calpontsys for autoincrement..." >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe systable;' \
|
|
||||||
calpontsys | grep autoincrement >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Add autoincrement column to SYSTABLE if applicable
|
|
||||||
#
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "calpontsys needs upgrade for autoincrement" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "add autoincrement columns" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
alter table systable add autoincrement int comment 'schema sync only';
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
if [ $mid -eq 1 ]; then
|
|
||||||
echo "update autoincrement to backend" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
select calonlinealter('alter table systable add (autoincrement int)') as xxx;
|
|
||||||
update systable set autoincrement=0 where autoincrement is null;
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
#Verify that autoincrement was successfully added to SYSTABLE
|
|
||||||
#
|
|
||||||
rm -f /tmp/idb_upgrade.sql
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe systable;' \
|
|
||||||
calpontsys | grep autoincrement >/tmp/upgrade-status-1.log 2>&1
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding autoincrement to SYSTABLE!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -ne 1 ]; then
|
|
||||||
echo "FAILED adding autoincrement to SYSTABLE!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that autoincrement (OID 1011) was successfully added to BRM
|
|
||||||
#
|
|
||||||
if [ $has_um -eq 0 ]; then
|
|
||||||
$installdir/bin/editem -o1011 1>/tmp/upgrade-status-1.log 2>/dev/null
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding autoincrement to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ "x$cnt" = x ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -lt 2 ]; then
|
|
||||||
echo "FAILED adding autoincrement to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if nextvalue column is in SYSCOLUMN
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
echo "checking calpontsys for nextvalue..." >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep nextvalue >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Add nextvalue column to SYSCOLUMN if applicable.
|
|
||||||
# Also set old autoincrement column in SYSCOLUMN to 'n'.
|
|
||||||
#
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "calpontsys needs upgrade for nextvalue" >>/tmp/upgrade-status.log.$$
|
|
||||||
echo "add nextvalue columns" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
alter table syscolumn add nextvalue bigint comment 'schema sync only';
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
if [ $mid -eq 1 ]; then
|
|
||||||
echo "update nextvalue to backend" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
select calonlinealter('alter table syscolumn add (nextvalue bigint)') as xxx;
|
|
||||||
update syscolumn set nextvalue=1 where nextvalue is null;
|
|
||||||
update syscolumn set autoincrement='n' where autoincrement is null;
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that nextvalue was successfully added to SYSCOLUMN
|
|
||||||
#
|
|
||||||
rm -f /tmp/idb_upgrade.sql
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep nextvalue >/tmp/upgrade-status-1.log 2>&1
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding nextvalue to SYSCOLUMN!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -ne 1 ]; then
|
|
||||||
echo "FAILED adding nextvalue to SYSCOLUMN!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that nextvalue (OID 1042) was successfully added to BRM
|
|
||||||
#
|
|
||||||
if [ $has_um -eq 0 ]; then
|
|
||||||
$installdir/bin/editem -o1042 1>/tmp/upgrade-status-1.log 2>/dev/null
|
|
||||||
rc=$?
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
if [ $rc -ne 0 ]; then
|
|
||||||
echo "FAILED adding nextvalue to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ "x$cnt" = x ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -lt 2 ]; then
|
|
||||||
echo "FAILED adding nextvalue to BRM!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if systable schema and tablename columns are varchar(128).
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
recreate=0
|
|
||||||
echo "checking calpontsys.systable schema and tablename for varchar(128)..." >>/tmp/upgrade-status.log.$$
|
|
||||||
colCount=` \
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe systable;' \
|
|
||||||
calpontsys | egrep "schema|tablename" | grep "varchar(128)" | wc -l`
|
|
||||||
if [ $colCount -ne 2 ]; then
|
|
||||||
recreate=1
|
|
||||||
echo "calpontsys needs upgrade to expand systable schema and tablename" >>/tmp/upgrade-status.log.$$
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if syscolumn schema, tablename, and columname columns are varchar(128).
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
if [ $recreate -eq 0 ]; then
|
|
||||||
echo "checking calpontsys.syscolumn schema, tablename, columnname for varchar(128)..." >>/tmp/upgrade-status.log.$$
|
|
||||||
colCount=` \
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | egrep "schema|tablename|columnname" | grep "varchar(128)" | wc -l`
|
|
||||||
if [ $colCount -ne 3 ]; then
|
|
||||||
recreate=1
|
|
||||||
echo "calpontsys needs upgrade to expand syscolumn schema, tablename, and columnname" >>/tmp/upgrade-status.log.$$
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# See if defaultvalue column in SYSCOLUMN is varchar(64)
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
if [ $recreate -eq 0 ]; then
|
|
||||||
echo "checking calpontsys for defaultvalue varchar(64)..." >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep defaultvalue | grep 'varchar(64)' >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
recreate=1
|
|
||||||
echo "calpontsys needs upgrade to change defaultvalue" >>/tmp/upgrade-status.log.$$
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Change defaultvalue column to varchar(64) if applicable
|
|
||||||
#
|
|
||||||
if [ $recreate -ne 0 ]; then
|
|
||||||
cat >/tmp/idb_upgrade.sql <<EOD
|
|
||||||
drop table if exists systable restrict;
|
|
||||||
drop table if exists syscolumn restrict;
|
|
||||||
EOD
|
|
||||||
cat /tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys </tmp/idb_upgrade.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
echo "create systable and syscolumn with schema sync only" >>/tmp/upgrade-status.log.$$
|
|
||||||
cat $installdir/mysql/syscatalog_mysql.sql >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
calpontsys <$installdir/mysql/syscatalog_mysql.sql >>/tmp/upgrade-status.log.$$ 2>&1
|
|
||||||
|
|
||||||
checkForError
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify column widths:
|
|
||||||
# varchar(64) for syscolumn.defaultvalue
|
|
||||||
# varchar(128) for systable (schema, tablename) and syscolumn (schema, tablename, and columnname).
|
|
||||||
#
|
|
||||||
rm -f /tmp/idb_upgrade.sql
|
|
||||||
echo "verify column widths" >>/tmp/upgrade-status.log.$$
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe syscolumn;' \
|
|
||||||
calpontsys | grep defaultvalue | grep 'varchar(64)' >/tmp/upgrade-status-1.log 2>&1
|
|
||||||
$installdir/mysql/bin/mysql \
|
|
||||||
--defaults-file=$installdir/mysql/my.cnf \
|
|
||||||
--user=root $pwprompt \
|
|
||||||
--execute='describe systable; describe syscolumn;' \
|
|
||||||
calpontsys | egrep "schema|tablename|columnname" | grep 'varchar(128)' >>/tmp/upgrade-status-1.log 2>&1
|
|
||||||
cat /tmp/upgrade-status-1.log >>/tmp/upgrade-status.log.$$
|
|
||||||
cnt=`wc -l /tmp/upgrade-status-1.log | awk '{print $1}'`
|
|
||||||
rm -f /tmp/upgrade-status-1.log
|
|
||||||
if [ -z "$cnt" ]; then
|
|
||||||
cnt=0
|
|
||||||
fi
|
|
||||||
if [ $cnt -ne 6 ]; then
|
|
||||||
echo "FAILED width of schema, tablename, columnname, defaultvalue verification!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "OK"
|
|
@ -1,173 +0,0 @@
|
|||||||
#!/usr/bin/expect
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# Install custom OS files on External Module
|
|
||||||
# Argument 1 - Remote Module Name
|
|
||||||
# Argument 2 - Remote Server Host Name or IP address
|
|
||||||
# Argument 3 - OAM Parent Host Name
|
|
||||||
# Argument 4 - Root Password of remote server
|
|
||||||
# Argument 5 - Debug flag 1 for on, 0 for off
|
|
||||||
set timeout 10
|
|
||||||
set USERNAME root
|
|
||||||
set MODULE [lindex $argv 0]
|
|
||||||
set SERVER [lindex $argv 1]
|
|
||||||
set OAMHOSTNAME [lindex $argv 2]
|
|
||||||
set PASSWORD [lindex $argv 3]
|
|
||||||
set DEBUG [lindex $argv 4]
|
|
||||||
log_user $DEBUG
|
|
||||||
spawn -noecho /bin/bash
|
|
||||||
#
|
|
||||||
# Validate Calpont RPM is installed
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Check Calpont RPM installed "
|
|
||||||
expect -re "# "
|
|
||||||
send "ssh $USERNAME@$SERVER 'rpm -iq calpont'\n"
|
|
||||||
expect {
|
|
||||||
-re "Host key verification failed" { send_user "FAILED: Host key verification failed\n" ; exit }
|
|
||||||
-re "service not known" { send_user "FAILED: Invalid Host\n" ; exit }
|
|
||||||
-re "authenticity" { send "yes\n"
|
|
||||||
expect {
|
|
||||||
-re "word: " { send "$PASSWORD\n" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-re "word: " { send "$PASSWORD\n" }
|
|
||||||
}
|
|
||||||
expect {
|
|
||||||
-re "tools " { send_user "DONE" }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
-re "package calpont" { send_user "ERROR: Calpont RPM not installed on External Module\n" ; exit -1 }
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# Create mount directories
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Create etc mount directory "
|
|
||||||
expect -re "# "
|
|
||||||
send "ssh $USERNAME@$SERVER 'mkdir /mnt/$OAMHOSTNAME\_etc'\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "# " { send_user "DONE" }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
-re "mkdir: cannot" { send_user "DONE: already installed\n"
|
|
||||||
send_user "\nInstallation Successfully Completed on '$MODULE'\n"; exit 0 }
|
|
||||||
}
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Create OAM mount directory "
|
|
||||||
send "ssh $USERNAME@$SERVER 'mkdir /mnt/$OAMHOSTNAME\_OAM'\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "# " { send_user "DONE" }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
-re "mkdir: cannot" { send_user "DONE: already installed\n"
|
|
||||||
send_user "\nInstallation Successfully Completed on '$MODULE'\n"; exit 0 }
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# copy over calpont OS files
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Copy Mount File to Module "
|
|
||||||
send "scp /tmp/etc/$MODULE/*mount $USERNAME@$SERVER:/mnt/.\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "100%" { send_user "DONE" }
|
|
||||||
-re "scp" { send_user "ERROR\n" ;
|
|
||||||
send_user "\n*** Installation ERROR\n" ;
|
|
||||||
exit -1 }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
-re "No such file or directory" { send_user "ERROR: Invalid file\n" ; exit -1 }
|
|
||||||
}
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Copy Custom inittab to Module "
|
|
||||||
send "scp /tmp/etc/$MODULE/inittab.calpont $USERNAME@$SERVER:/tmp/.\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "100%" { send_user "DONE" }
|
|
||||||
-re "scp" { send_user "ERROR\n" ;
|
|
||||||
send_user "\n*** Installation ERROR\n" ;
|
|
||||||
exit -1 }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
-re "No such file or directory" { send_user "ERROR: Invalid file\n" ; exit -1 }
|
|
||||||
}
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Copy syslogd.conf to Module "
|
|
||||||
send "scp /etc/syslog.conf $USERNAME@$SERVER:/etc/.\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "100%" { send_user "DONE" }
|
|
||||||
-re "scp" { send_user "ERROR\n" ;
|
|
||||||
send_user "\n*** Installation ERROR\n" ;
|
|
||||||
exit -1 }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
-re "No such file or directory" { send_user "ERROR: Invalid file\n" ; exit -1 }
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# chmod of mount file
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Run chmod on Mount File "
|
|
||||||
send "ssh $USERNAME@$SERVER 'chmod 755 /mnt/$OAMHOSTNAME\_*mount'\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "# " { send_user "DONE" }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# Update External Module inittab
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Update inittab "
|
|
||||||
send "ssh $USERNAME@$SERVER 'cat /tmp/inittab.calpont >> /etc/inittab'\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "# " { send_user "DONE" }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# Restart External Module syslogd
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Restart syslogd "
|
|
||||||
send "ssh $USERNAME@$SERVER 'service syslog restart'\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "# " { send_user "DONE" }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
}
|
|
||||||
#
|
|
||||||
# startup ProcMon
|
|
||||||
#
|
|
||||||
send_user "\n"
|
|
||||||
send_user "Startup ProcMon "
|
|
||||||
send "ssh $USERNAME@$SERVER 'kill -HUP 1'\n"
|
|
||||||
expect -re "word: "
|
|
||||||
# send the password
|
|
||||||
send "$PASSWORD\n"
|
|
||||||
expect {
|
|
||||||
-re "# " { send_user "DONE" }
|
|
||||||
-re "Permission denied" { send_user "ERROR: Invalid password\n" ; exit -1 }
|
|
||||||
}
|
|
||||||
send_user "\n"
|
|
||||||
#
|
|
||||||
send_user "\nInstallation Successfully Completed on '$MODULE'\n"
|
|
||||||
exit 0
|
|
||||||
|
|
@ -188,8 +188,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
string ccHistoryFile = HOME + "/.cc_history";
|
string ccHistoryFile = HOME + "/.cc_history";
|
||||||
|
|
||||||
cout << startup::StartUp::installDir();
|
cout << startup::StartUp::installDir() << endl;
|
||||||
cout << startup::StartUp::tmpDir();
|
cout << startup::StartUp::tmpDir() << endl;
|
||||||
|
|
||||||
string cf = startup::StartUp::installDir() + "/etc/" + ConsoleCmdsFile;
|
string cf = startup::StartUp::installDir() + "/etc/" + ConsoleCmdsFile;
|
||||||
fConfig = Config::makeConfig(cf);
|
fConfig = Config::makeConfig(cf);
|
||||||
|
@ -106,7 +106,7 @@ const string StartUp::tmpDir()
|
|||||||
if (p && *p)
|
if (p && *p)
|
||||||
homedir = p;
|
homedir = p;
|
||||||
|
|
||||||
*fTmpDirp = homedir + "/tmp";
|
*fTmpDirp = homedir + "/.tmp";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user