From 07e78c410b106e0bae715a7c5617f1119a0d840e Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 26 Sep 2018 15:05:27 -0500 Subject: [PATCH] MCOL-520 --- oam/install_scripts/post-install | 16 ++++++---- oam/install_scripts/run.sh | 2 +- oam/install_scripts/syslogSetup.sh | 12 ++++--- utils/idbdatafile/IDBPolicy.cpp | 3 ++ utils/startup/installdir.cpp | 50 +++++++++++++++--------------- 5 files changed, 46 insertions(+), 37 deletions(-) diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index b2f7a361a..25452dada 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -172,17 +172,21 @@ tmpDir="/tmp" if [ $user != "root" ]; then tmpDir=$HOME"./tmp" mkdir $tmpDir >/dev/null 2>&1 +else + #get columnstore temp file directory name + TempFileDir=`$installdir/bin/getConfig SystemConfig TempFileDir` + tmpDir=${tmpDir}${TempFileDir} fi -#get columnstore temp file directory name -TempFileDir=`$installdir/bin/getConfig SystemConfig TempFileDir` -tmpDir=${tmpDir}${TempFileDir} - #set base columnstore temp file directory $installdir/bin/setConfig -d SystemConfig SystemTempFileDir $tmpDir -#create columnstore temp file directory -mkdir -p $tmpDir >/dev/null 2>&1 +#get place file buffer temporary files +hdfsRdwrScratch=`$installdir/bin/getConfig SystemConfig hdfsRdwrScratch` +hdfsDir=${tmpDir}${hdfsRdwrScratch} + +#create place file buffer temporary files +mkdir -p $hdfsDir >/dev/null 2>&1 #create mount directories mkdir /mnt/tmp > /dev/null 2>&1 diff --git a/oam/install_scripts/run.sh b/oam/install_scripts/run.sh index 2cb05ef32..ec747bedc 100755 --- a/oam/install_scripts/run.sh +++ b/oam/install_scripts/run.sh @@ -18,7 +18,7 @@ while getopts "vs:t:h:l" flag; do ;; t) topt=$OPTARG ;; - t) lopt=$OPTARG + l) lopt=$OPTARG ;; h) echo $usage exit 0 diff --git a/oam/install_scripts/syslogSetup.sh b/oam/install_scripts/syslogSetup.sh index 347889f4a..c741d158a 100755 --- a/oam/install_scripts/syslogSetup.sh +++ b/oam/install_scripts/syslogSetup.sh @@ -164,12 +164,14 @@ if [ ! -z "$syslog_conf" ] ; then chown $user:$user /home/$user/mariadb/columnstore/etc/* fi - if [ "$syslog_conf" != /etc/rsyslog.d/columnstore.conf ]; then - rm -f ${syslog_conf}.columnstoreSave - cp ${syslog_conf} ${syslog_conf}.columnstoreSave >/dev/null 2>&1 - sed -i '/# MariaDB/,$d' ${syslog_conf}.columnstoreSave > /dev/null 2>&1 + if [ "$syslog_conf" != /etc/rsyslog.d/columnstore.conf ] || + [ "$syslog_conf" != /etc/rsyslog.d/49-columnstore.conf ]; then + + rm -f ${syslog_conf}.columnstoreSave + cp ${syslog_conf} ${syslog_conf}.columnstoreSave >/dev/null 2>&1 + sed -i '/# MariaDB/,$d' ${syslog_conf}.columnstoreSave > /dev/null 2>&1 fi - + egrep -qs 'MariaDB Columnstore Database Platform Logging' ${syslog_conf} if [ $? -ne 0 ]; then #set the syslog for ColumnStore logging diff --git a/utils/idbdatafile/IDBPolicy.cpp b/utils/idbdatafile/IDBPolicy.cpp index e640eeffe..4d0679308 100644 --- a/utils/idbdatafile/IDBPolicy.cpp +++ b/utils/idbdatafile/IDBPolicy.cpp @@ -63,6 +63,7 @@ void IDBPolicy::init( bool bEnableLogging, bool bUseRdwrMemBuffer, const string& if ( hdfsRdwrScratch.length() > 0 ) { // TODO-check to make sure this directory has sufficient space, whatever that means. + boost::filesystem::path tmpfilepath( hdfsRdwrScratch ); if (boost::filesystem::exists(tmpfilepath)) @@ -79,6 +80,8 @@ void IDBPolicy::init( bool bEnableLogging, bool bUseRdwrMemBuffer, const string& } else { + cout << tmpfilepath << endl; + if (!boost::filesystem::create_directory(tmpfilepath)) { // We failed to create the scratch directory diff --git a/utils/startup/installdir.cpp b/utils/startup/installdir.cpp index 663ac74b3..e53f09132 100644 --- a/utils/startup/installdir.cpp +++ b/utils/startup/installdir.cpp @@ -35,6 +35,9 @@ using namespace boost; using namespace config; +#include + +using namespace std; namespace startup { @@ -97,36 +100,33 @@ const string StartUp::tmpDir() #else - Config* sysConfig = Config::makeConfig(); + //check for non-root user + const char* p = getenv("HOME"); + string homedir = p; - string TempFileDir; - - try + if (homedir == "/root") { - TempFileDir = sysConfig->getConfig("SystemConfig", "TempFileDir"); + Config* sysConfig = Config::makeConfig(); + + string TempFileDir; + + try + { + TempFileDir = sysConfig->getConfig("SystemConfig", "TempFileDir"); + } + catch (...) + {} + + fTmpDirp = new string("/tmp"); + + *fTmpDirp = homedir + TempFileDir; } - catch (...) - {} - - fTmpDirp = new string("/tmp"); - //See if we can figure out the tmp dir in Linux... - //1. env var COLUMNSTORE_INSTALL_DIR - const char* p = 0; - p = getenv("COLUMNSTORE_INSTALL_DIR"); - - if (p && *p) - { - string homedir = "/"; - char* p = getenv("HOME"); - - if (p && *p) - homedir = p; - - *fTmpDirp = homedir + "/.tmp"; + else + { + // non-root user + *fTmpDirp = homedir + "/.tmp"; } - *fTmpDirp = *fTmpDirp + TempFileDir; - #endif return *fTmpDirp;