1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Merge pull request #2468 from drrtuy/MCOL-5044-reenable-fair

Revert "This patch disables FairThreadPool to double check if this fe…
This commit is contained in:
Roman Nozdrin
2022-07-22 19:37:45 +03:00
committed by GitHub
12 changed files with 252 additions and 76 deletions

View File

@ -4,7 +4,7 @@ include_directories( ${ENGINE_COMMON_INCLUDES} )
########### next target ###############
set(threadpool_LIB_SRCS weightedthreadpool.cpp threadpool.cpp prioritythreadpool.cpp)
set(threadpool_LIB_SRCS weightedthreadpool.cpp threadpool.cpp prioritythreadpool.cpp fair_threadpool.cpp)
add_library(threadpool SHARED ${threadpool_LIB_SRCS})
add_dependencies(threadpool loggingcpp)
target_link_libraries(threadpool Boost::chrono)

View File

@ -52,33 +52,19 @@ class PriorityThreadPool
// this thread pool to reschedule the job, 0 will throw it away on return.
virtual int operator()() = 0;
};
using TransactionIdxT = uint32_t;
struct Job
{
Job() : weight(1), priority(0), id(0)
{
}
Job(const uint32_t uniqueID, const uint32_t stepID, const TransactionIdxT txnIdx,
const boost::shared_ptr<Functor>& functor, const primitiveprocessor::SP_UM_IOSOCK& sock,
const uint32_t weight = 1, const uint32_t priority = 0, const uint32_t id = 0)
: uniqueID(uniqueID)
, stepID(stepID)
, txnIdx(txnIdx)
, functor(functor)
, sock(sock)
, weight(weight)
, priority(priority)
, id(id)
{
}
uint32_t uniqueID;
uint32_t stepID;
TransactionIdxT txnIdx;
boost::shared_ptr<Functor> functor;
primitiveprocessor::SP_UM_IOSOCK sock;
uint32_t weight;
uint32_t priority;
uint32_t id;
uint32_t uniqueID;
uint32_t stepID;
primitiveprocessor::SP_UM_IOSOCK sock;
};
enum Priority
@ -128,7 +114,7 @@ class PriorityThreadPool
{
return blockedThreads;
}
protected:
private:
struct ThreadHelper