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

MCOL-5044 Adding EXTRA thread logic into FairThreadPool

This commit is contained in:
Roman Nozdrin
2022-06-21 19:17:03 +00:00
committed by Roman Nozdrin
parent 6cff14997d
commit 0e8014db02
7 changed files with 64 additions and 21 deletions

View File

@ -24,12 +24,13 @@
#pragma once
#include "fair_threadpool.h"
#include "umsocketselector.h"
#include <queue>
#include <set>
#include <condition_variable>
#include "threadnaming.h"
#include "prioritythreadpool.h"
#include "fair_threadpool.h"
namespace primitiveprocessor
{
@ -84,7 +85,7 @@ class BPPSendThread
{
return die;
}
void setProcessorPool(boost::shared_ptr<threadpool::PriorityThreadPool> processorPool)
void setProcessorPool(boost::shared_ptr<threadpool::FairThreadPool> processorPool)
{
fProcessorPool = processorPool;
}
@ -146,9 +147,9 @@ class BPPSendThread
/* secondary queue size restriction based on byte size */
volatile uint64_t currentByteSize;
uint64_t maxByteSize;
// Used to tell the PriorityThreadPool It should consider additional threads because a
// Used to tell the ThreadPool It should consider additional threads because a
// queue full event has happened and a thread has been blocked.
boost::shared_ptr<threadpool::PriorityThreadPool> fProcessorPool;
boost::shared_ptr<threadpool::FairThreadPool> fProcessorPool;
};
} // namespace primitiveprocessor

View File

@ -1947,7 +1947,7 @@ struct ReadThread
void operator()()
{
utils::setThreadName("PPReadThread");
threadpool::FairThreadPool* procPoolPtr = fPrimitiveServerPtr->getProcessorThreadPool();
boost::shared_ptr<threadpool::FairThreadPool> procPoolPtr = fPrimitiveServerPtr->getProcessorThreadPool();
SBS bs;
UmSocketSelector* pUmSocketSelector = UmSocketSelector::instance();
@ -2322,8 +2322,8 @@ PrimitiveServer::PrimitiveServer(int serverThreads, int serverQueueSize, int pro
fServerpool.setQueueSize(fServerQueueSize);
fServerpool.setName("PrimitiveServer");
fProcessorPool = new threadpool::FairThreadPool(fProcessorWeight, highPriorityThreads,
medPriorityThreads, lowPriorityThreads, 0);
fProcessorPool.reset(new threadpool::FairThreadPool(fProcessorWeight, highPriorityThreads,
medPriorityThreads, lowPriorityThreads, 0));
// We're not using either the priority or the job-clustering features, just need a threadpool
// that can reschedule jobs, and an unlimited non-blocking queue

View File

@ -36,7 +36,7 @@
#include <boost/thread.hpp>
#include "threadpool.h"
#include "../../utils/threadpool/prioritythreadpool.h"
#include "../../utils/threadpool/fair_threadpool.h"
#include "fair_threadpool.h"
#include "messagequeue.h"
#include "blockrequestprocessor.h"

View File

@ -18,29 +18,29 @@
#pragma once
#include <boost/shared_ptr.hpp>
#include "prioritythreadpool.h"
#include "fair_threadpool.h"
class PrimitiveServerThreadPools
{
public:
PrimitiveServerThreadPools() = default;
PrimitiveServerThreadPools(boost::shared_ptr<threadpool::PriorityThreadPool> primServerThreadPool,
boost::shared_ptr<threadpool::PriorityThreadPool> OOBThreadPool)
PrimitiveServerThreadPools(boost::shared_ptr<threadpool::FairThreadPool> primServerThreadPool,
boost::shared_ptr<threadpool::FairThreadPool> OOBThreadPool)
: fPrimServerThreadPool(primServerThreadPool), fOOBThreadPool(OOBThreadPool)
{
}
boost::shared_ptr<threadpool::PriorityThreadPool> getPrimitiveServerThreadPool()
boost::shared_ptr<threadpool::FairThreadPool> getPrimitiveServerThreadPool()
{
return fPrimServerThreadPool;
}
boost::shared_ptr<threadpool::PriorityThreadPool> getOOBThreadPool()
boost::shared_ptr<threadpool::FairThreadPool> getOOBThreadPool()
{
return fOOBThreadPool;
}
private:
boost::shared_ptr<threadpool::PriorityThreadPool> fPrimServerThreadPool;
boost::shared_ptr<threadpool::PriorityThreadPool> fOOBThreadPool;
boost::shared_ptr<threadpool::FairThreadPool> fPrimServerThreadPool;
boost::shared_ptr<threadpool::FairThreadPool> fOOBThreadPool;
};

View File

@ -35,7 +35,7 @@
#include <map>
#include "service.h"
#include "prioritythreadpool.h"
#include "fair_threadpool.h"
#include "pp_logger.h"
namespace primitiveprocessor
@ -172,12 +172,12 @@ class ServicePrimProc : public Service, public Opt
return startupRaceFlag_;
}
boost::shared_ptr<threadpool::PriorityThreadPool> getPrimitiveServerThreadPool()
boost::shared_ptr<threadpool::FairThreadPool> getPrimitiveServerThreadPool()
{
return primServerThreadPool;
}
boost::shared_ptr<threadpool::PriorityThreadPool> getOOBThreadPool()
boost::shared_ptr<threadpool::FairThreadPool> getOOBThreadPool()
{
return OOBThreadPool;
}
@ -190,6 +190,6 @@ class ServicePrimProc : public Service, public Opt
static ServicePrimProc* fInstance;
// Since C++20 flag's init value is false.
std::atomic_flag startupRaceFlag_{false};
boost::shared_ptr<threadpool::PriorityThreadPool> primServerThreadPool;
boost::shared_ptr<threadpool::PriorityThreadPool> OOBThreadPool;
boost::shared_ptr<threadpool::FairThreadPool> primServerThreadPool;
boost::shared_ptr<threadpool::FairThreadPool> OOBThreadPool;
};