You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
chore(codestyle): mark virtual methods as override
This commit is contained in:
committed by
Leonid Fedorov
parent
6001db44ab
commit
5556d818f8
@ -31,7 +31,7 @@
|
||||
#include "fileblockrequestqueue.h"
|
||||
#include "filebuffermgr.h"
|
||||
#include "iomanager.h"
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
@author Jason Rodriguez <jrodriguez@calpont.com>
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
@ -35,9 +35,7 @@ class ActiveStatementCounter
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ActiveStatementCounter()
|
||||
{
|
||||
}
|
||||
virtual ~ActiveStatementCounter() = default;
|
||||
|
||||
void incr(bool& counted);
|
||||
void decr(bool& counted);
|
||||
@ -61,4 +59,3 @@ class ActiveStatementCounter
|
||||
boost::condition condvar;
|
||||
BRM::VSS fVss;
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ typedef boost::shared_ptr<BatchPrimitiveProcessor> SBPP;
|
||||
|
||||
class scalar_exception : public std::exception
|
||||
{
|
||||
const char* what() const throw()
|
||||
const char* what() const noexcept override
|
||||
{
|
||||
return "Not a scalar subquery.";
|
||||
}
|
||||
@ -231,7 +231,7 @@ class BatchPrimitiveProcessor
|
||||
/* Common space for primitive data */
|
||||
alignas(utils::MAXCOLUMNWIDTH) uint8_t blockData[BLOCK_SIZE * utils::MAXCOLUMNWIDTH];
|
||||
uint8_t blockDataAux[BLOCK_SIZE * execplan::AUX_COL_WIDTH];
|
||||
std::unique_ptr<uint8_t[], utils::AlignedDeleter> outputMsg;
|
||||
std::unique_ptr<uint8_t[], utils::AlignedDeleter> outputMsg;
|
||||
uint32_t outMsgSize;
|
||||
|
||||
std::vector<SCommand> filterSteps;
|
||||
|
@ -46,13 +46,14 @@ namespace primitiveprocessor
|
||||
class BPPSeeder : public threadpool::FairThreadPool::Functor
|
||||
{
|
||||
public:
|
||||
BPPSeeder() = delete;
|
||||
BPPSeeder(const messageqcpp::SBS&, const SP_UM_MUTEX& wLock, const SP_UM_IOSOCK& ios, const int pmThreads,
|
||||
const bool trace = false);
|
||||
BPPSeeder(const BPPSeeder& b);
|
||||
|
||||
virtual ~BPPSeeder();
|
||||
~BPPSeeder() override;
|
||||
|
||||
int operator()();
|
||||
int operator()() override;
|
||||
|
||||
bool isSysCat();
|
||||
boost::shared_ptr<std::ofstream> spof;
|
||||
@ -74,7 +75,6 @@ class BPPSeeder : public threadpool::FairThreadPool::Functor
|
||||
}
|
||||
|
||||
private:
|
||||
BPPSeeder();
|
||||
void catchHandler(const std::string& s, uint32_t uniqueID, uint32_t step);
|
||||
void flushSyscatOIDs();
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <queue>
|
||||
#include <set>
|
||||
#include <condition_variable>
|
||||
#include <utility>
|
||||
#include "threadnaming.h"
|
||||
#include "fair_threadpool.h"
|
||||
|
||||
@ -49,19 +50,10 @@ class BPPSendThread
|
||||
Msg_t() : sockIndex(0)
|
||||
{
|
||||
}
|
||||
Msg_t(const Msg_t& m) : msg(m.msg), sock(m.sock), sockLock(m.sockLock), sockIndex(m.sockIndex)
|
||||
{
|
||||
}
|
||||
Msg_t& operator=(const Msg_t& m)
|
||||
{
|
||||
msg = m.msg;
|
||||
sock = m.sock;
|
||||
sockLock = m.sockLock;
|
||||
sockIndex = m.sockIndex;
|
||||
return *this;
|
||||
}
|
||||
Msg_t(const messageqcpp::SBS& m, const SP_UM_IOSOCK& so, const SP_UM_MUTEX& sl, int si)
|
||||
: msg(m), sock(so), sockLock(sl), sockIndex(si)
|
||||
Msg_t(const Msg_t& m) = default;
|
||||
Msg_t& operator=(const Msg_t& m) = default;
|
||||
Msg_t(messageqcpp::SBS m, SP_UM_IOSOCK so, SP_UM_MUTEX sl, int si)
|
||||
: msg(std::move(m)), sock(std::move(so)), sockLock(std::move(sl)), sockIndex(si)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -87,7 +79,7 @@ class BPPSendThread
|
||||
}
|
||||
void setProcessorPool(boost::shared_ptr<threadpool::FairThreadPool> processorPool)
|
||||
{
|
||||
fProcessorPool = processorPool;
|
||||
fProcessorPool = std::move(processorPool);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -127,7 +119,7 @@ class BPPSendThread
|
||||
/* Load balancing structures */
|
||||
struct Connection_t
|
||||
{
|
||||
Connection_t(const SP_UM_MUTEX& lock, const SP_UM_IOSOCK& so) : sockLock(lock), sock(so)
|
||||
Connection_t(SP_UM_MUTEX lock, SP_UM_IOSOCK so) : sockLock(std::move(lock)), sock(std::move(so))
|
||||
{
|
||||
}
|
||||
SP_UM_MUTEX sockLock;
|
||||
|
@ -45,9 +45,9 @@ class ColumnCommand : public Command
|
||||
public:
|
||||
ColumnCommand();
|
||||
ColumnCommand(execplan::CalpontSystemCatalog::ColType& aColType);
|
||||
virtual ~ColumnCommand();
|
||||
~ColumnCommand() override;
|
||||
|
||||
inline uint64_t getLBID()
|
||||
inline uint64_t getLBID() override
|
||||
{
|
||||
return lbid;
|
||||
}
|
||||
@ -68,12 +68,12 @@ class ColumnCommand : public Command
|
||||
return colType;
|
||||
}
|
||||
|
||||
void execute();
|
||||
void execute() override;
|
||||
void execute(int64_t* vals); // used by RTSCommand to redirect values
|
||||
virtual void prep(int8_t outputType, bool absRids);
|
||||
void project();
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t pos);
|
||||
void nextLBID();
|
||||
void prep(int8_t outputType, bool absRids) override;
|
||||
void project() override;
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t pos) override;
|
||||
void nextLBID() override;
|
||||
bool isScan()
|
||||
{
|
||||
return _isScan;
|
||||
@ -88,18 +88,18 @@ class ColumnCommand : public Command
|
||||
return lbidAux;
|
||||
}
|
||||
|
||||
void createCommand(messageqcpp::ByteStream&);
|
||||
void createCommand(messageqcpp::ByteStream&) override;
|
||||
void createCommand(execplan::CalpontSystemCatalog::ColType& aColType, messageqcpp::ByteStream&);
|
||||
void resetCommand(messageqcpp::ByteStream&);
|
||||
void setMakeAbsRids(bool m)
|
||||
void resetCommand(messageqcpp::ByteStream&) override;
|
||||
void setMakeAbsRids(bool m) override
|
||||
{
|
||||
makeAbsRids = m;
|
||||
}
|
||||
bool willPrefetch();
|
||||
int64_t getLastLbid();
|
||||
void getLBIDList(uint32_t loopCount, std::vector<int64_t>* lbids);
|
||||
void getLBIDList(uint32_t loopCount, std::vector<int64_t>* lbids) override;
|
||||
|
||||
virtual SCommand duplicate();
|
||||
SCommand duplicate() override;
|
||||
bool operator==(const ColumnCommand&) const;
|
||||
bool operator!=(const ColumnCommand&) const;
|
||||
|
||||
@ -111,7 +111,7 @@ class ColumnCommand : public Command
|
||||
void disableFilters();
|
||||
void enableFilters();
|
||||
|
||||
int getCompType() const
|
||||
int getCompType() const override
|
||||
{
|
||||
return colType.compressionType;
|
||||
}
|
||||
@ -321,4 +321,3 @@ inline void ColumnCommand::fillEmptyBlock<messageqcpp::ByteStream::hexbyte>(uint
|
||||
}
|
||||
|
||||
} // namespace primitiveprocessor
|
||||
|
||||
|
@ -39,28 +39,28 @@ class DictStep : public Command
|
||||
{
|
||||
public:
|
||||
DictStep();
|
||||
virtual ~DictStep();
|
||||
~DictStep() override;
|
||||
|
||||
void execute();
|
||||
void project();
|
||||
void execute() override;
|
||||
void project() override;
|
||||
void project(int64_t* vals); // used by RTSCommand to redirect input
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t row);
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t row) override;
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, int64_t* vals, uint32_t col);
|
||||
uint64_t getLBID();
|
||||
uint64_t getLBID() override;
|
||||
|
||||
/* This doesn't do anything for this class... make it column-specific or not? */
|
||||
void nextLBID();
|
||||
void createCommand(messageqcpp::ByteStream&);
|
||||
void resetCommand(messageqcpp::ByteStream&);
|
||||
void nextLBID() override;
|
||||
void createCommand(messageqcpp::ByteStream&) override;
|
||||
void resetCommand(messageqcpp::ByteStream&) override;
|
||||
|
||||
/* Put bootstrap code here (ie, build the template primitive msg) */
|
||||
void prep(int8_t outputType, bool makeAbsRids);
|
||||
void prep(int8_t outputType, bool makeAbsRids) override;
|
||||
|
||||
SCommand duplicate();
|
||||
SCommand duplicate() override;
|
||||
bool operator==(const DictStep&) const;
|
||||
bool operator!=(const DictStep&) const;
|
||||
|
||||
int getCompType() const
|
||||
int getCompType() const override
|
||||
{
|
||||
return compressionType;
|
||||
}
|
||||
@ -78,13 +78,11 @@ class DictStep : public Command
|
||||
const uint8_t* ptr;
|
||||
unsigned len;
|
||||
|
||||
StringPtr() : ptr(NULL), len(0)
|
||||
StringPtr() : ptr(nullptr), len(0)
|
||||
{
|
||||
;
|
||||
}
|
||||
StringPtr(const uint8_t* p, unsigned l) : ptr(p), len(l)
|
||||
{
|
||||
;
|
||||
}
|
||||
utils::ConstString getConstString() const
|
||||
{
|
||||
@ -111,9 +109,7 @@ class DictStep : public Command
|
||||
OrderedToken() : inResult(false)
|
||||
{
|
||||
}
|
||||
~OrderedToken()
|
||||
{
|
||||
}
|
||||
~OrderedToken() = default;
|
||||
};
|
||||
struct TokenSorter
|
||||
{
|
||||
|
@ -38,21 +38,21 @@ class FilterCommand : public Command
|
||||
{
|
||||
public:
|
||||
FilterCommand();
|
||||
virtual ~FilterCommand();
|
||||
~FilterCommand() override;
|
||||
|
||||
// returns a FilterCommand based on column types
|
||||
static Command* makeFilterCommand(messageqcpp::ByteStream&, std::vector<SCommand>& cmds);
|
||||
|
||||
// virtuals from base class -- Command
|
||||
void execute();
|
||||
void project();
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col);
|
||||
uint64_t getLBID();
|
||||
void nextLBID();
|
||||
void createCommand(messageqcpp::ByteStream&);
|
||||
void resetCommand(messageqcpp::ByteStream&);
|
||||
SCommand duplicate();
|
||||
void prep(int8_t outputType, bool makeAbsRids);
|
||||
void execute() override;
|
||||
void project() override;
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col) override;
|
||||
uint64_t getLBID() override;
|
||||
void nextLBID() override;
|
||||
void createCommand(messageqcpp::ByteStream&) override;
|
||||
void resetCommand(messageqcpp::ByteStream&) override;
|
||||
SCommand duplicate() override;
|
||||
void prep(int8_t outputType, bool makeAbsRids) override;
|
||||
|
||||
void setColTypes(const execplan::CalpontSystemCatalog::ColType& left,
|
||||
const execplan::CalpontSystemCatalog::ColType& right);
|
||||
@ -61,7 +61,7 @@ class FilterCommand : public Command
|
||||
bool operator==(const FilterCommand&) const;
|
||||
bool operator!=(const FilterCommand&) const;
|
||||
|
||||
int getCompType() const
|
||||
int getCompType() const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -96,8 +96,8 @@ class ScaledFilterCmd : public FilterCommand
|
||||
{
|
||||
public:
|
||||
ScaledFilterCmd();
|
||||
virtual ~ScaledFilterCmd();
|
||||
SCommand duplicate();
|
||||
~ScaledFilterCmd() override;
|
||||
SCommand duplicate() override;
|
||||
|
||||
void setFactor(double);
|
||||
double factor();
|
||||
@ -108,7 +108,7 @@ class ScaledFilterCmd : public FilterCommand
|
||||
|
||||
protected:
|
||||
// compare method, take the indices to the values array
|
||||
bool compare(uint64_t, uint64_t);
|
||||
bool compare(uint64_t, uint64_t) override;
|
||||
|
||||
// value used in comparison;
|
||||
double fFactor;
|
||||
@ -123,11 +123,11 @@ class StrFilterCmd : public FilterCommand
|
||||
{
|
||||
public:
|
||||
StrFilterCmd();
|
||||
virtual ~StrFilterCmd();
|
||||
~StrFilterCmd() override;
|
||||
|
||||
// override FilterCommand methods
|
||||
void execute();
|
||||
SCommand duplicate();
|
||||
void execute() override;
|
||||
SCommand duplicate() override;
|
||||
|
||||
void setCompareFunc(uint32_t);
|
||||
void setCharLength(size_t);
|
||||
@ -139,7 +139,7 @@ class StrFilterCmd : public FilterCommand
|
||||
|
||||
protected:
|
||||
// compare method, take the indices to the values array
|
||||
bool compare(uint64_t, uint64_t);
|
||||
bool compare(uint64_t, uint64_t) override;
|
||||
|
||||
// compare method for differernt column combination, c--char[], s--string
|
||||
// compare char[]-char[] is not the same as int-int due to endian issue.
|
||||
|
@ -38,21 +38,21 @@ class PassThruCommand : public Command
|
||||
{
|
||||
public:
|
||||
PassThruCommand();
|
||||
virtual ~PassThruCommand();
|
||||
~PassThruCommand() override;
|
||||
|
||||
void prep(int8_t outputType, bool makeAbsRids);
|
||||
void execute();
|
||||
void project();
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col);
|
||||
uint64_t getLBID();
|
||||
void nextLBID();
|
||||
void createCommand(messageqcpp::ByteStream&);
|
||||
void resetCommand(messageqcpp::ByteStream&);
|
||||
SCommand duplicate();
|
||||
void prep(int8_t outputType, bool makeAbsRids) override;
|
||||
void execute() override;
|
||||
void project() override;
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col) override;
|
||||
uint64_t getLBID() override;
|
||||
void nextLBID() override;
|
||||
void createCommand(messageqcpp::ByteStream&) override;
|
||||
void resetCommand(messageqcpp::ByteStream&) override;
|
||||
SCommand duplicate() override;
|
||||
bool operator==(const PassThruCommand&) const;
|
||||
bool operator!=(const PassThruCommand&) const;
|
||||
|
||||
int getCompType() const
|
||||
int getCompType() const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ using namespace std;
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <utility>
|
||||
#include <boost/thread.hpp>
|
||||
using namespace boost;
|
||||
#include "distributedenginecomm.h"
|
||||
@ -110,7 +111,7 @@ using namespace threadpool;
|
||||
// make global for blockcache
|
||||
//
|
||||
static const char* statsName = {"pm"};
|
||||
dbbc::Stats* gPMStatsPtr = 0;
|
||||
dbbc::Stats* gPMStatsPtr = nullptr;
|
||||
bool gPMProfOn = false;
|
||||
uint32_t gSession = 0;
|
||||
dbbc::Stats pmstats(statsName);
|
||||
@ -141,8 +142,6 @@ int noVB = 0;
|
||||
BPPMap bppMap;
|
||||
boost::mutex bppLock;
|
||||
|
||||
#define DJLOCK_READ 0
|
||||
#define DJLOCK_WRITE 1
|
||||
boost::mutex djMutex; // lock for djLock, lol.
|
||||
std::map<uint64_t, shared_mutex*> djLock; // djLock synchronizes destroy and joiner msgs, see bug 2619
|
||||
|
||||
@ -160,9 +159,7 @@ struct preFetchCond
|
||||
waiters = 0;
|
||||
}
|
||||
|
||||
~preFetchCond()
|
||||
{
|
||||
}
|
||||
~preFetchCond() = default;
|
||||
};
|
||||
|
||||
typedef preFetchCond preFetchBlock_t;
|
||||
@ -202,7 +199,7 @@ void waitForRetry(long count)
|
||||
timespec ts;
|
||||
ts.tv_sec = 5L * count / 10L;
|
||||
ts.tv_nsec = (5L * count % 10L) * 100000000L;
|
||||
nanosleep(&ts, 0);
|
||||
nanosleep(&ts, nullptr);
|
||||
}
|
||||
|
||||
void prefetchBlocks(const uint64_t lbid, const int compType, uint32_t* rCount)
|
||||
@ -234,7 +231,7 @@ void prefetchBlocks(const uint64_t lbid, const int compType, uint32_t* rCount)
|
||||
return;
|
||||
}
|
||||
|
||||
preFetchBlock_t* pfb = 0;
|
||||
preFetchBlock_t* pfb = nullptr;
|
||||
pfb = new preFetchBlock_t(lowlbid);
|
||||
|
||||
pfBlockMap[lowlbid] = pfb;
|
||||
@ -304,7 +301,7 @@ void prefetchBlocks(const uint64_t lbid, const int compType, uint32_t* rCount)
|
||||
if (pfBlockMap.erase(lowlbid) > 0)
|
||||
delete pfb;
|
||||
|
||||
pfb = 0;
|
||||
pfb = nullptr;
|
||||
pfbMutex.unlock();
|
||||
throw;
|
||||
}
|
||||
@ -326,7 +323,7 @@ cleanup:
|
||||
if (pfBlockMap.erase(lowlbid) > 0)
|
||||
delete pfb;
|
||||
|
||||
pfb = 0;
|
||||
pfb = nullptr;
|
||||
pfbMutex.unlock();
|
||||
|
||||
} // prefetchBlocks()
|
||||
@ -524,15 +521,15 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
|
||||
boost::scoped_array<unsigned char> uCmpBufSa;
|
||||
|
||||
ptrdiff_t alignedBuffer = 0;
|
||||
void* readBufferPtr = NULL;
|
||||
char* cmpHdrBuf = NULL;
|
||||
char* cmpBuf = NULL;
|
||||
unsigned char* uCmpBuf = NULL;
|
||||
void* readBufferPtr = nullptr;
|
||||
char* cmpHdrBuf = nullptr;
|
||||
char* cmpBuf = nullptr;
|
||||
unsigned char* uCmpBuf = nullptr;
|
||||
uint64_t cmpBufLen = 0;
|
||||
int blockReadRetryCount = 0;
|
||||
unsigned idx = 0;
|
||||
int pageSize = getpagesize();
|
||||
IDBDataFile* fp = 0;
|
||||
IDBDataFile* fp = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
@ -543,7 +540,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
|
||||
int opts = directIOFlag ? IDBDataFile::USE_ODIRECT : 0;
|
||||
fp = IDBDataFile::open(IDBPolicy::getType(fileNamePtr, IDBPolicy::PRIMPROC), fileNamePtr, "r", opts);
|
||||
|
||||
if (fp == NULL)
|
||||
if (fp == nullptr)
|
||||
{
|
||||
int errCode = errno;
|
||||
SUMMARY_INFO2("open failed: ", fileNamePtr);
|
||||
@ -552,7 +549,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
|
||||
// #if STRERROR_R_CHAR_P
|
||||
const char* p;
|
||||
|
||||
if ((p = strerror_r(errCode, errbuf, 80)) != 0)
|
||||
if ((p = strerror_r(errCode, errbuf, 80)) != nullptr)
|
||||
errMsg = p;
|
||||
|
||||
if (errCode == EINVAL)
|
||||
@ -595,8 +592,8 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
|
||||
cout << "pread2(" << fd << ", 0x" << hex << (ptrdiff_t)readBufferPtr << dec << ", "
|
||||
<< DATA_BLOCK_SIZE << ", " << offset << ") = " << i << endl;
|
||||
}
|
||||
#endif // IDB_COMP_POC_DEBUG
|
||||
} // if (compType == 0)
|
||||
#endif // IDB_COMP_POC_DEBUG
|
||||
} // if (compType == 0)
|
||||
else // if (compType != 0)
|
||||
{
|
||||
// retry if file is out of sync -- compressed column file only.
|
||||
@ -692,7 +689,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
|
||||
uint64_t cmpBufOff = ptrList[idx].first;
|
||||
uint64_t cmpBufSz = ptrList[idx].second;
|
||||
|
||||
if (cmpBufSa.get() == NULL || cmpBufLen < cmpBufSz)
|
||||
if (cmpBufSa.get() == nullptr || cmpBufLen < cmpBufSz)
|
||||
{
|
||||
cmpBufSa.reset(new char[cmpBufSz + pageSize]);
|
||||
cmpBufLen = cmpBufSz;
|
||||
@ -759,12 +756,12 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
|
||||
catch (...)
|
||||
{
|
||||
delete fp;
|
||||
fp = 0;
|
||||
fp = nullptr;
|
||||
throw;
|
||||
}
|
||||
|
||||
delete fp;
|
||||
fp = 0;
|
||||
fp = nullptr;
|
||||
|
||||
// log the retries
|
||||
if (blockReadRetryCount > 0)
|
||||
@ -787,7 +784,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
|
||||
return;
|
||||
}
|
||||
|
||||
FileBuffer* fbPtr = 0;
|
||||
FileBuffer* fbPtr = nullptr;
|
||||
bool wasBlockInCache = false;
|
||||
|
||||
fbPtr = bc.getBlockPtr(lbid, ver, flg);
|
||||
@ -827,12 +824,12 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
|
||||
|
||||
struct AsynchLoader
|
||||
{
|
||||
AsynchLoader(uint64_t l, const QueryContext& v, uint32_t t, int ct, uint32_t* cCount, uint32_t* rCount,
|
||||
bool trace, uint32_t sesID, boost::mutex* m, uint32_t* loaderCount,
|
||||
AsynchLoader(uint64_t l, QueryContext v, uint32_t t, int ct, uint32_t* cCount, uint32_t* rCount, bool trace,
|
||||
uint32_t sesID, boost::mutex* m, uint32_t* loaderCount,
|
||||
boost::shared_ptr<BPPSendThread> st, // sendThread for abort upon exception.
|
||||
VSSCache* vCache)
|
||||
: lbid(l)
|
||||
, ver(v)
|
||||
, ver(std::move(v))
|
||||
, txn(t)
|
||||
, compType(ct)
|
||||
, LBIDTrace(trace)
|
||||
@ -841,7 +838,7 @@ struct AsynchLoader
|
||||
, readCount(rCount)
|
||||
, busyLoaders(loaderCount)
|
||||
, mutex(m)
|
||||
, sendThread(st)
|
||||
, sendThread(std::move(st))
|
||||
, vssCache(vCache)
|
||||
{
|
||||
}
|
||||
@ -1016,10 +1013,10 @@ class DictScanJob : public threadpool::FairThreadPool::Functor
|
||||
{
|
||||
public:
|
||||
DictScanJob(SP_UM_IOSOCK ios, SBS bs, SP_UM_MUTEX writeLock);
|
||||
virtual ~DictScanJob();
|
||||
~DictScanJob() override;
|
||||
|
||||
void write(const SBS);
|
||||
int operator()();
|
||||
int operator()() override;
|
||||
void catchHandler(const std::string& ex, uint32_t id, uint16_t code = logging::primitiveServerErr);
|
||||
void sendErrorMsg(uint32_t id, uint16_t code);
|
||||
|
||||
@ -1031,14 +1028,12 @@ class DictScanJob : public threadpool::FairThreadPool::Functor
|
||||
};
|
||||
|
||||
DictScanJob::DictScanJob(SP_UM_IOSOCK ios, SBS bs, SP_UM_MUTEX writeLock)
|
||||
: fIos(ios), fByteStream(bs), fWriteLock(writeLock)
|
||||
: fIos(std::move(ios)), fByteStream(std::move(bs)), fWriteLock(std::move(writeLock))
|
||||
{
|
||||
dieTime = posix_time::second_clock::universal_time() + posix_time::seconds(100);
|
||||
}
|
||||
|
||||
DictScanJob::~DictScanJob()
|
||||
{
|
||||
}
|
||||
DictScanJob::~DictScanJob() = default;
|
||||
|
||||
void DictScanJob::write(const SBS sbs)
|
||||
{
|
||||
@ -1215,9 +1210,8 @@ struct BPPHandler
|
||||
|
||||
struct BPPHandlerFunctor : public FairThreadPool::Functor
|
||||
{
|
||||
BPPHandlerFunctor(boost::shared_ptr<BPPHandler> r, SBS b) : bs(b)
|
||||
BPPHandlerFunctor(boost::shared_ptr<BPPHandler> r, SBS b) : rt(std::move(r)), bs(std::move(b))
|
||||
{
|
||||
rt = r;
|
||||
dieTime = posix_time::second_clock::universal_time() + posix_time::seconds(100);
|
||||
}
|
||||
|
||||
@ -1228,10 +1222,10 @@ struct BPPHandler
|
||||
|
||||
struct LastJoiner : public BPPHandlerFunctor
|
||||
{
|
||||
LastJoiner(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(r, b)
|
||||
LastJoiner(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(std::move(r), std::move(b))
|
||||
{
|
||||
}
|
||||
int operator()()
|
||||
int operator()() override
|
||||
{
|
||||
utils::setThreadName("PPHandLastJoiner");
|
||||
return rt->lastJoinerMsg(*bs, dieTime);
|
||||
@ -1240,10 +1234,10 @@ struct BPPHandler
|
||||
|
||||
struct Create : public BPPHandlerFunctor
|
||||
{
|
||||
Create(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(r, b)
|
||||
Create(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(std::move(r), std::move(b))
|
||||
{
|
||||
}
|
||||
int operator()()
|
||||
int operator()() override
|
||||
{
|
||||
utils::setThreadName("PPHandCreate");
|
||||
rt->createBPP(*bs);
|
||||
@ -1253,10 +1247,10 @@ struct BPPHandler
|
||||
|
||||
struct Destroy : public BPPHandlerFunctor
|
||||
{
|
||||
Destroy(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(r, b)
|
||||
Destroy(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(std::move(r), std::move(b))
|
||||
{
|
||||
}
|
||||
int operator()()
|
||||
int operator()() override
|
||||
{
|
||||
utils::setThreadName("PPHandDestroy");
|
||||
return rt->destroyBPP(*bs, dieTime);
|
||||
@ -1265,10 +1259,10 @@ struct BPPHandler
|
||||
|
||||
struct AddJoiner : public BPPHandlerFunctor
|
||||
{
|
||||
AddJoiner(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(r, b)
|
||||
AddJoiner(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(std::move(r), std::move(b))
|
||||
{
|
||||
}
|
||||
int operator()()
|
||||
int operator()() override
|
||||
{
|
||||
utils::setThreadName("PPHandAddJoiner");
|
||||
return rt->addJoinerToBPP(*bs, dieTime);
|
||||
@ -1280,7 +1274,7 @@ struct BPPHandler
|
||||
Abort(boost::shared_ptr<BPPHandler> r, SBS b) : BPPHandlerFunctor(r, b)
|
||||
{
|
||||
}
|
||||
int operator()()
|
||||
int operator()() override
|
||||
{
|
||||
utils::setThreadName("PPHandAbort");
|
||||
return rt->doAbort(*bs, dieTime);
|
||||
@ -1667,12 +1661,12 @@ struct BPPHandler
|
||||
class DictionaryOp : public FairThreadPool::Functor
|
||||
{
|
||||
public:
|
||||
DictionaryOp(SBS cmd) : bs(cmd)
|
||||
DictionaryOp(SBS cmd) : bs(std::move(cmd))
|
||||
{
|
||||
dieTime = posix_time::second_clock::universal_time() + posix_time::seconds(100);
|
||||
}
|
||||
virtual int execute() = 0;
|
||||
int operator()()
|
||||
int operator()() override
|
||||
{
|
||||
utils::setThreadName("PPDictOp");
|
||||
int ret;
|
||||
@ -1705,7 +1699,7 @@ class CreateEqualityFilter : public DictionaryOp
|
||||
CreateEqualityFilter(SBS cmd) : DictionaryOp(cmd)
|
||||
{
|
||||
}
|
||||
int execute()
|
||||
int execute() override
|
||||
{
|
||||
createEqualityFilter();
|
||||
return 0;
|
||||
@ -1739,10 +1733,10 @@ class CreateEqualityFilter : public DictionaryOp
|
||||
class DestroyEqualityFilter : public DictionaryOp
|
||||
{
|
||||
public:
|
||||
DestroyEqualityFilter(SBS cmd) : DictionaryOp(cmd)
|
||||
DestroyEqualityFilter(SBS cmd) : DictionaryOp(std::move(cmd))
|
||||
{
|
||||
}
|
||||
int execute()
|
||||
int execute() override
|
||||
{
|
||||
return destroyEqualityFilter();
|
||||
}
|
||||
@ -2167,9 +2161,7 @@ struct ReadThread
|
||||
mlp->logMessage(logging::M0058, args, false);
|
||||
}
|
||||
|
||||
~ReadThread()
|
||||
{
|
||||
}
|
||||
~ReadThread() = default;
|
||||
string fServerName;
|
||||
IOSocket fIos;
|
||||
PrimitiveServer* fPrimitiveServerPtr;
|
||||
|
@ -87,16 +87,16 @@ extern BPPMap bppMap;
|
||||
void prefetchBlocks(uint64_t lbid, const int compType, uint32_t* rCount);
|
||||
void prefetchExtent(uint64_t lbid, uint32_t ver, uint32_t txn, uint32_t* rCount);
|
||||
void loadBlock(uint64_t lbid, BRM::QueryContext q, uint32_t txn, int compType, void* bufferPtr,
|
||||
bool* pWasBlockInCache, uint32_t* rCount = NULL, bool LBIDTrace = false,
|
||||
uint32_t sessionID = 0, bool doPrefetch = true, VSSCache* vssCache = NULL);
|
||||
bool* pWasBlockInCache, uint32_t* rCount = nullptr, bool LBIDTrace = false,
|
||||
uint32_t sessionID = 0, bool doPrefetch = true, VSSCache* vssCache = nullptr);
|
||||
void loadBlockAsync(uint64_t lbid, const BRM::QueryContext& q, uint32_t txn, int CompType, uint32_t* cCount,
|
||||
uint32_t* rCount, bool LBIDTrace, uint32_t sessionID, boost::mutex* m,
|
||||
uint32_t* busyLoaders, boost::shared_ptr<BPPSendThread> sendThread,
|
||||
VSSCache* vssCache = 0);
|
||||
VSSCache* vssCache = nullptr);
|
||||
uint32_t loadBlocks(BRM::LBID_t* lbids, BRM::QueryContext q, BRM::VER_t txn, int compType,
|
||||
uint8_t** bufferPtrs, uint32_t* rCount, bool LBIDTrace, uint32_t sessionID,
|
||||
uint32_t blockCount, bool* wasVersioned, bool doPrefetch = true,
|
||||
VSSCache* vssCache = NULL);
|
||||
VSSCache* vssCache = nullptr);
|
||||
uint32_t cacheNum(uint64_t lbid);
|
||||
void buildFileName(BRM::OID_t oid, char* fileName);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <utility>
|
||||
#include "fair_threadpool.h"
|
||||
|
||||
class PrimitiveServerThreadPools
|
||||
@ -25,7 +26,7 @@ class PrimitiveServerThreadPools
|
||||
public:
|
||||
PrimitiveServerThreadPools() = default;
|
||||
PrimitiveServerThreadPools(boost::shared_ptr<threadpool::FairThreadPool> primServerThreadPool)
|
||||
: fPrimServerThreadPool(primServerThreadPool)
|
||||
: fPrimServerThreadPool(std::move(primServerThreadPool))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -155,12 +155,12 @@ class ServicePrimProc : public Service, public Opt
|
||||
|
||||
void LogErrno() override
|
||||
{
|
||||
cerr << strerror(errno) << endl;
|
||||
std::cerr << strerror(errno) << std::endl;
|
||||
}
|
||||
|
||||
void ParentLogChildMessage(const std::string& str) override
|
||||
{
|
||||
cout << str << endl;
|
||||
std::cout << str << std::endl;
|
||||
}
|
||||
int Child() override;
|
||||
int Run()
|
||||
|
@ -27,14 +27,14 @@ class PseudoCC : public ColumnCommand
|
||||
{
|
||||
public:
|
||||
PseudoCC();
|
||||
virtual ~PseudoCC();
|
||||
~PseudoCC() override;
|
||||
|
||||
virtual SCommand duplicate();
|
||||
virtual void createCommand(messageqcpp::ByteStream&);
|
||||
virtual void resetCommand(messageqcpp::ByteStream&);
|
||||
SCommand duplicate() override;
|
||||
void createCommand(messageqcpp::ByteStream&) override;
|
||||
void resetCommand(messageqcpp::ByteStream&) override;
|
||||
|
||||
protected:
|
||||
virtual void loadData();
|
||||
void loadData() override;
|
||||
|
||||
private:
|
||||
template <typename W>
|
||||
@ -102,7 +102,7 @@ template <typename W>
|
||||
void PseudoCC::loadSegmentNum()
|
||||
{
|
||||
uint16_t segNum;
|
||||
rowgroup::getLocationFromRid(bpp->baseRid, NULL, &segNum, NULL, NULL);
|
||||
rowgroup::getLocationFromRid(bpp->baseRid, nullptr, &segNum, nullptr, nullptr);
|
||||
loadSingleValue<W>(segNum);
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ template <typename W>
|
||||
void PseudoCC::loadPartitionNum()
|
||||
{
|
||||
uint32_t partNum;
|
||||
rowgroup::getLocationFromRid(bpp->baseRid, &partNum, NULL, NULL, NULL);
|
||||
rowgroup::getLocationFromRid(bpp->baseRid, &partNum, nullptr, nullptr, nullptr);
|
||||
loadSingleValue<W>(partNum);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class RssMonFcn : public utils::MonitorProcMem
|
||||
{
|
||||
}
|
||||
|
||||
void operator()() const;
|
||||
void operator()() const override;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace exemgr
|
@ -40,23 +40,23 @@ class RTSCommand : public Command
|
||||
{
|
||||
public:
|
||||
RTSCommand();
|
||||
virtual ~RTSCommand();
|
||||
~RTSCommand() override;
|
||||
|
||||
void execute();
|
||||
void project();
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col);
|
||||
uint64_t getLBID();
|
||||
void nextLBID();
|
||||
void createCommand(messageqcpp::ByteStream&);
|
||||
void resetCommand(messageqcpp::ByteStream&);
|
||||
SCommand duplicate();
|
||||
void execute() override;
|
||||
void project() override;
|
||||
void projectIntoRowGroup(rowgroup::RowGroup& rg, uint32_t col) override;
|
||||
uint64_t getLBID() override;
|
||||
void nextLBID() override;
|
||||
void createCommand(messageqcpp::ByteStream&) override;
|
||||
void resetCommand(messageqcpp::ByteStream&) override;
|
||||
SCommand duplicate() override;
|
||||
bool operator==(const RTSCommand&) const;
|
||||
bool operator!=(const RTSCommand&) const;
|
||||
|
||||
void setBatchPrimitiveProcessor(BatchPrimitiveProcessor*);
|
||||
void setBatchPrimitiveProcessor(BatchPrimitiveProcessor*) override;
|
||||
|
||||
/* Put bootstrap code here (ie, build the template primitive msg) */
|
||||
void prep(int8_t outputType, bool makeAbsRids);
|
||||
void prep(int8_t outputType, bool makeAbsRids) override;
|
||||
uint8_t isPassThru()
|
||||
{
|
||||
return passThru;
|
||||
@ -65,10 +65,10 @@ class RTSCommand : public Command
|
||||
{
|
||||
absNull = a;
|
||||
}
|
||||
void getLBIDList(uint32_t loopCount, std::vector<int64_t>* lbids);
|
||||
void getLBIDList(uint32_t loopCount, std::vector<int64_t>* lbids) override;
|
||||
|
||||
// TODO: do we need to reference either col or dict?
|
||||
int getCompType() const
|
||||
int getCompType() const override
|
||||
{
|
||||
return dict.getCompType();
|
||||
}
|
||||
|
@ -62,320 +62,324 @@
|
||||
|
||||
namespace exemgr
|
||||
{
|
||||
using SharedPtrEMSock = boost::shared_ptr<messageqcpp::IOSocket>;
|
||||
class Opt
|
||||
using SharedPtrEMSock = boost::shared_ptr<messageqcpp::IOSocket>;
|
||||
class Opt
|
||||
{
|
||||
public:
|
||||
int m_debug;
|
||||
bool m_e;
|
||||
bool m_fg;
|
||||
Opt() : m_debug(0), m_e(false), m_fg(false){};
|
||||
Opt(int argc, char* argv[]) : m_debug(0), m_e(false), m_fg(false)
|
||||
{
|
||||
public:
|
||||
int m_debug;
|
||||
bool m_e;
|
||||
bool m_fg;
|
||||
Opt() : m_debug(0), m_e(false), m_fg(false) {};
|
||||
Opt(int argc, char* argv[]) : m_debug(0), m_e(false), m_fg(false)
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "edf")) != EOF)
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "edf")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'd': m_debug++; break;
|
||||
case 'd': m_debug++; break;
|
||||
|
||||
case 'e': m_e = true; break;
|
||||
case 'e': m_e = true; break;
|
||||
|
||||
case 'f': m_fg = true; break;
|
||||
case 'f': m_fg = true; break;
|
||||
|
||||
case '?':
|
||||
default: break;
|
||||
}
|
||||
case '?':
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
int getDebugLevel() const
|
||||
{
|
||||
return m_debug;
|
||||
}
|
||||
};
|
||||
|
||||
class ServiceExeMgr : public Service, public Opt
|
||||
}
|
||||
int getDebugLevel() const
|
||||
{
|
||||
using SessionMemMap_t = std::map<uint32_t, size_t>;
|
||||
using ThreadCntPerSessionMap_t = std::map<uint32_t, uint32_t>;
|
||||
protected:
|
||||
void log(logging::LOG_TYPE type, const std::string& str)
|
||||
{
|
||||
logging::LoggingID logid(16);
|
||||
logging::Message::Args args;
|
||||
logging::Message message(8);
|
||||
args.add(strerror(errno));
|
||||
message.format(args);
|
||||
logging::Logger logger(logid.fSubsysID);
|
||||
logger.logMessage(type, message, logid);
|
||||
}
|
||||
return m_debug;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
ServiceExeMgr(const Opt& opt) : Service("ExeMgr"), Opt(opt), msgLog_(logging::Logger(16))
|
||||
class ServiceExeMgr : public Service, public Opt
|
||||
{
|
||||
using SessionMemMap_t = std::map<uint32_t, size_t>;
|
||||
using ThreadCntPerSessionMap_t = std::map<uint32_t, uint32_t>;
|
||||
|
||||
protected:
|
||||
void log(logging::LOG_TYPE type, const std::string& str)
|
||||
{
|
||||
logging::LoggingID logid(16);
|
||||
logging::Message::Args args;
|
||||
logging::Message message(8);
|
||||
args.add(strerror(errno));
|
||||
message.format(args);
|
||||
logging::Logger logger(logid.fSubsysID);
|
||||
logger.logMessage(type, message, logid);
|
||||
}
|
||||
|
||||
public:
|
||||
ServiceExeMgr(const Opt& opt) : Service("ExeMgr"), Opt(opt), msgLog_(logging::Logger(16))
|
||||
{
|
||||
bool runningWithExeMgr = true;
|
||||
rm_ = joblist::ResourceManager::instance(runningWithExeMgr);
|
||||
}
|
||||
ServiceExeMgr(const Opt& opt, config::Config* aConfig)
|
||||
: Service("ExeMgr"), Opt(opt), msgLog_(logging::Logger(16))
|
||||
{
|
||||
bool runningWithExeMgr = true;
|
||||
rm_ = joblist::ResourceManager::instance(runningWithExeMgr, aConfig);
|
||||
}
|
||||
void LogErrno() override
|
||||
{
|
||||
log(logging::LOG_TYPE_CRITICAL, std::string(strerror(errno)));
|
||||
}
|
||||
void ParentLogChildMessage(const std::string& str) override
|
||||
{
|
||||
log(logging::LOG_TYPE_INFO, str);
|
||||
}
|
||||
int Child() override;
|
||||
int Run()
|
||||
{
|
||||
return m_fg ? Child() : RunForking();
|
||||
}
|
||||
static const constexpr unsigned logDefaultMsg = logging::M0000;
|
||||
static const constexpr unsigned logDbProfStartStatement = logging::M0028;
|
||||
static const constexpr unsigned logDbProfEndStatement = logging::M0029;
|
||||
static const constexpr unsigned logStartSql = logging::M0041;
|
||||
static const constexpr unsigned logEndSql = logging::M0042;
|
||||
static const constexpr unsigned logRssTooBig = logging::M0044;
|
||||
static const constexpr unsigned logDbProfQueryStats = logging::M0047;
|
||||
static const constexpr unsigned logExeMgrExcpt = logging::M0055;
|
||||
// If any flags other than the table mode flags are set, produce output to screeen
|
||||
static const constexpr uint32_t flagsWantOutput =
|
||||
(0xffffffff & ~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_AUTOSWITCH &
|
||||
~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_OFF);
|
||||
logging::Logger& getLogger()
|
||||
{
|
||||
return msgLog_;
|
||||
}
|
||||
void updateSessionMap(const size_t pct)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(sessionMemMapMutex_);
|
||||
|
||||
for (auto mapIter = sessionMemMap_.begin(); mapIter != sessionMemMap_.end(); ++mapIter)
|
||||
{
|
||||
bool runningWithExeMgr = true;
|
||||
rm_ = joblist::ResourceManager::instance(runningWithExeMgr);
|
||||
if (pct > mapIter->second)
|
||||
{
|
||||
mapIter->second = pct;
|
||||
}
|
||||
}
|
||||
ServiceExeMgr(const Opt& opt, config::Config* aConfig) : Service("ExeMgr"), Opt(opt), msgLog_(logging::Logger(16))
|
||||
{
|
||||
bool runningWithExeMgr = true;
|
||||
rm_ = joblist::ResourceManager::instance(runningWithExeMgr, aConfig);
|
||||
}
|
||||
void LogErrno() override
|
||||
{
|
||||
log(logging::LOG_TYPE_CRITICAL, std::string(strerror(errno)));
|
||||
}
|
||||
void ParentLogChildMessage(const std::string& str) override
|
||||
{
|
||||
log(logging::LOG_TYPE_INFO, str);
|
||||
}
|
||||
int Child() override;
|
||||
int Run()
|
||||
{
|
||||
return m_fg ? Child() : RunForking();
|
||||
}
|
||||
static const constexpr unsigned logDefaultMsg = logging::M0000;
|
||||
static const constexpr unsigned logDbProfStartStatement = logging::M0028;
|
||||
static const constexpr unsigned logDbProfEndStatement = logging::M0029;
|
||||
static const constexpr unsigned logStartSql = logging::M0041;
|
||||
static const constexpr unsigned logEndSql = logging::M0042;
|
||||
static const constexpr unsigned logRssTooBig = logging::M0044;
|
||||
static const constexpr unsigned logDbProfQueryStats = logging::M0047;
|
||||
static const constexpr unsigned logExeMgrExcpt = logging::M0055;
|
||||
// If any flags other than the table mode flags are set, produce output to screeen
|
||||
static const constexpr uint32_t flagsWantOutput = (0xffffffff & ~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_AUTOSWITCH &
|
||||
~execplan::CalpontSelectExecutionPlan::TRACE_TUPLE_OFF);
|
||||
logging::Logger& getLogger()
|
||||
{
|
||||
return msgLog_;
|
||||
}
|
||||
void updateSessionMap(const size_t pct)
|
||||
}
|
||||
ThreadCntPerSessionMap_t& getThreadCntPerSessionMap()
|
||||
{
|
||||
return threadCntPerSessionMap_;
|
||||
}
|
||||
std::mutex& getThreadCntPerSessionMapMutex()
|
||||
{
|
||||
return threadCntPerSessionMapMutex_;
|
||||
}
|
||||
void initMaxMemPct(uint32_t sessionId)
|
||||
{
|
||||
if (sessionId < 0x80000000)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(sessionMemMapMutex_);
|
||||
auto mapIter = sessionMemMap_.find(sessionId);
|
||||
|
||||
for (auto mapIter = sessionMemMap_.begin(); mapIter != sessionMemMap_.end(); ++mapIter)
|
||||
if (mapIter == sessionMemMap_.end())
|
||||
{
|
||||
if (pct > mapIter->second)
|
||||
{
|
||||
mapIter->second = pct;
|
||||
}
|
||||
sessionMemMap_[sessionId] = 0;
|
||||
}
|
||||
}
|
||||
ThreadCntPerSessionMap_t& getThreadCntPerSessionMap()
|
||||
{
|
||||
return threadCntPerSessionMap_;
|
||||
}
|
||||
std::mutex& getThreadCntPerSessionMapMutex()
|
||||
{
|
||||
return threadCntPerSessionMapMutex_;
|
||||
}
|
||||
void initMaxMemPct(uint32_t sessionId)
|
||||
{
|
||||
if (sessionId < 0x80000000)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(sessionMemMapMutex_);
|
||||
auto mapIter = sessionMemMap_.find(sessionId);
|
||||
|
||||
if (mapIter == sessionMemMap_.end())
|
||||
{
|
||||
sessionMemMap_[sessionId] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mapIter->second = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
uint64_t getMaxMemPct(const uint32_t sessionId)
|
||||
{
|
||||
uint64_t maxMemoryPct = 0;
|
||||
if (sessionId < 0x80000000)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(sessionMemMapMutex_);
|
||||
auto mapIter = sessionMemMap_.find(sessionId);
|
||||
|
||||
if (mapIter != sessionMemMap_.end())
|
||||
{
|
||||
maxMemoryPct = (uint64_t)mapIter->second;
|
||||
}
|
||||
}
|
||||
|
||||
return maxMemoryPct;
|
||||
}
|
||||
void deleteMaxMemPct(uint32_t sessionId)
|
||||
{
|
||||
if (sessionId < 0x80000000)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(sessionMemMapMutex_);
|
||||
auto mapIter = sessionMemMap_.find(sessionId);
|
||||
|
||||
if (mapIter != sessionMemMap_.end())
|
||||
{
|
||||
sessionMemMap_.erase(sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
//...Increment the number of threads using the specified sessionId
|
||||
void incThreadCntPerSession(uint32_t sessionId)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(threadCntPerSessionMapMutex_);
|
||||
auto mapIter = threadCntPerSessionMap_.find(sessionId);
|
||||
|
||||
if (mapIter == threadCntPerSessionMap_.end())
|
||||
threadCntPerSessionMap_.insert(ThreadCntPerSessionMap_t::value_type(sessionId, 1));
|
||||
else
|
||||
mapIter->second++;
|
||||
}
|
||||
//...Decrement the number of threads using the specified sessionId.
|
||||
//...When the thread count for a sessionId reaches 0, the corresponding
|
||||
//...CalpontSystemCatalog objects are deleted.
|
||||
//...The user query and its associated catalog query have a different
|
||||
//...session Id where the highest bit is flipped.
|
||||
//...The object with id(sessionId | 0x80000000) cannot be removed before
|
||||
//...user query session completes because the sysdata may be used for
|
||||
//...debugging/stats purpose, such as result graph, etc.
|
||||
void decThreadCntPerSession(uint32_t sessionId)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(threadCntPerSessionMapMutex_);
|
||||
auto mapIter = threadCntPerSessionMap_.find(sessionId);
|
||||
|
||||
if (mapIter != threadCntPerSessionMap_.end())
|
||||
{
|
||||
if (--mapIter->second == 0)
|
||||
mapIter->second = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
uint64_t getMaxMemPct(const uint32_t sessionId)
|
||||
{
|
||||
uint64_t maxMemoryPct = 0;
|
||||
if (sessionId < 0x80000000)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(sessionMemMapMutex_);
|
||||
auto mapIter = sessionMemMap_.find(sessionId);
|
||||
|
||||
if (mapIter != sessionMemMap_.end())
|
||||
{
|
||||
maxMemoryPct = (uint64_t)mapIter->second;
|
||||
}
|
||||
}
|
||||
|
||||
return maxMemoryPct;
|
||||
}
|
||||
void deleteMaxMemPct(uint32_t sessionId)
|
||||
{
|
||||
if (sessionId < 0x80000000)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(sessionMemMapMutex_);
|
||||
auto mapIter = sessionMemMap_.find(sessionId);
|
||||
|
||||
if (mapIter != sessionMemMap_.end())
|
||||
{
|
||||
sessionMemMap_.erase(sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
//...Increment the number of threads using the specified sessionId
|
||||
void incThreadCntPerSession(uint32_t sessionId)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(threadCntPerSessionMapMutex_);
|
||||
auto mapIter = threadCntPerSessionMap_.find(sessionId);
|
||||
|
||||
if (mapIter == threadCntPerSessionMap_.end())
|
||||
threadCntPerSessionMap_.insert(ThreadCntPerSessionMap_t::value_type(sessionId, 1));
|
||||
else
|
||||
mapIter->second++;
|
||||
}
|
||||
//...Decrement the number of threads using the specified sessionId.
|
||||
//...When the thread count for a sessionId reaches 0, the corresponding
|
||||
//...CalpontSystemCatalog objects are deleted.
|
||||
//...The user query and its associated catalog query have a different
|
||||
//...session Id where the highest bit is flipped.
|
||||
//...The object with id(sessionId | 0x80000000) cannot be removed before
|
||||
//...user query session completes because the sysdata may be used for
|
||||
//...debugging/stats purpose, such as result graph, etc.
|
||||
void decThreadCntPerSession(uint32_t sessionId)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(threadCntPerSessionMapMutex_);
|
||||
auto mapIter = threadCntPerSessionMap_.find(sessionId);
|
||||
|
||||
if (mapIter != threadCntPerSessionMap_.end())
|
||||
{
|
||||
if (--mapIter->second == 0)
|
||||
{
|
||||
threadCntPerSessionMap_.erase(mapIter);
|
||||
execplan::CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId);
|
||||
execplan::CalpontSystemCatalog::removeCalpontSystemCatalog((sessionId ^ 0x80000000));
|
||||
}
|
||||
}
|
||||
}
|
||||
ActiveStatementCounter* getStatementsRunningCount()
|
||||
{
|
||||
return statementsRunningCount_;
|
||||
}
|
||||
joblist::DistributedEngineComm* getDec()
|
||||
{
|
||||
return dec_;
|
||||
}
|
||||
int toInt(const std::string& val)
|
||||
{
|
||||
if (val.length() == 0)
|
||||
return -1;
|
||||
|
||||
return static_cast<int>(config::Config::fromText(val));
|
||||
}
|
||||
const std::string prettyPrintMiniInfo(const std::string& in);
|
||||
|
||||
const std::string timeNow()
|
||||
{
|
||||
time_t outputTime = time(nullptr);
|
||||
struct tm ltm;
|
||||
char buf[32]; // ctime(3) says at least 26
|
||||
size_t len = 0;
|
||||
asctime_r(localtime_r(&outputTime, <m), buf);
|
||||
len = strlen(buf);
|
||||
|
||||
if (len > 0)
|
||||
--len;
|
||||
|
||||
if (buf[len] == '\n')
|
||||
buf[len] = 0;
|
||||
|
||||
return buf;
|
||||
}
|
||||
querytele::QueryTeleServerParms& getTeleServerParms()
|
||||
{
|
||||
return teleServerParms_;
|
||||
}
|
||||
joblist::ResourceManager& getRm()
|
||||
{
|
||||
return *rm_;
|
||||
}
|
||||
bool isLocalNodeSock(SharedPtrEMSock& sock) const
|
||||
{
|
||||
for (auto& sin : localNetIfaceSins_)
|
||||
{
|
||||
if (sock->isSameAddr(sin))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
void setupSignalHandlers();
|
||||
int8_t setupCwd()
|
||||
{
|
||||
std::string workdir = rm_->getScWorkingDir();
|
||||
int8_t rc = chdir(workdir.c_str());
|
||||
|
||||
if (rc < 0 || access(".", W_OK) != 0)
|
||||
rc = chdir("/tmp");
|
||||
|
||||
return (rc < 0) ? -5 : rc;
|
||||
}
|
||||
int setupResources()
|
||||
{
|
||||
struct rlimit rlim;
|
||||
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
rlim.rlim_cur = rlim.rlim_max = 65536;
|
||||
|
||||
if (setrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
{
|
||||
return -3;
|
||||
}
|
||||
if (rlim.rlim_cur != 65536)
|
||||
{
|
||||
return -4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void getLocalNetIfacesSins()
|
||||
{
|
||||
string ipAddress = "Unable to get IP Address";
|
||||
struct ifaddrs* netIfacesList = nullptr;
|
||||
struct ifaddrs* ifaceListMembPtr = nullptr;
|
||||
int success = 0;
|
||||
// retrieve the current interfaces - returns 0 on success
|
||||
success = getifaddrs(&netIfacesList);
|
||||
if (success == 0)
|
||||
{
|
||||
ifaceListMembPtr = netIfacesList;
|
||||
for (; ifaceListMembPtr; ifaceListMembPtr = ifaceListMembPtr->ifa_next)
|
||||
{
|
||||
if (ifaceListMembPtr->ifa_addr->sa_family == AF_INET)
|
||||
{
|
||||
threadCntPerSessionMap_.erase(mapIter);
|
||||
execplan::CalpontSystemCatalog::removeCalpontSystemCatalog(sessionId);
|
||||
execplan::CalpontSystemCatalog::removeCalpontSystemCatalog((sessionId ^ 0x80000000));
|
||||
localNetIfaceSins_.push_back(((struct sockaddr_in*)ifaceListMembPtr->ifa_addr)->sin_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
ActiveStatementCounter* getStatementsRunningCount()
|
||||
{
|
||||
return statementsRunningCount_;
|
||||
}
|
||||
joblist::DistributedEngineComm* getDec()
|
||||
{
|
||||
return dec_;
|
||||
}
|
||||
int toInt(const std::string& val)
|
||||
{
|
||||
if (val.length() == 0)
|
||||
return -1;
|
||||
|
||||
return static_cast<int>(config::Config::fromText(val));
|
||||
}
|
||||
const std::string prettyPrintMiniInfo(const std::string& in);
|
||||
|
||||
const std::string timeNow()
|
||||
{
|
||||
time_t outputTime = time(0);
|
||||
struct tm ltm;
|
||||
char buf[32]; // ctime(3) says at least 26
|
||||
size_t len = 0;
|
||||
asctime_r(localtime_r(&outputTime, <m), buf);
|
||||
len = strlen(buf);
|
||||
|
||||
if (len > 0)
|
||||
--len;
|
||||
|
||||
if (buf[len] == '\n')
|
||||
buf[len] = 0;
|
||||
|
||||
return buf;
|
||||
}
|
||||
querytele::QueryTeleServerParms& getTeleServerParms()
|
||||
{
|
||||
return teleServerParms_;
|
||||
}
|
||||
joblist::ResourceManager& getRm()
|
||||
{
|
||||
return *rm_;
|
||||
}
|
||||
bool isLocalNodeSock(SharedPtrEMSock& sock) const
|
||||
{
|
||||
for (auto& sin : localNetIfaceSins_)
|
||||
{
|
||||
if (sock->isSameAddr(sin))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
void setupSignalHandlers();
|
||||
int8_t setupCwd()
|
||||
{
|
||||
std::string workdir = rm_->getScWorkingDir();
|
||||
int8_t rc = chdir(workdir.c_str());
|
||||
|
||||
if (rc < 0 || access(".", W_OK) != 0)
|
||||
rc = chdir("/tmp");
|
||||
|
||||
return (rc < 0) ? -5 : rc;
|
||||
}
|
||||
int setupResources()
|
||||
{
|
||||
struct rlimit rlim;
|
||||
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
rlim.rlim_cur = rlim.rlim_max = 65536;
|
||||
|
||||
if (setrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
{
|
||||
return -3;
|
||||
}
|
||||
if (rlim.rlim_cur != 65536)
|
||||
{
|
||||
return -4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void getLocalNetIfacesSins()
|
||||
{
|
||||
string ipAddress = "Unable to get IP Address";
|
||||
struct ifaddrs* netIfacesList = nullptr;
|
||||
struct ifaddrs* ifaceListMembPtr = nullptr;
|
||||
int success = 0;
|
||||
// retrieve the current interfaces - returns 0 on success
|
||||
success = getifaddrs(&netIfacesList);
|
||||
if (success == 0)
|
||||
{
|
||||
ifaceListMembPtr = netIfacesList;
|
||||
for (; ifaceListMembPtr; ifaceListMembPtr = ifaceListMembPtr->ifa_next)
|
||||
{
|
||||
if (ifaceListMembPtr->ifa_addr->sa_family == AF_INET)
|
||||
{
|
||||
localNetIfaceSins_.push_back(((struct sockaddr_in*)ifaceListMembPtr->ifa_addr)->sin_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
freeifaddrs(netIfacesList);
|
||||
}
|
||||
logging::Logger msgLog_;
|
||||
SessionMemMap_t sessionMemMap_; // track memory% usage during a query
|
||||
std::mutex sessionMemMapMutex_;
|
||||
//...The FrontEnd may establish more than 1 connection (which results in
|
||||
// more than 1 ExeMgr thread) per session. These threads will share
|
||||
// the same CalpontSystemCatalog object for that session. Here, we
|
||||
// define a std::map to track how many threads are sharing each session, so
|
||||
// that we know when we can safely delete a CalpontSystemCatalog object
|
||||
// shared by multiple threads per session.
|
||||
ThreadCntPerSessionMap_t threadCntPerSessionMap_;
|
||||
std::mutex threadCntPerSessionMapMutex_;
|
||||
ActiveStatementCounter* statementsRunningCount_ = nullptr;
|
||||
joblist::DistributedEngineComm* dec_ = nullptr;
|
||||
joblist::ResourceManager* rm_ = nullptr;
|
||||
// Its attributes are set in Child()
|
||||
querytele::QueryTeleServerParms teleServerParms_;
|
||||
std::vector<struct in_addr> localNetIfaceSins_;
|
||||
};
|
||||
extern ServiceExeMgr* globServiceExeMgr;
|
||||
}
|
||||
freeifaddrs(netIfacesList);
|
||||
}
|
||||
logging::Logger msgLog_;
|
||||
SessionMemMap_t sessionMemMap_; // track memory% usage during a query
|
||||
std::mutex sessionMemMapMutex_;
|
||||
//...The FrontEnd may establish more than 1 connection (which results in
|
||||
// more than 1 ExeMgr thread) per session. These threads will share
|
||||
// the same CalpontSystemCatalog object for that session. Here, we
|
||||
// define a std::map to track how many threads are sharing each session, so
|
||||
// that we know when we can safely delete a CalpontSystemCatalog object
|
||||
// shared by multiple threads per session.
|
||||
ThreadCntPerSessionMap_t threadCntPerSessionMap_;
|
||||
std::mutex threadCntPerSessionMapMutex_;
|
||||
ActiveStatementCounter* statementsRunningCount_ = nullptr;
|
||||
joblist::DistributedEngineComm* dec_ = nullptr;
|
||||
joblist::ResourceManager* rm_ = nullptr;
|
||||
// Its attributes are set in Child()
|
||||
querytele::QueryTeleServerParms teleServerParms_;
|
||||
std::vector<struct in_addr> localNetIfaceSins_;
|
||||
};
|
||||
extern ServiceExeMgr* globServiceExeMgr;
|
||||
} // namespace exemgr
|
@ -34,6 +34,7 @@
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
@ -80,7 +81,7 @@ class UmSocketSelector
|
||||
/** @brief UmSocketSelector destructor
|
||||
*
|
||||
*/
|
||||
~UmSocketSelector(){};
|
||||
~UmSocketSelector() = default;
|
||||
|
||||
/** @brief Accessor to total number of UM IP's in Columnstore.xml.
|
||||
*
|
||||
@ -152,15 +153,15 @@ class UmModuleIPs
|
||||
*
|
||||
* @param moduleName (in) UM module name for this UmModuleIPs object.
|
||||
*/
|
||||
explicit UmModuleIPs(const std::string& moduleName)
|
||||
: fUmModuleName(moduleName), fNextUmIPSocketIdx(NEXT_IP_SOCKET_UNASSIGNED)
|
||||
explicit UmModuleIPs(std::string moduleName)
|
||||
: fUmModuleName(std::move(moduleName)), fNextUmIPSocketIdx(NEXT_IP_SOCKET_UNASSIGNED)
|
||||
{
|
||||
}
|
||||
|
||||
/** @brief UmModuleIPs destructor.
|
||||
*
|
||||
*/
|
||||
~UmModuleIPs(){};
|
||||
~UmModuleIPs() = default;
|
||||
|
||||
/** @brief Accessor to number of IP's from Columnstore.xml for this UM.
|
||||
*
|
||||
@ -258,15 +259,13 @@ class UmIPSocketConns
|
||||
/** @brief UmIPSocketConns destructor.
|
||||
*
|
||||
*/
|
||||
~UmIPSocketConns()
|
||||
{
|
||||
}
|
||||
~UmIPSocketConns() = default;
|
||||
|
||||
/** @brief Accessor to the IP address for this UmIPSocketConns object.
|
||||
*
|
||||
* @return IP address (in network byte order).
|
||||
*/
|
||||
in_addr_t ipAddress()
|
||||
in_addr_t ipAddress() const
|
||||
{
|
||||
return fIpAddress;
|
||||
}
|
||||
|
Reference in New Issue
Block a user