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

Revert "No boost condition (#2822)" (#2828)

This reverts commit f916e64927.
This commit is contained in:
Roman Nozdrin
2023-04-22 13:49:50 +01:00
committed by GitHub
parent f916e64927
commit 4fe9cd64a3
245 changed files with 2007 additions and 1261 deletions

View File

@ -31,7 +31,7 @@
using namespace std;
#include "blockrequestprocessor.h"
#include "rwlock_local.h"
#include "dbrm.h"
#include "pp_logger.h"
#include "mcsconfig.h"
@ -154,7 +154,7 @@ int BlockRequestProcessor::check(fileRequest& rqstBlk)
sendRequest(rqstBlk); // start file read request
while (rqstBlk.frPredicate() < fileRequest::COMPLETE)
rqstBlk.frCond().wait(rqstBlk.frMutex()); ///////////////XXXXXXXXXXXXXXXXXXXxx
rqstBlk.frCond().wait(rqstBlk.frMutex());
rqstBlk.frMutex().unlock();

View File

@ -167,7 +167,7 @@ class BlockRequestProcessor
FileBufferMgr fbMgr;
fileBlockRequestQueue fBRPRequestQueue;
ioManager fIOMgr;
std::mutex check_mutex;
boost::mutex check_mutex;
/**
* helper function for public check functions

View File

@ -24,7 +24,7 @@
***************************************************************************/
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include "fileblockrequestqueue.h"
@ -76,19 +76,19 @@ void fileBlockRequestQueue::stop()
fileRequest* fileBlockRequestQueue::pop(void)
{
std::unique_lock lock(mutex); // pthread_mutex_lock(&mutex);
mutex.lock(); // pthread_mutex_lock(&mutex);
while (queueSize == 0)
{
readersWaiting++;
notEmpty.wait(lock); // pthread_cond_wait(&notEmpty, &mutex);
notEmpty.wait(mutex); // pthread_cond_wait(&notEmpty, &mutex);
readersWaiting--;
}
fileRequest* blk = fbQueue.front();
fbQueue.pop_front();
--queueSize;
mutex.unlock(); // pthread_mutex_unlock(&mutex);
return blk;
}

View File

@ -27,7 +27,7 @@
#include <deque>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <iostream>
#include "filerequest.h"
@ -88,8 +88,8 @@ class fileBlockRequestQueue
void stop();
protected:
std::mutex mutex;
std::condition_variable notEmpty;
boost::mutex mutex;
boost::condition notEmpty;
fileBlockRequestQueue_t fbQueue;
uint32_t queueSize;
uint32_t readersWaiting;

View File

@ -100,7 +100,7 @@ void FileBufferMgr::setReportingFrequency(const uint32_t d)
void FileBufferMgr::flushCache()
{
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
{
filebuffer_uset_t sEmpty;
filebuffer_list_t lEmpty;
@ -126,7 +126,7 @@ void FileBufferMgr::flushCache()
void FileBufferMgr::flushOne(const BRM::LBID_t lbid, const BRM::VER_t ver)
{
// similar in function to depleteCache()
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
filebuffer_uset_iter_t iter = fbSet.find(HashObject_t(lbid, ver, 0));
@ -146,7 +146,7 @@ void FileBufferMgr::flushOne(const BRM::LBID_t lbid, const BRM::VER_t ver)
void FileBufferMgr::flushMany(const LbidAtVer* laVptr, uint32_t cnt)
{
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
BRM::LBID_t lbid;
BRM::VER_t ver;
@ -193,7 +193,7 @@ void FileBufferMgr::flushManyAllversion(const LBID_t* laVptr, uint32_t cnt)
tr1::unordered_set<LBID_t> uniquer;
tr1::unordered_set<LBID_t>::iterator uit;
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
if (fReportFrequency)
{
@ -258,7 +258,7 @@ void FileBufferMgr::flushOIDs(const uint32_t* oids, uint32_t count)
// If there are more than this # of extents to drop, the whole cache will be cleared
const uint32_t clearThreshold = 50000;
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
if (fCacheSize == 0 || count == 0)
return;
@ -315,7 +315,7 @@ void FileBufferMgr::flushPartition(const vector<OID_t>& oids, const set<BRM::Log
filebuffer_uset_t::iterator it;
uint32_t count = oids.size();
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
if (fReportFrequency)
{
@ -388,7 +388,7 @@ bool FileBufferMgr::exists(const BRM::LBID_t& lbid, const BRM::VER_t& ver) const
FileBuffer* FileBufferMgr::findPtr(const HashObject_t& keyFb)
{
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
filebuffer_uset_iter_t it = fbSet.find(keyFb);
@ -407,7 +407,7 @@ bool FileBufferMgr::find(const HashObject_t& keyFb, FileBuffer& fb)
{
bool ret = false;
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
filebuffer_uset_iter_t it = fbSet.find(keyFb);
@ -428,7 +428,7 @@ bool FileBufferMgr::find(const HashObject_t& keyFb, void* bufferPtr)
if (gPMProfOn && gPMStatsPtr)
gPMStatsPtr->markEvent(keyFb.lbid, pthread_self(), gSession, 'L');
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
if (gPMProfOn && gPMStatsPtr)
gPMStatsPtr->markEvent(keyFb.lbid, pthread_self(), gSession, 'M');
@ -467,7 +467,7 @@ uint32_t FileBufferMgr::bulkFind(const BRM::LBID_t* lbids, const BRM::VER_t* ver
}
}
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
if (gPMProfOn && gPMStatsPtr)
{
@ -520,7 +520,7 @@ uint32_t FileBufferMgr::bulkFind(const BRM::LBID_t* lbids, const BRM::VER_t* ver
bool FileBufferMgr::exists(const HashObject_t& fb) const
{
bool find_bool = false;
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
filebuffer_uset_iter_t it = fbSet.find(fb);
@ -547,7 +547,7 @@ int FileBufferMgr::insert(const BRM::LBID_t lbid, const BRM::VER_t ver, const ui
if (gPMProfOn && gPMStatsPtr)
gPMStatsPtr->markEvent(lbid, pthread_self(), gSession, 'I');
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
HashObject_t fbIndex(lbid, ver, 0);
filebuffer_pair_t pr = fbSet.insert(fbIndex);
@ -740,7 +740,7 @@ int FileBufferMgr::bulkInsert(const vector<CacheInsert_t>& ops)
int32_t pi;
int ret = 0;
std::unique_lock lk(fWLock);
boost::mutex::scoped_lock lk(fWLock);
if (fReportFrequency)
{

View File

@ -33,7 +33,7 @@
#include "primitivemsg.h"
#include "blocksize.h"
#include "filebuffer.h"
#include "rwlock_local.h"
/**
@author Jason Rodriguez <jrodriguez@calpont.com>
@ -209,7 +209,7 @@ class FileBufferMgr
uint32_t fMaxNumBlocks; // the max number of blockSz blocks to keep in the Cache list
uint32_t fBlockSz; // size in bytes size of a data block - probably 8
mutable std::mutex fWLock;
mutable boost::mutex fWLock;
mutable filebuffer_uset_t fbSet;
mutable filebuffer_list_t fbList; // rename this

View File

@ -29,7 +29,7 @@
#include <string>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include "brmtypes.h"
@ -245,7 +245,7 @@ class fileRequest
/**
* @brief mutex to control synchronzation of request processing
**/
std::mutex& frMutex() const
boost::mutex& frMutex() const
{
return fFRMutex;
}
@ -253,7 +253,7 @@ class fileRequest
/**
* @brief condition variable. signal when request is complete
**/
std::condition_variable_any& frCond() const
boost::condition& frCond() const
{
return fFRCond;
}
@ -304,8 +304,8 @@ class fileRequest
BRM::QueryContext fVer;
bool fFlg;
BRM::VER_t fTxn;
mutable std::mutex fFRMutex;
mutable std::condition_variable_any fFRCond;
mutable boost::mutex fFRMutex;
mutable boost::condition fFRCond;
predicate_status_enum fFRPredicate;
uint32_t fLength; // lbids requested
uint32_t fblksRead; // lbids read

View File

@ -59,9 +59,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/scoped_array.hpp>
#include <boost/thread.hpp>
#include <condition_variable>
#include <shared_mutex>
#include <boost/thread/condition.hpp>
#include <pthread.h>
//#define NDEBUG
#include <cassert>
@ -81,7 +79,7 @@ using namespace logging;
#include "fsutils.h"
#include "rwlock_local.h"
#include "iomanager.h"
#include "liboamcpp.h"
@ -257,9 +255,8 @@ struct fdCountCompare
typedef multiset<FdCountEntry_t, fdCountCompare> FdCacheCountType_t;
FdCacheType_t fdcache;
std::mutex fdMapMutex;
std::shared_mutex localLock;
boost::mutex fdMapMutex;
rwlock::RWLock_local localLock;
char* alignTo(const char* in, int av)
{
@ -461,13 +458,13 @@ void* thr_popper(ioManager* arg)
if (locked)
{
localLock.unlock_shared();
localLock.read_unlock();
locked = false;
}
fr = iom->getNextRequest();
localLock.lock_shared();
localLock.read_lock();
locked = true;
if (iom->IOTrace())
@ -527,7 +524,7 @@ void* thr_popper(ioManager* arg)
#ifdef IDB_COMP_POC_DEBUG
{
std::unique_lock lk(primitiveprocessor::compDebugMutex);
boost::mutex::scoped_lock lk(primitiveprocessor::compDebugMutex);
if (compType != 0)
cout << boldStart;
@ -860,7 +857,7 @@ void* thr_popper(ioManager* arg)
i = fp->pread(&alignedbuff[0], fdit->second->ptrList[idx].first, fdit->second->ptrList[idx].second);
#ifdef IDB_COMP_POC_DEBUG
{
std::unique_lock lk(primitiveprocessor::compDebugMutex);
boost::mutex::scoped_lock lk(primitiveprocessor::compDebugMutex);
cout << boldStart << "pread1.1(" << fp << ", 0x" << hex << (ptrdiff_t)&alignedbuff[0] << dec
<< ", " << fdit->second->ptrList[idx].second << ", " << fdit->second->ptrList[idx].first
<< ") = " << i << ' ' << cmpOffFact.quot << ' ' << cmpOffFact.rem << boldStop << endl;
@ -907,7 +904,7 @@ void* thr_popper(ioManager* arg)
i = fp->pread(&alignedbuff[acc], longSeekOffset, readSize - acc);
#ifdef IDB_COMP_POC_DEBUG
{
std::unique_lock lk(primitiveprocessor::compDebugMutex);
boost::mutex::scoped_lock lk(primitiveprocessor::compDebugMutex);
cout << "pread1.2(" << fp << ", 0x" << hex << (ptrdiff_t)&alignedbuff[acc] << dec << ", "
<< (readSize - acc) << ", " << longSeekOffset << ") = " << i << ' ' << cmpOffFact.quot << ' '
<< cmpOffFact.rem << endl;
@ -995,7 +992,7 @@ void* thr_popper(ioManager* arg)
size_t blen = 4 * 1024 * 1024 + 4;
#ifdef IDB_COMP_POC_DEBUG
{
std::unique_lock lk(primitiveprocessor::compDebugMutex);
boost::mutex::scoped_lock lk(primitiveprocessor::compDebugMutex);
cout << "decompress(0x" << hex << (ptrdiff_t)&alignedbuff[0] << dec << ", "
<< fdit->second->ptrList[cmpOffFact.quot].second << ", 0x" << hex << (ptrdiff_t)uCmpBuf
<< dec << ", " << blen << ")" << endl;
@ -1016,7 +1013,7 @@ void* thr_popper(ioManager* arg)
if (dcrc != 0)
{
#ifdef IDB_COMP_POC_DEBUG
std::unique_lock lk(primitiveprocessor::compDebugMutex);
boost::mutex::scoped_lock lk(primitiveprocessor::compDebugMutex);
#endif
if (++decompRetryCount < 30)
@ -1085,7 +1082,7 @@ void* thr_popper(ioManager* arg)
{
if (debugWrite)
{
std::unique_lock lk(primitiveprocessor::compDebugMutex);
boost::mutex::scoped_lock lk(primitiveprocessor::compDebugMutex);
cout << boldStart << "i = " << i << ", ptr = 0x" << hex << (ptrdiff_t)&ptr[i * BLOCK_SIZE]
<< dec << boldStop << endl;
cout << boldStart;
@ -1203,22 +1200,23 @@ namespace dbbc
{
void setReadLock()
{
localLock.lock_shared();
localLock.read_lock();
}
void releaseReadLock()
{
localLock.unlock_shared();
localLock.read_unlock();
}
void dropFDCache()
{
std::unique_lock lock(localLock);
localLock.write_lock();
fdcache.clear();
localLock.write_unlock();
}
void purgeFDCache(std::vector<BRM::FileInfo>& files)
{
std::unique_lock lock(localLock);
localLock.write_lock();
FdCacheType_t::iterator fdit;
@ -1231,6 +1229,8 @@ void purgeFDCache(std::vector<BRM::FileInfo>& files)
if (fdit != fdcache.end())
fdcache.erase(fdit);
}
localLock.write_unlock();
}
ioManager::ioManager(FileBufferMgr& fbm, fileBlockRequestQueue& fbrq, int thrCount, int bsPerRead)