1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-1149 - add a main resume flag

This commit is contained in:
david hill
2018-01-10 11:41:44 -06:00
parent 45e054d77f
commit 44989fbd74

View File

@ -26,6 +26,8 @@ namespace bi=boost::interprocess;
#include "IDBPolicy.h"
#include "crashtrace.h"
using namespace std;
using namespace messageqcpp;
using namespace processmonitor;
@ -55,9 +57,11 @@ void updateShareMemory(processStatusList* aPtr);
bool runStandby = false;
bool processInitComplete = false;
bool rootUser = true;
bool mainResumeFlag;
string USER = "root";
string PMwithUM = "n";
//extern std::string gOAMParentModuleName;
extern bool gOAMParentModuleFlag;
@ -75,6 +79,14 @@ int main(int argc, char **argv)
setuid(0); // set effective ID to root; ignore return status
#endif
struct sigaction ign;
memset(&ign, 0, sizeof(ign));
ign.sa_handler = fatalHandler;
sigaction(SIGSEGV, &ign, 0);
sigaction(SIGABRT, &ign, 0);
sigaction(SIGFPE, &ign, 0);
if (argc > 1 && string(argv[1]) == "--daemon")
{
if (fork() != 0) return 0;
@ -435,13 +447,24 @@ int main(int argc, char **argv)
unlink ("/var/log/mariadb/columnstore/activeAlarms");
}
//Clear mainResumeFlag
mainResumeFlag = false;
//launch Status table control thread on 'pm' modules
pthread_t statusThread;
int ret = pthread_create (&statusThread, NULL, (void*(*)(void*)) &statusControlThread, NULL);
if ( ret != 0 )
log.writeLog(__LINE__, "pthread_create failed, return code = " + oam.itoa(ret), LOG_TYPE_ERROR);
sleep(6); // give the Status thread time to fully initialize
//wait for flag to be set
while(!mainResumeFlag)
{
log.writeLog(__LINE__, "WATING FOR mainResumeFlag to be set", LOG_TYPE_DEBUG);
sleep(1);
}
}
SystemStatus systemstatus;
@ -723,6 +746,8 @@ int main(int argc, char **argv)
}
}
log.writeLog(__LINE__, "SYSTEM STATUS = " + oam.itoa(systemstatus.SystemOpState), LOG_TYPE_DEBUG);
if ( systemstatus.SystemOpState != MAN_OFFLINE && !DISABLED) {
// Loop through the process list to check the process current state
@ -2026,6 +2051,10 @@ static void statusControlThread()
log.writeLog(__LINE__, "Dbroot Status shared Memory allociated and Initialized", LOG_TYPE_DEBUG);
}
//Set mainResumeFlag, to start up main thread
mainResumeFlag = true;
string portName = "ProcStatusControl";
if (runStandby) {
portName = "ProcStatusControlStandby";