From f17c2e1820dd4379af8b52f82519ea9bb38aaa0c Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 27 Jul 2017 10:26:43 -0500 Subject: [PATCH] MCOL-787 - merged code from 1.0.10 --- procmgr/processmanager.cpp | 11 ++++++++--- procmon/processmonitor.cpp | 31 +++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index 63b232638..dffcfbc25 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -6955,9 +6955,14 @@ void startSystemThread(oam::DeviceNetworkList Devicenetworklist) processManager.setSystemState(rtn); } - //run command to build system table if they don't already exist - processManager.buildSystemTables("pm1"); - + //run command to build system table if they don't already exist + sleep(5); + int ret = processManager.buildSystemTables("pm1"); + if (ret == oam::API_SUCCESS ) + log.writeLog(__LINE__, "System Catalog Successfully Built by ProcMgr", LOG_TYPE_DEBUG); + else + log.writeLog(__LINE__, "System Catalog Successfully not built by ProcMgr, ret code = " + oam.itoa(ret), LOG_TYPE_DEBUG); + // exit thread log.writeLog(__LINE__, "startSystemThread Exit", LOG_TYPE_DEBUG); startsystemthreadStatus = status; diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index 74f846929..4ee884f89 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -3527,17 +3527,28 @@ int ProcessMonitor::buildSystemTables() string fileName = DBdir + "/000.dir"; - if (!IDBPolicy::exists(fileName.c_str())) { - string logdir("/var/log/mariadb/columnstore"); - if (access(logdir.c_str(), W_OK) != 0) logdir = "/tmp"; - string cmd = startup::StartUp::installDir() + "/bin/dbbuilder 7 > " + logdir + "/dbbuilder.log &"; - system(cmd.c_str()); + //check if postConfigure or dbbuilder is already running + string cmd = "ps aux | grep postConfigure | grep -v grep"; + int rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) == 0) + return API_ALREADY_IN_PROGRESS; - log.writeLog(__LINE__, "buildSystemTables: dbbuilder 7 Successfully Launched" , LOG_TYPE_DEBUG); - return API_SUCCESS; - } - log.writeLog(__LINE__, "buildSystemTables: System Tables Already Exist", LOG_TYPE_ERROR ); - return API_FILE_ALREADY_EXIST; + cmd = "ps aux | grep dbbuilder | grep -v grep"; + rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) == 0) + return API_ALREADY_IN_PROGRESS; + + if (!IDBPolicy::exists(fileName.c_str())) { + string logdir("/var/log/mariadb/columnstore"); + if (access(logdir.c_str(), W_OK) != 0) logdir = "/tmp"; + string cmd = startup::StartUp::installDir() + "/bin/dbbuilder 7 > " + logdir + "/dbbuilder.log &"; + system(cmd.c_str()); + + log.writeLog(__LINE__, "buildSystemTables: dbbuilder 7 Successfully Launched" , LOG_TYPE_DEBUG); + return API_SUCCESS; + } + log.writeLog(__LINE__, "buildSystemTables: System Tables Already Exist", LOG_TYPE_DEBUG ); + return API_FILE_ALREADY_EXIST; } /******************************************************************************************