From 72f514ca540b66d29c5480b757c1946e0145e2b9 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 21 Sep 2018 14:44:12 -0500 Subject: [PATCH] MCOL-520 --- dbcon/execplan/calpontsystemcatalog.cpp | 5 +- dbcon/execplan/sessionmonitor.cpp | 11 ++- dbcon/mysql/ha_calpont_execplan.cpp | 8 +- dbcon/mysql/ha_calpont_impl.cpp | 18 ++-- dbcon/mysql/install_calpont_mysql.sh | 4 +- dbcon/mysql/sm.cpp | 7 +- oam/etc/Columnstore.xml | 2 +- oam/install_scripts/post-mysql-install | 8 +- oamapps/postConfigure/helpers.cpp | 40 ++++++--- oamapps/postConfigure/postConfigure.cpp | 109 ++++++++++++++---------- 10 files changed, 138 insertions(+), 74 deletions(-) diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 15ccd73aa..cf11b6018 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -66,6 +66,8 @@ using namespace logging; #include "rowgroup.h" using namespace rowgroup; +#include "installdir.h" + #include #include #include @@ -92,7 +94,8 @@ throw runtime_error("CALPONT_INTERNAL_ERROR"); \ #if CSC_DEBUG namespace { -std::ofstream csclog("/tmp/csc.log", std::ios::app); + string tmpDir = startup::StartUp::installDir() + "csc.log"; + std::ofstream csclog(tmpDir, std::ios::app); } #define DEBUG csclog #else diff --git a/dbcon/execplan/sessionmonitor.cpp b/dbcon/execplan/sessionmonitor.cpp index c3a89c4ce..0a27b5925 100644 --- a/dbcon/execplan/sessionmonitor.cpp +++ b/dbcon/execplan/sessionmonitor.cpp @@ -54,6 +54,9 @@ using namespace messageqcpp; using namespace BRM; +#include "installdir.h" + + namespace execplan { @@ -102,8 +105,12 @@ SessionMonitor::SessionMonitor() if (stmp != "") fSegmentFilename = strdup(stmp.c_str()); else - fSegmentFilename = strdup("/tmp/CalpontSessionMonitorShm"); - + { + string tmpdir = startup::StartUp::installDir() + "CalpontSessionMonitorShm"; + + fSegmentFilename = strdup(tmpdir); + } + try { madeSems = getSems(); diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 789d85ad3..2fa2150bf 100644 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -6195,7 +6195,9 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i if (filters) { csep->filters(filters); - filters->drawTree("/tmp/filter1.dot"); + std::string aTmpDir(startup::StartUp::tmpDir()); + aTmpDir = aTmpDir + "/filter1.dot"; + filters->drawTree(aTmpDir); } gwi.clauseType = SELECT; @@ -8620,7 +8622,9 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro { csep->filters(filters); #ifdef DEBUG_WALK_COND - filters->drawTree("/tmp/filter1.dot"); + std::string aTmpDir(startup::StartUp::tmpDir()); + aTmpDir = aTmpDir + "/filter1.dot"; + filters->drawTree(aTmpDir); #endif } diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index ad83f48db..792114c9b 100644 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -3056,7 +3056,9 @@ int ha_calpont_impl_rnd_init(TABLE* table) #ifdef PLAN_HEX_FILE // plan serialization - ifstream ifs("/tmp/li1-plan.hex"); + string tmpDir = aTmpDir + "/li1-plan.hex"; + + ifstream ifs(tmpDir); ByteStream bs1; ifs >> bs1; ifs.close(); @@ -3982,6 +3984,8 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table) //set up for cpimport std::vector Cmds; std::string aCmdLine(startup::StartUp::installDir()); + std::string aTmpDir(startup::StartUp::tmpDir()); + //If local module type is not PM and Local PM query is set, error out char escapechar[2] = ""; @@ -4390,6 +4394,8 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table) { THD* thd = current_thd; + std::string aTmpDir(startup::StartUp::tmpDir()); + if (!thd->infinidb_vtable.cal_conn_info) thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info()); @@ -4516,7 +4522,7 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table) rc = 1; ifstream dmlFile; ostringstream oss; - oss << "/tmp/" << ci->tableOid << ".txt"; + oss << aTmpDir << ci->tableOid << ".txt"; dmlFile.open(oss.str().c_str()); if (dmlFile.is_open()) @@ -4533,7 +4539,7 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table) rc = 1; ifstream dmlFile; ostringstream oss; - oss << "/tmp/" << ci->tableOid << ".txt"; + oss << aTmpDir << ci->tableOid << ".txt"; dmlFile.open(oss.str().c_str()); if (dmlFile.is_open()) @@ -4567,7 +4573,7 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table) //get extra warning count if any ifstream dmlFile; ostringstream oss; - oss << "/tmp/" << ci->tableOid << ".txt"; + oss << aTmpDir << ci->tableOid << ".txt"; dmlFile.open(oss.str().c_str()); int totalWarnCount = 0; int colWarns = 0; @@ -5235,7 +5241,9 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE #ifdef PLAN_HEX_FILE // plan serialization - ifstream ifs("/tmp/li1-plan.hex"); + string tmpDir = aTmpDir + "/li1-plan.hex"; + + ifstream ifs(tmpDir); ByteStream bs1; ifs >> bs1; ifs.close(); diff --git a/dbcon/mysql/install_calpont_mysql.sh b/dbcon/mysql/install_calpont_mysql.sh index 259e2d182..1080e69bc 100755 --- a/dbcon/mysql/install_calpont_mysql.sh +++ b/dbcon/mysql/install_calpont_mysql.sh @@ -17,6 +17,8 @@ for arg in "$@"; do elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then installdir="`echo $arg | awk -F= '{print $2}'`" prefix=`dirname $installdir` + elif [ `expr -- "$arg" : '--tmpdir='` -eq 9 ]; then + tmpdir="`echo $arg | awk -F= '{print $2}'`" else echo "ignoring unknown argument: $arg" 1>&2 fi @@ -24,7 +26,7 @@ done df=$installdir/mysql/my.cnf -$installdir/mysql/bin/mysql --defaults-extra-file=$df --force --user=root mysql 2>/tmp/mysql_install.log < ${tmpdir}mysql_install.log <8G --> - rdwrscratch + /rdwrscratch /columnstore_tmp_files diff --git a/oam/install_scripts/post-mysql-install b/oam/install_scripts/post-mysql-install index 9163c3833..215f7d695 100755 --- a/oam/install_scripts/post-mysql-install +++ b/oam/install_scripts/post-mysql-install @@ -7,7 +7,7 @@ # check log for error checkForError() { # check for password error - grep "ERROR 1045" /tmp/mysql_install.log > /tmp/error.check + grep "ERROR 1045" ${tmpdir}/mysql_install.log > /tmp/error.check if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then echo "MySQL Password file missing or incorrect, check .my.cnf file" rm -f /tmp/error.check @@ -55,6 +55,8 @@ for arg in "$@"; do elif [ $(expr -- "$arg" : '--installdir=') -eq 13 ]; then installdir="$(echo $arg | awk -F= '{print $2}')" prefix=$(dirname $installdir) + elif [ $(expr -- "$arg" : '--tmpdir=') -eq 9 ]; then + tmpdir="$(echo $arg | awk -F= '{print $2}')" else echo "ignoring unknown argument: $arg" 1>&2 fi @@ -100,11 +102,11 @@ if [ -x $installdir/mysql/mysql-Columnstore ]; then sleep 5 # Install various Calpont stuff... - $installdir/mysql/install_calpont_mysql.sh --installdir=$installdir + $installdir/mysql/install_calpont_mysql.sh --installdir=$installdir --tmpdir=$tmpdir checkForError if [ $? -ne 0 ]; then # retry - $installdir/mysql/install_calpont_mysql.sh --installdir=$installdir + $installdir/mysql/install_calpont_mysql.sh --installdir=$installdir --tmpdir=$tmpdir checkForError if [ $? -ne 0 ]; then echo "ERROR: Invalid password in .my.cnf, or Columnstore plugin install missing" diff --git a/oamapps/postConfigure/helpers.cpp b/oamapps/postConfigure/helpers.cpp index f7d418144..0392979ee 100644 --- a/oamapps/postConfigure/helpers.cpp +++ b/oamapps/postConfigure/helpers.cpp @@ -35,6 +35,10 @@ using namespace oam; #include "helpers.h" +using namespace installer; + +#include "installdir.h" + extern string mysqlpw; string pwprompt = " "; @@ -45,6 +49,7 @@ string prompt; const char* pcommand = 0; extern string installDir; + extern bool noPrompting; namespace installer @@ -247,12 +252,15 @@ void mysqlSetup() { Oam oam; string cmd; - cmd = installDir + "/bin/post-mysqld-install --installdir=" + installDir + " > /tmp/post-mysqld-install.log 2>&1"; + + string tmpDir = startup::StartUp::tmpDir(); + + cmd = installDir + "/bin/post-mysqld-install --installdir=" + installDir + " > " + tmpDir + "/post-mysqld-install.log 2>&1"; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) { - cout << "Error running post-mysqld-install, check /tmp/post-mysqld-install.log" << endl; + cout << "Error running post-mysqld-install, check " << tmpDir << "/post-mysqld-install.log" << endl; cout << "Exiting..." << endl; exit (1); } @@ -276,7 +284,7 @@ void mysqlSetup() HOME = p; } - cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " > /tmp/post-mysql-install.log";; + cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " --tmpdir=" + tmpDir + " > " + tmpDir + "/post-mysql-install.log"; rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) == 2) @@ -287,7 +295,7 @@ void mysqlSetup() } else if (WEXITSTATUS(rtnCode) == 1) { - cout << "Error running post-mysql-install, /tmp/post-mysql-install.log" << endl; + cout << "Error running post-mysql-install, " + tmpDir + "/post-mysql-install.log" << endl; cout << "Exiting..." << endl; exit (1); } @@ -375,7 +383,9 @@ int sendUpgradeRequest(int IserverTypeInstall, bool pmwithum) if ( returnStatus != API_SUCCESS) { - cout << "ERROR: Error return in running the MariDB Columnstore Upgrade, check /tmp/upgrade*.logs on " << (*pt).DeviceName << endl; + string tmpDir = startup::StartUp::tmpDir(); + + cout << "ERROR: Error return in running the MariDB Columnstore Upgrade, check " + tmpDir + "/upgrade*.logs on " << (*pt).DeviceName << endl; return returnStatus; } } @@ -404,6 +414,8 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm SystemModuleTypeConfig systemmoduletypeconfig; + string tmpDir = startup::StartUp::tmpDir(); + try { oam.getSystemConfig(systemmoduletypeconfig); @@ -478,7 +490,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm if ( returnStatus != API_SUCCESS) { - cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master DB Distribute, check /tmp/master-dist*.logs on " << masterModule << endl; + cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master DB Distribute, check " + tmpDir + "/master-dist*.logs on " << masterModule << endl; return returnStatus; } @@ -491,7 +503,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm if ( returnStatus != API_SUCCESS) { - cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master replication, check /tmp/master-rep*.logs on " << masterModule << endl; + cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Master replication, check " + tmpDir + "master-rep*.logs on " << masterModule << endl; return returnStatus; } @@ -526,7 +538,7 @@ int sendReplicationRequest(int IserverTypeInstall, std::string password, bool pm if ( returnStatus != API_SUCCESS) { - cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Slave replication, check /tmp/slave-rep*.logs on " << (*pt).DeviceName << endl; + cout << endl << "ERROR: Error return in running the MariaDB ColumnStore Slave replication, check " + tmpDir + "/slave-rep*.logs on " << (*pt).DeviceName << endl; return returnStatus; } @@ -728,12 +740,14 @@ void checkMysqlPort( std::string& mysqlPort, Config* sysConfig ) { Oam oam; + string tmpDir = startup::StartUp::tmpDir(); + while (true) { - string cmd = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN > /tmp/mysqlport"; + string cmd = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN > " + tmpDir + "/mysqlport"; system(cmd.c_str()); - string fileName = "/tmp/mysqlport"; + string fileName = tmpDir + "/mysqlport"; ifstream oldFile (fileName.c_str()); if (oldFile) @@ -813,9 +827,11 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string bool inUse = false; + string tmpDir = startup::StartUp::tmpDir(); + while (true) { - string localnetstat = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN > /tmp/mysqlport"; + string localnetstat = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN > " + tmpDir + "/mysqlport"; string remotenetstat = "netstat -na | grep -e :" + mysqlPort + "[[:space:]] | grep LISTEN"; //first check local mysql, if needed @@ -823,7 +839,7 @@ void checkSystemMySQLPort(std::string& mysqlPort, Config* sysConfig, std::string ( ( IserverTypeInstall != oam::INSTALL_COMBINE_DM_UM_PM ) && pmwithum ) ) { system(localnetstat.c_str()); - string fileName = "/tmp/mysqlport"; + string fileName = tmpDir + "/mysqlport"; ifstream oldFile (fileName.c_str()); if (oldFile) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index e146417c9..6ffef9012 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -80,6 +80,7 @@ using namespace config; #include "helpers.h" using namespace installer; +#include "installdir.h" typedef struct DBRoot_Module_struct { @@ -195,6 +196,7 @@ bool amazon_quick_install = false; string DataFileEnvFile; string installDir; +string tmpDir; string HOME = "/root"; extern string pwprompt; @@ -287,7 +289,8 @@ int main(int argc, char* argv[]) if (p && *p) HOME = p; } - + + tmpDir = startup::StartUp::tmpDir(); for ( int i = 1; i < argc; i++ ) { @@ -568,18 +571,20 @@ int main(int argc, char* argv[]) EEPackageType = "binary"; else { - int rtnCode = system("rpm -qi mariadb-columnstore-platform > /tmp/columnstore.txt 2>&1"); + string cmd = "rpm -qi mariadb-columnstore-platform > " + tmpDir + "/columnstore.txt 2>&1"; + int rtnCode = system(cmd.c_str()); + + if (WEXITSTATUS(rtnCode) == 0) + EEPackageType = "rpm"; + else { + string cmd = "dpkg -s mariadb-columnstore-platform > " + tmpDir + "/columnstore.txt 2>&1"; + int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) == 0) - EEPackageType = "rpm"; - else { - rtnCode = system("dpkg -s mariadb-columnstore-platform > /tmp/columnstore.txt 2>&1"); - - if (WEXITSTATUS(rtnCode) == 0) - EEPackageType = "deb"; - else - EEPackageType = "binary"; - } + EEPackageType = "deb"; + else + EEPackageType = "binary"; + } } try { @@ -701,11 +706,11 @@ int main(int argc, char* argv[]) // run my.cnf upgrade script if ( reuseConfig == "y" ) { - cmd = installDir + "/bin/mycnfUpgrade > /tmp/mycnfUpgrade.log 2>&1"; + cmd = installDir + "/bin/mycnfUpgrade > " + tmpDir + "/mycnfUpgrade.log 2>&1"; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) - cout << "Error: Problem upgrade my.cnf, check /tmp/mycnfUpgrade.log" << endl; + cout << "Error: Problem upgrade my.cnf, check " << tmpDir << "/mycnfUpgrade.log" << endl; else cout << "NOTE: my.cnf file was upgraded based on my.cnf.rpmsave" << endl; } @@ -1336,19 +1341,21 @@ int main(int argc, char* argv[]) if (!multi_server_quick_install) { - system("aws --version > /tmp/amazon.log 2>&1"); + string amazonLog = tmpDir + "/amazon.log"; + string cmd = "aws --version > " + amazonLog + " 2>&1"; + int rtnCode = system(cmd.c_str()); - ifstream in("/tmp/amazon.log"); + ifstream in(amazonLog); in.seekg(0, std::ios::end); int size = in.tellg(); - if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not found")) + if ( size == 0 || oam.checkLogStatus(amazonLog, "not found")) { // not running on amazon with ec2-api-tools if (amazon_quick_install) { - cout << "ERROR: Amazon Quick Installer was specified, bu the AMazon CLI API packages isnt installed, exiting" << endl; + cout << "ERROR: Amazon Quick Installer was specified, bu the Amazon CLI API packages isnt installed, exiting" << endl; exit(1); } @@ -1356,7 +1363,7 @@ int main(int argc, char* argv[]) } else { - if ( size == 0 || oam.checkLogStatus("/tmp/amazon.log", "not installed")) + if ( size == 0 || oam.checkLogStatus(amazonLog, "not installed")) { // not running on amazon with ec2-api-tools if (amazon_quick_install) @@ -3614,7 +3621,7 @@ int main(int argc, char* argv[]) if ( remote_installer_debug == "1" ) { - logfile = "/tmp/"; + logfile = tmpDir; logfile += remoteModuleName + "_" + EEPackageType + "_install.log"; debug_logfile = " > " + logfile; } @@ -3921,13 +3928,15 @@ int main(int argc, char* argv[]) if (hdfs && !nonDistribute ) { + string postConfigurePsdhLog = tmpDir + "postConfigure.pdsh.log"; + cout << endl << "----- Starting MariaDB ColumnStore Service on all Modules -----" << endl << endl; - string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > /tmp/postConfigure.pdsh 2>&1"; + string cmd = "pdsh -a '" + installDir + "/bin/columnstore restart' > " + postConfigurePsdhLog + " 2>&1"; system(cmd.c_str()); - if (oam.checkLogStatus("/tmp/postConfigure.pdsh", "exit") ) + if (oam.checkLogStatus(postConfigurePsdhLog, "exit") ) { - cout << endl << "ERROR: Starting MariaDB ColumnStore Service failue, check /tmp/postConfigure.pdsh. exit..." << endl; + cout << endl << "ERROR: Starting MariaDB ColumnStore Service failue, check " + postConfigurePsdhLog + ". exit..." << endl; exit (1); } } @@ -4012,27 +4021,28 @@ int main(int argc, char* argv[]) } } } + + string dbbuilderLog = tmpDir + "dbbuilder.log"; if (hdfs) - cmd = "bash -c '. " + installDir + "/bin/" + DataFileEnvFile + ";" + installDir + "/bin/dbbuilder 7 > /tmp/dbbuilder.log'"; + cmd = "bash -c '. " + installDir + "/bin/" + DataFileEnvFile + ";" + installDir + "/bin/dbbuilder 7 > " + dbbuilderLog; else - cmd = installDir + "/bin/dbbuilder 7 > /tmp/dbbuilder.log"; + cmd = installDir + "/bin/dbbuilder 7 > " + dbbuilderLog; system(cmd.c_str()); - if (oam.checkLogStatus("/tmp/dbbuilder.log", "System Catalog created") ) + if (oam.checkLogStatus(dbbuilderLog, "System Catalog created") ) cout << endl << "System Catalog Successfully Created" << endl; else { - if ( oam.checkLogStatus("/tmp/dbbuilder.log", "System catalog appears to exist") ) + if ( oam.checkLogStatus(dbbuilderLog, "System catalog appears to exist") ) { - cout.flush(); } else { cout << endl << "System Catalog Create Failure" << endl; - cout << "Check latest log file in /tmp/dbbuilder.log.*" << endl; + cout << "Check latest log file in " << dbbuilderLog << endl; cout << " IMPORTANT: Once issue has been resolved, rerun postConfigure" << endl << endl; exit (1); @@ -4622,7 +4632,7 @@ bool createDbrootDirs(string DBRootStorageType) // mount data1 and create directories if configured with storage if ( DBRootStorageType == "external" ) { - string cmd = "mount " + installDir + "/data1 > /tmp/mount.txt 2>&1"; + string cmd = "mount " + installDir + "/data1 > " + tmpDir + "/mount.txt 2>&1"; system(cmd.c_str()); if ( !rootUser) @@ -4655,11 +4665,12 @@ bool pkgCheck(string columnstorePackage) { while (true) { - string cmd = "ls " + columnstorePackage + " > /tmp/calpontpkgs"; + string fileName = tmpDir + "/calpontpkgs"; + + string cmd = "ls " + columnstorePackage + " > " + fileName; system(cmd.c_str()); string pkg = columnstorePackage; - string fileName = "/tmp/calpontpkgs"; ifstream oldFile (fileName.c_str()); if (oldFile) @@ -4770,7 +4781,7 @@ bool storageSetup(bool amazonInstall) cout.flush(); string logdir("/var/log/mariadb/columnstore"); - if (access(logdir.c_str(), W_OK) != 0) logdir = "/tmp"; + if (access(logdir.c_str(), W_OK) != 0) logdir = tmpDir; string hdfslog = logdir + "/hdfsCheck.log1"; @@ -5087,7 +5098,8 @@ bool storageSetup(bool amazonInstall) //check if gluster is installed int rtnCode = 1; - rtnCode = system("gluster --version > /tmp/gluster.log 2>&1"); + string cmd = "gluster --version > " + tmpDir + "/gluster.log 2>&1"; + rtnCode = system(cmd.c_str()); if (rtnCode == 0) { @@ -5099,14 +5111,17 @@ bool storageSetup(bool amazonInstall) } //check if hadoop is installed - system("which hadoop > /tmp/hadoop.log 2>&1"); + string hadoopLog = tmpDir + "/hadoop.log"; + + cmd = "which hadoop > " + hadoopLog + " 2>&1"; + system(cmd.c_str()); - ifstream in("/tmp/hadoop.log"); + ifstream in(hadoopLog); in.seekg(0, std::ios::end); int size = in.tellg(); - if ( size == 0 || oam.checkLogStatus("/tmp/hadoop.log", "no hadoop")) + if ( size == 0 || oam.checkLogStatus(hadoopLog, "no hadoop")) // no hadoop size = 0; else @@ -5577,7 +5592,7 @@ bool storageSetup(bool amazonInstall) cout.flush(); string logdir("/var/log/mariadb/columnstore"); - if (access(logdir.c_str(), W_OK) != 0) logdir = "/tmp"; + if (access(logdir.c_str(), W_OK) != 0) logdir = tmpDir; string hdfslog = logdir + "/hdfsCheck.log1"; @@ -6116,14 +6131,14 @@ void remoteInstallThread(void* arg) { //failure pthread_mutex_lock(&THREAD_LOCK); - cout << endl << "Failure with a remote module install, check install log files in /tmp" << endl; + cout << endl << "Failure with a remote module install, check install log files in " << tmpDir << endl; exit(1); } } } pthread_mutex_lock(&THREAD_LOCK); - cout << endl << "Failure with a remote module install, check install log files in /tmp" << endl; + cout << endl << "Failure with a remote module install, check install log files in " << tmpDir << endl; exit(1); } @@ -6680,8 +6695,10 @@ bool glusterSetup(string password) } sleep(5); + + string glusterCommandsLog = tmpDir + "/glusterCommands.log"; - command = "gluster peer status >> /tmp/glusterCommands.txt 2>&1"; + command = "gluster peer status " + glusterCommandsLog + "2>&1"; status = system(command.c_str()); @@ -6717,13 +6734,13 @@ bool glusterSetup(string password) pmnextbrick[pm]++; } - command += "force >> /tmp/glusterCommands.txt 2>&1"; + command += "force >> " + glusterCommandsLog + " 2>&1"; cout << "Gluster create and start volume dbroot" << oam.itoa(dbrootID) << "..."; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 ) { - if (oam.checkLogStatus("/tmp/glusterCommands.txt", "dbroot" + oam.itoa(dbrootID) + " already exists" )) + if (oam.checkLogStatus(glusterCommandsLog, "dbroot" + oam.itoa(dbrootID) + " already exists" )) { string errmsg1; string errmsg2; @@ -6752,7 +6769,7 @@ bool glusterSetup(string password) if (rootUser) { - command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1"; + command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> " + glusterCommandsLog + " 2>&1"; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 ) @@ -6765,7 +6782,7 @@ bool glusterSetup(string password) { int user = getuid(); int group = getgid(); - command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-uid " + oam.itoa(user) + " >> /tmp/glusterCommands.txt 2>&1";; + command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-uid " + oam.itoa(user) + " >> " + glusterCommandsLog + " 2>&1"; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 ) @@ -6774,7 +6791,7 @@ bool glusterSetup(string password) exit(1); } - command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-gid " + oam.itoa(group) + " >> /tmp/glusterCommands.txt 2>&1";; + command = "gluster volume set dbroot" + oam.itoa(dbrootID) + " storage.owner-gid " + oam.itoa(group) + " >> " + glusterCommandsLog + " 2>&1"; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 ) @@ -6783,7 +6800,7 @@ bool glusterSetup(string password) exit(1); } - command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> /tmp/glusterCommands.txt 2>&1"; + command = "gluster volume start dbroot" + oam.itoa(dbrootID) + " >> " + glusterCommandsLog + " 2>&1"; status = system(command.c_str()); if (WEXITSTATUS(status) != 0 )