You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-06-16 14:20:56 +03:00
MCOL-834 Fix crashes introduced
* Fix race condition in cleanup * Fix mutex cleanup crash
This commit is contained in:
@ -1765,6 +1765,8 @@ int BatchPrimitiveProcessor::operator()()
|
||||
|
||||
vssCache.clear();
|
||||
#ifndef __FreeBSD__
|
||||
if (sendThread->aborted())
|
||||
objLock.try_lock();
|
||||
objLock.unlock();
|
||||
#endif
|
||||
freeLargeBuffers();
|
||||
|
@ -121,7 +121,7 @@ class BatchPrimitiveProcessor
|
||||
|
||||
// these two functions are used by BPPV to create BPP instances
|
||||
// on demand. TRY not to use unlock() for anything else.
|
||||
void unlock() { objLock.unlock(); }
|
||||
void unlock() { objLock.try_lock(); objLock.unlock(); }
|
||||
bool hasJoin() { return doJoin; }
|
||||
private:
|
||||
BatchPrimitiveProcessor();
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <cassert>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#ifdef _MSC_VER
|
||||
#include <unordered_map>
|
||||
typedef int pthread_t;
|
||||
@ -1152,21 +1153,21 @@ struct BPPHandler
|
||||
|
||||
~BPPHandler()
|
||||
{
|
||||
mutex::scoped_lock scoped(bppLock);
|
||||
for (bppKeysIt = bppKeys.begin() ; bppKeysIt != bppKeys.end(); ++bppKeysIt)
|
||||
{
|
||||
uint32_t key = *bppKeysIt;
|
||||
BPPMap::iterator it;
|
||||
|
||||
mutex::scoped_lock scoped(bppLock);
|
||||
it = bppMap.find(key);
|
||||
if (it != bppMap.end()) {
|
||||
it->second->abort();
|
||||
bppMap.erase(it);
|
||||
}
|
||||
scoped.unlock();
|
||||
fPrimitiveServerPtr->getProcessorThreadPool()->removeJobs(key);
|
||||
OOBPool->removeJobs(key);
|
||||
}
|
||||
scoped.unlock();
|
||||
}
|
||||
|
||||
struct BPPHandlerFunctor : public PriorityThreadPool::Functor {
|
||||
@ -1224,11 +1225,11 @@ struct BPPHandler
|
||||
|
||||
bs.advance(sizeof(ISMPacketHeader));
|
||||
bs >> key;
|
||||
mutex::scoped_lock scoped(bppLock);
|
||||
bppKeysIt = std::find(bppKeys.begin(), bppKeys.end(), key);
|
||||
if (bppKeysIt != bppKeys.end()) {
|
||||
bppKeys.erase(bppKeysIt);
|
||||
}
|
||||
mutex::scoped_lock scoped(bppLock);
|
||||
it = bppMap.find(key);
|
||||
if (it != bppMap.end()) {
|
||||
it->second->abort();
|
||||
@ -1300,9 +1301,9 @@ struct BPPHandler
|
||||
bppv->add(dup);
|
||||
}
|
||||
}
|
||||
mutex::scoped_lock scoped(bppLock);
|
||||
key = bpp->getUniqueID();
|
||||
bppKeys.push_back(key);
|
||||
mutex::scoped_lock scoped(bppLock);
|
||||
bool newInsert;
|
||||
newInsert = bppMap.insert(pair<uint32_t, SBPPV>(key, bppv)).second;
|
||||
//cout << "creating BPP # " << key << endl;
|
||||
@ -2210,6 +2211,10 @@ boost::shared_ptr<BatchPrimitiveProcessor> BPPV::next()
|
||||
void BPPV::abort()
|
||||
{
|
||||
sendThread->abort();
|
||||
BOOST_FOREACH( boost::shared_ptr<BatchPrimitiveProcessor> bpp, v )
|
||||
{
|
||||
bpp->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool BPPV::aborted()
|
||||
|
Reference in New Issue
Block a user