1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +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

@ -32,7 +32,7 @@
#include <queue>
using namespace std;
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <boost/scoped_array.hpp>
#include <boost/thread.hpp>
using namespace boost;
@ -89,7 +89,7 @@ void WECpiFeederThread::add2MsgQueue(ByteStream& Ibs)
// TODO creating copy is NOT good; later read from socket using a SBS
messageqcpp::SBS aSbs(new messageqcpp::ByteStream(Ibs));
Ibs.reset(); // forcefully clearing it
std::unique_lock aLock(fMsgQMutex);
boost::mutex::scoped_lock aLock(fMsgQMutex);
// cout << "pushing to the MsgQueue" << endl;
fMsgQueue.push(aSbs);
fFeederCond.notify_one(); // as per preference of Damon
@ -102,11 +102,11 @@ void WECpiFeederThread::feedData2Cpi()
{
while (isContinue())
{
std::unique_lock aLock(fMsgQMutex);
boost::mutex::scoped_lock aLock(fMsgQMutex);
if (fMsgQueue.empty())
{
bool aTimedOut = (fFeederCond.wait_for(aLock, std::chrono::milliseconds(3000)) == std::cv_status::timeout);
bool aTimedOut = fFeederCond.timed_wait(aLock, boost::posix_time::milliseconds(3000));
if (!isContinue())
{
@ -154,7 +154,7 @@ void WECpiFeederThread::feedData2Cpi()
bool WECpiFeederThread::isMsgQueueEmpty()
{
bool aRet = false;
std::unique_lock aLock(fMsgQMutex);
boost::mutex::scoped_lock aLock(fMsgQMutex);
aRet = fMsgQueue.empty();
aLock.unlock();
return aRet;
@ -164,7 +164,7 @@ bool WECpiFeederThread::isMsgQueueEmpty()
void WECpiFeederThread::stopThread()
{
std::unique_lock aCondLock(fContMutex);
boost::mutex::scoped_lock aCondLock(fContMutex);
fContinue = false;
aCondLock.unlock();
fFeederCond.notify_all();
@ -175,7 +175,7 @@ void WECpiFeederThread::stopThread()
bool WECpiFeederThread::isContinue()
{
std::unique_lock aCondLock(fContMutex);
boost::mutex::scoped_lock aCondLock(fContMutex);
return fContinue;
}

View File

@ -77,14 +77,14 @@ class WECpiFeederThread
private:
WEDataLoader& fOwner;
std::condition_variable fFeederCond;
std::mutex fMsgQMutex;
boost::condition fFeederCond;
boost::mutex fMsgQMutex;
typedef std::queue<messageqcpp::SBS> WEMsgQueue;
WEMsgQueue fMsgQueue;
boost::thread* fpThread;
bool fContinue;
std::mutex fContMutex;
boost::mutex fContMutex;
// bool fPushing;
bool fStopped;

View File

@ -38,7 +38,7 @@
#include <stdlib.h>
#include <time.h>
#include "bytestream.h"
#include "rwlock_local.h"
#include <iostream>
#include <fstream>
@ -48,7 +48,7 @@
#include <map>
using namespace std;
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <boost/scoped_array.hpp>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
@ -569,7 +569,7 @@ void WEDataLoader::onCpimportSuccess()
if (aRet)
{
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
// aBrmRptParser.unserialize(obs); - was for testing
updateTxBytes(obs.length());
@ -606,7 +606,7 @@ void WEDataLoader::onCpimportSuccess()
obs.reset();
obs << (ByteStream::byte)WE_CLT_SRV_CPIPASS;
obs << (ByteStream::byte)fPmId; // PM id
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -661,7 +661,7 @@ void WEDataLoader::onCpimportFailure()
if (aRet)
{
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -707,7 +707,7 @@ void WEDataLoader::sendCpimportFailureNotice()
ByteStream obs;
obs << (ByteStream::byte)WE_CLT_SRV_CPIFAIL;
obs << (ByteStream::byte)fPmId; // PM id
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -753,7 +753,7 @@ void WEDataLoader::onReceiveKeepAlive(ByteStream& Ibs)
ByteStream obs;
obs << (ByteStream::byte)WE_CLT_SRV_KEEPALIVE;
obs << (ByteStream::byte)fPmId; // PM id
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -812,7 +812,7 @@ void WEDataLoader::onReceiveKeepAlive(ByteStream& Ibs)
ByteStream obs;
obs << (ByteStream::byte)WE_CLT_SRV_EOD;
obs << (ByteStream::byte)fPmId; // PM id
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -934,7 +934,7 @@ void WEDataLoader::onReceiveEod(ByteStream& Ibs)
ByteStream obs;
obs << (ByteStream::byte)WE_CLT_SRV_EOD;
obs << (ByteStream::byte)fPmId; // PM id
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -1033,7 +1033,7 @@ void WEDataLoader::onReceiveMode(ByteStream& Ibs)
aObs << (ByteStream::byte)WE_CLT_SRV_DBRCNT;
aObs << (ByteStream::byte)fPmId;
aObs << (ByteStream::byte)aDbCnt;
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(aObs.length());
try
@ -1124,7 +1124,7 @@ void WEDataLoader::onReceiveCmdLineArgs(ByteStream& Ibs)
}
obs << (ByteStream::byte)fPmId; // PM id
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -1259,7 +1259,7 @@ void WEDataLoader::onReceiveCleanup(ByteStream& Ibs)
else
obs << (ByteStream::byte)0; // cleanup failed
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -1310,7 +1310,7 @@ void WEDataLoader::onReceiveRollback(ByteStream& Ibs)
else
obs << (ByteStream::byte)0; // Rollback failed
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -1353,7 +1353,7 @@ void WEDataLoader::onReceiveImportFileName(ByteStream& Ibs)
obs << (ByteStream::byte)WE_CLT_SRV_IMPFILEERROR;
obs << (ByteStream::byte)fPmId;
updateTxBytes(obs.length());
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
try
{
@ -1390,7 +1390,7 @@ void WEDataLoader::onReceiveImportFileName(ByteStream& Ibs)
ByteStream obs;
obs << (ByteStream::byte)WE_CLT_SRV_IMPFILEERROR;
obs << (ByteStream::byte)fPmId; // PM id
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -1470,7 +1470,7 @@ void WEDataLoader::onReceiveErrFileRqst(ByteStream& Ibs)
if (aRet)
{
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -1517,7 +1517,7 @@ void WEDataLoader::onReceiveBadFileRqst(ByteStream& Ibs)
if (aRet)
{
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
updateTxBytes(obs.length());
try
@ -1569,7 +1569,7 @@ void WEDataLoader::sendDataRequest()
}
}
std::unique_lock aLock(fClntMsgMutex);
boost::mutex::scoped_lock aLock(fClntMsgMutex);
ByteStream obs;
obs << (ByteStream::byte)WE_CLT_SRV_DATARQST;
obs << (ByteStream::byte)fPmId; // PM id

View File

@ -30,7 +30,7 @@
#pragma once
#include "rwlock_local.h"
#include "resourcemanager.h"
#include "we_simplesyslog.h"
@ -189,7 +189,7 @@ class WEDataLoader : public Observer
// CPI Feeder Thread
WECpiFeederThread* fpCfThread;
std::mutex fClntMsgMutex; // mutex in sending messages to client.
boost::mutex fClntMsgMutex; // mutex in sending messages to client.
// static bool fTearDownCpimport; // @bug 4267
bool fTearDownCpimport; // @bug 4267

View File

@ -295,8 +295,8 @@ uint8_t WE_DDLCommandProc::writeSystable(ByteStream& bs, std::string& err)
{
// MCOL-66 The DBRM can't handle concurrent transactions to sys tables
// TODO: This may be redundant
static std::mutex dbrmMutex;
std::unique_lock lk(dbrmMutex);
static boost::mutex dbrmMutex;
boost::mutex::scoped_lock lk(dbrmMutex);
error = fWEWrapper.insertColumnRec_SYS(txnID, cscColTypeList, colStructs, colValuesList,
dctnryStructList, dctnryValueList, SYSCOLUMN_BASE);

View File

@ -64,7 +64,7 @@ typedef std::vector<FileInfo> Files;
typedef std::map<uint32_t, Files> columnMap;
typedef std::map<int, columnMap*> allColumnMap;
allColumnMap wholeMap;
std::mutex columnMapLock;
boost::mutex columnMapLock;
ActiveThreadCounter* activeThreadCounter;
size_t readFillBuffer(idbdatafile::IDBDataFile* pFile, char* buffer, size_t bytesReq)
@ -243,7 +243,7 @@ struct ColumnThread
}
}
std::unique_lock lk(columnMapLock);
boost::mutex::scoped_lock lk(columnMapLock);
// cout << "Current size of columnsMap is " << columnsMap.size() << endl;
allColumnMap::iterator colMapiter = wholeMap.find(fKey);
@ -330,7 +330,7 @@ int WE_GetFileSizes::processTable(messageqcpp::ByteStream& bs, std::string& errM
columnMap* columnsMap = new columnMap();
{
std::unique_lock lk(columnMapLock);
boost::mutex::scoped_lock lk(columnMapLock);
wholeMap[key] = columnsMap;
}
@ -378,7 +378,7 @@ int WE_GetFileSizes::processTable(messageqcpp::ByteStream& bs, std::string& errM
// Build the message to send to the caller
bs.reset();
std::unique_lock lk(columnMapLock);
boost::mutex::scoped_lock lk(columnMapLock);
allColumnMap::iterator colMapiter = wholeMap.find(key);
if (colMapiter != wholeMap.end())

View File

@ -27,8 +27,7 @@
* Author: bpaul@calpont.com
*/
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include "we_observer.h"
@ -63,6 +62,7 @@ Subject::~Subject()
void Subject::attach(Observer* Obs)
{
boost::mutex::scoped_lock aLstLock;
fObs.push_back(Obs);
}
@ -70,6 +70,7 @@ void Subject::attach(Observer* Obs)
void Subject::detach(Observer* Obs)
{
boost::mutex::scoped_lock aLstLock;
Observers::iterator aIt = fObs.begin();
while (aIt != fObs.end())
@ -86,6 +87,7 @@ void Subject::detach(Observer* Obs)
void Subject::notify()
{
boost::mutex::scoped_lock aLstLock;
Observers::iterator aIt = fObs.begin();
while (aIt != fObs.end())

View File

@ -30,7 +30,6 @@
#pragma once
#include <list>
#include <mutex>
namespace WriteEngine
{