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
MCOL-513 use thread pool for jobsteps
This commit is contained in:
@ -180,14 +180,13 @@ void TupleBPS::initializeConfigParms()
|
||||
else
|
||||
fMaxNumThreads = 1;
|
||||
|
||||
fProducerThread.reset(new SPTHD[fMaxNumThreads]);
|
||||
// Make maxnum thread objects even if they don't get used to make join() safe.
|
||||
for (uint32_t i = 0; i < fMaxNumThreads; i++)
|
||||
fProducerThread[i].reset(new thread());
|
||||
// Reserve the max number of thread space. A bit of an optimization.
|
||||
fProducerThreads.clear();
|
||||
fProducerThreads.reserve(fMaxNumThreads);
|
||||
}
|
||||
|
||||
TupleBPS::TupleBPS(const pColStep& rhs, const JobInfo& jobInfo) :
|
||||
BatchPrimitive(jobInfo), fRm(jobInfo.rm)
|
||||
BatchPrimitive(jobInfo), pThread(0), fRm(jobInfo.rm)
|
||||
{
|
||||
fInputJobStepAssociation = rhs.inputAssociation();
|
||||
fOutputJobStepAssociation = rhs.outputAssociation();
|
||||
@ -800,7 +799,7 @@ void TupleBPS::storeCasualPartitionInfo(const bool estimateRowCounts)
|
||||
|
||||
void TupleBPS::startPrimitiveThread()
|
||||
{
|
||||
pThread.reset(new boost::thread(TupleBPSPrimitive(this)));
|
||||
pThread = jobstepThreadPool.invoke(TupleBPSPrimitive(this));
|
||||
}
|
||||
|
||||
void TupleBPS::startAggregationThread()
|
||||
@ -809,13 +808,13 @@ void TupleBPS::startAggregationThread()
|
||||
// fMaxNumThreads = 1;
|
||||
// fNumThreads = fMaxNumThreads;
|
||||
// for (uint32_t i = 0; i < fMaxNumThreads; i++)
|
||||
// fProducerThread[i].reset(new boost::thread(TupleBPSAggregators(this, i)));
|
||||
// fProducerThreads.push_back(jobstepThreadPool.invoke(TupleBPSAggregators(this, i)));
|
||||
|
||||
// This block of code starts one thread at a time
|
||||
if (fNumThreads >= fMaxNumThreads)
|
||||
return;
|
||||
fNumThreads++;
|
||||
fProducerThread[fNumThreads-1].reset(new boost::thread(TupleBPSAggregators(this, fNumThreads-1)));
|
||||
fProducerThreads.push_back(jobstepThreadPool.invoke(TupleBPSAggregators(this, fNumThreads-1)));
|
||||
}
|
||||
|
||||
//#include "boost/date_time/posix_time/posix_time.hpp"
|
||||
@ -1117,6 +1116,8 @@ void TupleBPS::run()
|
||||
serializeJoiner();
|
||||
prepCasualPartitioning();
|
||||
startPrimitiveThread();
|
||||
fProducerThreads.clear();
|
||||
fProducerThreads.reserve(fMaxNumThreads);
|
||||
startAggregationThread();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
@ -1153,10 +1154,10 @@ void TupleBPS::join()
|
||||
}
|
||||
|
||||
if (pThread)
|
||||
pThread->join();
|
||||
jobstepThreadPool.join(pThread);
|
||||
|
||||
jobstepThreadPool.join(fProducerThreads);
|
||||
|
||||
for (uint32_t i = 0; i < fMaxNumThreads; i++)
|
||||
fProducerThread[i]->join();
|
||||
if (BPPIsAllocated) {
|
||||
ByteStream bs;
|
||||
fDec->removeDECEventListener(this);
|
||||
|
Reference in New Issue
Block a user