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

MCOL-1474 Add error handling to PTP

PriorityThreadPool didn't have very good error handling. If something
failed it would just ignore whatever was being processed. This could
lead to a query continuing without retreiving all of the required data.

This patch adds error handling, sending a message back to the client
and a log message. It also destroys and recreates the pool thread.
This commit is contained in:
Andrew Hutchings
2018-06-14 16:28:06 +01:00
parent 250d90a9bc
commit 40405c792a
3 changed files with 98 additions and 8 deletions

View File

@ -1818,12 +1818,22 @@ struct ReadThread
switch(ismHdr->Command) {
case DICT_CREATE_EQUALITY_FILTER: {
PriorityThreadPool::Job job;
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
job.functor = boost::shared_ptr<PriorityThreadPool::Functor>(new CreateEqualityFilter(bs));
OOBPool->addJob(job);
break;
}
case DICT_DESTROY_EQUALITY_FILTER: {
PriorityThreadPool::Job job;
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
job.functor = boost::shared_ptr<PriorityThreadPool::Functor>(new DestroyEqualityFilter(bs));
OOBPool->addJob(job);
break;
@ -1851,6 +1861,11 @@ struct ReadThread
job.id = hdr->Hdr.UniqueID;
job.weight = LOGICAL_BLOCK_RIDS;
job.priority = hdr->Hdr.Priority;
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
if (hdr->flags & IS_SYSCAT) {
//boost::thread t(DictScanJob(outIos, bs, writeLock));
// using already-existing threads may cut latency
@ -1889,6 +1904,12 @@ struct ReadThread
job.id = bpps->getID();
job.weight = ismHdr->Size;
job.priority = bpps->priority();
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
if (bpps->isSysCat()) {
//boost::thread t(*bpps);
// using already-existing threads may cut latency
@ -1904,6 +1925,11 @@ struct ReadThread
case BATCH_PRIMITIVE_CREATE: {
PriorityThreadPool::Job job;
job.functor = boost::shared_ptr<PriorityThreadPool::Functor>(new BPPHandler::Create(fBPPHandler, bs));
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
OOBPool->addJob(job);
//fBPPHandler->createBPP(*bs);
break;
@ -1912,6 +1938,11 @@ struct ReadThread
PriorityThreadPool::Job job;
job.functor = boost::shared_ptr<PriorityThreadPool::Functor>(new BPPHandler::AddJoiner(fBPPHandler, bs));
job.id = fBPPHandler->getUniqueID(bs, ismHdr->Command);
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
OOBPool->addJob(job);
//fBPPHandler->addJoinerToBPP(*bs);
break;
@ -1923,6 +1954,11 @@ struct ReadThread
PriorityThreadPool::Job job;
job.functor = boost::shared_ptr<PriorityThreadPool::Functor>(new BPPHandler::LastJoiner(fBPPHandler, bs));
job.id = fBPPHandler->getUniqueID(bs, ismHdr->Command);
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
OOBPool->addJob(job);
break;
}
@ -1932,6 +1968,11 @@ struct ReadThread
PriorityThreadPool::Job job;
job.functor = boost::shared_ptr<PriorityThreadPool::Functor>(new BPPHandler::Destroy(fBPPHandler, bs));
job.id = fBPPHandler->getUniqueID(bs, ismHdr->Command);
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
OOBPool->addJob(job);
//fBPPHandler->destroyBPP(*bs);
break;
@ -1946,6 +1987,11 @@ struct ReadThread
PriorityThreadPool::Job job;
job.functor = boost::shared_ptr<PriorityThreadPool::Functor>(new BPPHandler::Abort(fBPPHandler, bs));
job.id = fBPPHandler->getUniqueID(bs, ismHdr->Command);
const uint8_t *buf = bs->buf();
uint32_t pos = sizeof(ISMPacketHeader) - 2;
job.stepID = *((uint32_t *) &buf[pos+6]);
job.uniqueID = *((uint32_t *) &buf[pos+10]);
job.sock = outIos;
OOBPool->addJob(job);
break;
}