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

Merge branch 'develop' into MCOL-4841

# Conflicts:
#	exemgr/main.cpp
#	oam/etc/Columnstore.xml.singleserver
#	primitives/primproc/primproc.cpp
This commit is contained in:
david.hall
2022-06-09 10:07:26 -05:00
523 changed files with 32140 additions and 8380 deletions

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2014 InfiniDB, Inc.
Copyright (C) 2016 MariaDB Corporation
Copyright (C) 2016-2022 MariaDB Corporation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -30,22 +30,20 @@
#endif
#include <csignal>
#include <sys/time.h>
#ifndef _MSC_VER
#include <sys/resource.h>
#include <tr1/unordered_set>
#else
#include <unordered_set>
#endif
#include <clocale>
#include <iterator>
#include <algorithm>
#include <thread>
#include <mutex>
#include <condition_variable>
//#define NDEBUG
#include <cassert>
using namespace std;
#include <boost/thread.hpp>
#include <boost/regex.hpp>
#include <boost/tokenizer.hpp>
using namespace boost;
#include "configcpp.h"
@ -74,8 +72,9 @@ using namespace idbdatafile;
#include "mariadb_my_sys.h"
#include "spinlock.h"
#include "service.h"
#include "threadnaming.h"
#include "serviceexemgr.h"
class Opt
{
@ -118,6 +117,14 @@ class ServicePrimProc : public Service, public Opt
{
return m_fg ? Child() : RunForking();
}
std::atomic_flag& getStartupRaceFlag()
{
return startupRaceFlag_;
}
private:
// Since C++20 flag's init value is false.
std::atomic_flag startupRaceFlag_{false};
};
namespace primitiveprocessor
@ -155,28 +162,11 @@ int toInt(const string& val)
void setupSignalHandlers()
{
#ifndef _MSC_VER
signal(SIGHUP, SIG_IGN);
struct sigaction ign;
memset(&ign, 0, sizeof(ign));
ign.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &ign, 0);
memset(&ign, 0, sizeof(ign));
ign.sa_handler = SIG_IGN;
sigaction(SIGUSR1, &ign, 0);
memset(&ign, 0, sizeof(ign));
ign.sa_handler = SIG_IGN;
sigaction(SIGUSR2, &ign, 0);
memset(&ign, 0, sizeof(ign));
ign.sa_handler = fatalHandler;
sigaction(SIGSEGV, &ign, 0);
sigaction(SIGABRT, &ign, 0);
sigaction(SIGFPE, &ign, 0);
sigset_t sigset;
sigemptyset(&sigset);
sigaddset(&sigset, SIGPIPE);
@ -387,6 +377,18 @@ int ServicePrimProc::Child()
NotifyServiceInitializationFailed();
return 2;
}
utils::USpaceSpinLock startupRaceLock(getStartupRaceFlag());
std::thread exeMgrThread(
[this, cf]()
{
exemgr::Opt opt;
exemgr::globServiceExeMgr = new exemgr::ServiceExeMgr(opt, cf);
// primitive delay to avoid 'not connected to PM' log error messages
// from EM. PrimitiveServer::start() releases SpinLock after sockets
// are available.
utils::USpaceSpinLock startupRaceLock(this->getStartupRaceFlag());
exemgr::globServiceExeMgr->Child();
});
int serverThreads = 1;
int serverQueueSize = 10;
@ -400,7 +402,6 @@ int ServicePrimProc::Child()
bool rotatingDestination = false;
uint32_t deleteBlocks = 128;
bool PTTrace = false;
int temp;
string strTemp;
int priority = -1;
const string primitiveServers("PrimitiveServers");
@ -419,7 +420,7 @@ int ServicePrimProc::Child()
gDebugLevel = primitiveprocessor::NONE;
temp = toInt(cf->getConfig(primitiveServers, "ServerThreads"));
int temp = toInt(cf->getConfig(primitiveServers, "ServerThreads"));
if (temp > 0)
serverThreads = temp;
@ -602,7 +603,6 @@ int ServicePrimProc::Child()
if (temp >= 0)
maxPct = temp;
// @bug4507, configurable pm aggregation AggregationMemoryCheck
// We could use this same mechanism for other growing buffers.
int aggPct = 95;
temp = toInt(cf->getConfig("SystemConfig", "MemoryCheckPercent"));
@ -766,7 +766,7 @@ int ServicePrimProc::Child()
}
#endif
server.start(this);
server.start(this, startupRaceLock);
cerr << "server.start() exited!" << endl;
@ -787,4 +787,3 @@ int main(int argc, char** argv)
return ServicePrimProc(opt).Run();
}
// vim:ts=4 sw=4: