1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00
This commit is contained in:
David Hill
2018-09-21 10:40:05 -05:00
parent 455776ed49
commit 4e6e5647ef
11 changed files with 62 additions and 37 deletions

View File

@ -34,6 +34,7 @@
#include "configcpp.h" #include "configcpp.h"
#include "calpontselectexecutionplan.h" #include "calpontselectexecutionplan.h"
#include "resourcedistributor.h" #include "resourcedistributor.h"
#include "installdir.h"
#include "atomicops.h" #include "atomicops.h"
@ -82,7 +83,7 @@ const uint32_t defaultProcessorThreadsPerScan = 16;
const uint32_t defaultJoinerChunkSize = 16 * 1024 * 1024; const uint32_t defaultJoinerChunkSize = 16 * 1024 * 1024;
//bucketreuse //bucketreuse
const std::string defaultTempDiskPath = "/var/tmp"; const std::string defaultTempDiskPath = "/tmp";
const std::string defaultWorkingDir = "."; //"/tmp"; const std::string defaultWorkingDir = "."; //"/tmp";
//largedatalist //largedatalist
@ -282,7 +283,7 @@ public:
std::string getScTempDiskPath() const std::string getScTempDiskPath() const
{ {
return getStringVal(fSystemConfigStr, "TempDiskPath", defaultTempDiskPath ); return startup::StartUp::tmpDir();
} }
uint64_t getScTempSaveSize() const uint64_t getScTempSaveSize() const
{ {
@ -290,7 +291,7 @@ public:
} }
std::string getScWorkingDir() const std::string getScWorkingDir() const
{ {
return getStringVal(fSystemConfigStr, "WorkingDir", defaultWorkingDir ); return startup::StartUp::tmpDir();
} }
uint32_t getTwMaxSize() const uint32_t getTwMaxSize() const

View File

@ -62,6 +62,8 @@ using namespace execplan;
#include "utils_utf8.h" #include "utils_utf8.h"
#include "crashtrace.h" #include "crashtrace.h"
#include "installdir.h"
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
@ -71,7 +73,7 @@ DistributedEngineComm* Dec;
void setupCwd() void setupCwd()
{ {
string workdir = config::Config::makeConfig()->getConfig("SystemConfig", "WorkingDir"); string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0) if (workdir.length() == 0)
workdir = "."; workdir = ".";

View File

@ -83,6 +83,7 @@ using namespace joblist;
#include "utils_utf8.h" #include "utils_utf8.h"
#include "crashtrace.h" #include "crashtrace.h"
#include "installdir.h"
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
@ -493,7 +494,7 @@ void rollbackAll(DBRM* dbrm)
void setupCwd() void setupCwd()
{ {
string workdir = Config::makeConfig()->getConfig("SystemConfig", "WorkingDir"); string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0) if (workdir.length() == 0)
workdir = "."; workdir = ".";

View File

@ -47,6 +47,8 @@ const int RESOURCE_DEBUG = false;
static unsigned int usage[LOG_FREQ / MONITOR_FREQ]; static unsigned int usage[LOG_FREQ / MONITOR_FREQ];
static int usageCount = 0; static int usageCount = 0;
extern string tmpDir;
/***************************************************************************************** /*****************************************************************************************
* @brief cpuMonitor Thread * @brief cpuMonitor Thread
* *
@ -519,9 +521,12 @@ void ServerMonitor::getCPUdata()
{ {
pcl.clear(); pcl.clear();
system("top -b -n1 | head -12 | awk '{print $9,$12}' | tail -5 > /tmp/columnstore_tmp_files/processCpu"); string tmpProcessCpu = tmpDir + "/processCpu";
ifstream oldFile1 ("/tmp/columnstore_tmp_files/processCpu"); string cmd = "top -b -n1 | head -12 | awk '{print $9,$12}' | tail -5 > " + tmpProcessCpu;
system(cmd.c_str());
ifstream oldFile1 (tmpProcessCpu);
// read top 5 users // read top 5 users
int i = 0; int i = 0;
@ -547,9 +552,14 @@ void ServerMonitor::getCPUdata()
// //
// get and check Total CPU usage // get and check Total CPU usage
// //
system("top -b -n 6 -d 1 | awk '{print $5}' | grep %id > /tmp/columnstore_tmp_files/systemCpu");
ifstream oldFile ("/tmp/columnstore_tmp_files/systemCpu");
string tmpsystemCpu = tmpDir + "/processCpu";
cmd = "top -b -n 6 -d 1 | awk '{print $5}' | grep %id > " + tmpsystemCpu;
system(cmd.c_str());
ifstream oldFile (tmpsystemCpu);
float systemIdle = 0; float systemIdle = 0;
// skip first line in file, and average the next 5 entries which contains idle times // skip first line in file, and average the next 5 entries which contains idle times

View File

@ -31,6 +31,8 @@ using namespace logging;
using namespace servermonitor; using namespace servermonitor;
//using namespace procheartbeat; //using namespace procheartbeat;
extern string tmpDir;
/************************************************************************************************************ /************************************************************************************************************
* @brief hardwareMonitor function * @brief hardwareMonitor function
@ -72,7 +74,10 @@ void hardwareMonitor(int IPMI_SUPPORT)
if ( IPMI_SUPPORT == 0) if ( IPMI_SUPPORT == 0)
{ {
int returnCode = system("ipmitool sensor list > /tmp/harwareMonitor.txt"); string tmpharwareMonitor = tmpDir + "/harwareMonitor.txt";
string cmd = "ipmitool sensor list > > " + tmpharwareMonitor;
int returnCode = system(cmd.c_str());
if (returnCode) if (returnCode)
{ {
@ -128,7 +133,7 @@ void hardwareMonitor(int IPMI_SUPPORT)
{ {
// parse output file // parse output file
ifstream File ("/tmp/harwareMonitor.txt"); ifstream File (tmpharwareMonitor);
if (!File) if (!File)
{ {
@ -137,7 +142,7 @@ void hardwareMonitor(int IPMI_SUPPORT)
MessageLog ml(lid); MessageLog ml(lid);
Message msg; Message msg;
Message::Args args; Message::Args args;
args.add("Error opening /tmp/harwareMonitor.txt!!!"); args.add("Error opening harwareMonitor.txt!!!");
msg.format(args); msg.format(args);
ml.logWarningMessage(msg); ml.logWarningMessage(msg);
sleep(300); sleep(300);

View File

@ -19,6 +19,7 @@
#include "serverMonitor.h" #include "serverMonitor.h"
#include "crashtrace.h" #include "crashtrace.h"
#include "installdir.h"
using namespace std; using namespace std;
using namespace servermonitor; using namespace servermonitor;
@ -27,6 +28,8 @@ using namespace logging;
extern int swapFlag; extern int swapFlag;
string tmpDir;
/***************************************************************************** /*****************************************************************************
* @brief main * @brief main
* *
@ -40,6 +43,11 @@ int main (int argc, char** argv)
ServerMonitor serverMonitor; ServerMonitor serverMonitor;
Oam oam; Oam oam;
string TempFileDir;
oam.getSystemConfig("TempFileDir", TempFileDir);
tmpDir = startup::StartUp::tmpDir() + TempFileDir;
struct sigaction ign; struct sigaction ign;
memset(&ign, 0, sizeof(ign)); memset(&ign, 0, sizeof(ign));

View File

@ -39,6 +39,8 @@ uint64_t totalMem;
pthread_mutex_t MEMORY_LOCK; pthread_mutex_t MEMORY_LOCK;
extern string tmpDir;
/***************************************************************************************** /*****************************************************************************************
* @brief memoryMonitor Thread * @brief memoryMonitor Thread
* *
@ -500,9 +502,12 @@ void ServerMonitor::outputProcMemory(bool log)
// get top 5 Memory users by process // get top 5 Memory users by process
// //
system("ps -e -orss=1,args= | sort -b -k1,1n |tail -n 5 | awk '{print $1,$2}' > /tmp/columnstore_tmp_files/processMem"); string tmpprocessMem = tmpDir + "/processMem";
ifstream oldFile ("/tmp/columnstore_tmp_files/processMem"); string cmd = "ps -e -orss=1,args= | sort -b -k1,1n |tail -n 5 | awk '{print $1,$2}' > " + tmpprocessMem;
system(cmd.c_str());
ifstream oldFile (tmpprocessMem);
string process; string process;
long long memory; long long memory;

View File

@ -39,6 +39,8 @@ extern ProcessMemoryList pml;
extern pthread_mutex_t CPU_LOCK; extern pthread_mutex_t CPU_LOCK;
extern pthread_mutex_t MEMORY_LOCK; extern pthread_mutex_t MEMORY_LOCK;
extern string tmpDir;
/** /**
* constants define * constants define
*/ */
@ -252,9 +254,12 @@ void msgProcessor()
ByteStream ackmsg; ByteStream ackmsg;
// get cache MEMORY stats // get cache MEMORY stats
system("cat /proc/meminfo | grep Cached -m 1 | awk '{print $2}' > /tmp/cached"); string tmpcached = tmpDir + "/cached";
ifstream oldFile ("/tmp/cached"); string cmd = "cat /proc/meminfo | grep Cached -m 1 | awk '{print $2}' > " + tmpcached;
system(cmd.c_str());
ifstream oldFile (tmpcached);
string strCache; string strCache;
long long cache; long long cache;

View File

@ -72,6 +72,7 @@ using namespace idbdatafile;
#include "cgroupconfigurator.h" #include "cgroupconfigurator.h"
#include "crashtrace.h" #include "crashtrace.h"
#include "installdir.h"
namespace primitiveprocessor namespace primitiveprocessor
{ {
@ -147,7 +148,7 @@ void setupSignalHandlers()
void setupCwd(Config* cf) void setupCwd(Config* cf)
{ {
string workdir = cf->getConfig("SystemConfig", "WorkingDir"); string workdir = startup::StartUp::tmpDir();
if (workdir.length() == 0) if (workdir.length() == 0)
workdir = "."; workdir = ".";

View File

@ -34,6 +34,9 @@
#include "utils_utf8.h" #include "utils_utf8.h"
#endif #endif
#include "installdir.h"
using namespace std; using namespace std;
namespace idbdatafile namespace idbdatafile
@ -213,23 +216,8 @@ void IDBPolicy::configIDBPolicy()
} }
// Directory in which to place file buffer temporary files. // Directory in which to place file buffer temporary files.
string hdfsRdwrScratch = cf->getConfig("SystemConfig", "hdfsRdwrScratch"); string tmpDir = startup::StartUp::tmpDir();
string hdfsRdwrScratch = tmpDir + "/rdwrscratch";
if ( hdfsRdwrScratch.length() == 0 )
{
string tmpPath = cf->getConfig("SystemConfig", "TempDiskPath");
if ( tmpPath.length() == 0 )
{
hdfsRdwrScratch = "/tmp/hdfsscratch";
}
else
{
hdfsRdwrScratch = tmpPath;
hdfsRdwrScratch += "/hdfsscratch";
}
}
IDBPolicy::init( idblog, bUseRdwrMemBuffer, hdfsRdwrScratch, hdfsRdwrBufferMaxSize ); IDBPolicy::init( idblog, bUseRdwrMemBuffer, hdfsRdwrScratch, hdfsRdwrBufferMaxSize );

View File

@ -1418,8 +1418,7 @@ std::string WECmdArgs::getTmpFileDir()
{ {
if (!fTmpFileDir.empty()) return fTmpFileDir; if (!fTmpFileDir.empty()) return fTmpFileDir;
fTmpFileDir = config::Config::makeConfig()->getConfig("SystemConfig", fTmpFileDir = startup::StartUp::tmpDir() + "columnstore_tmp_files";
"TempFileDir");
if (fTmpFileDir.empty()) if (fTmpFileDir.empty())
throw( runtime_error("Config ERROR: TmpFileDir not found!!")); throw( runtime_error("Config ERROR: TmpFileDir not found!!"));