1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00

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

This reverts commit f916e64927cd81569327014f20c4cc0b8aca40ff.
This commit is contained in:
Roman Nozdrin 2023-04-22 13:49:50 +01:00 committed by GitHub
parent f916e64927
commit 4fe9cd64a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
245 changed files with 2007 additions and 1261 deletions

View File

@ -788,7 +788,7 @@ void AlterTableProcessor::addColumn(uint32_t sessionID, execplan::CalpontSystemC
bool alterFlag = true;
// MCOL-66 The DBRM can't handle concurrent DDL
std::unique_lock lk(dbrmMutex);
boost::mutex::scoped_lock lk(dbrmMutex);
if (inTableName.fSchema != CALPONT_SCHEMA)
{
@ -1262,7 +1262,7 @@ void AlterTableProcessor::dropColumn(uint32_t sessionID, execplan::CalpontSystem
pmNum = (*dbRootPMMap)[dbRoot];
// MCOL-66 The DBRM can't handle concurrent DDL
std::unique_lock lk(dbrmMutex);
boost::mutex::scoped_lock lk(dbrmMutex);
try
{

View File

@ -307,7 +307,7 @@ CreateTableProcessor::DDLResult CreateTableProcessor::processPackage(
boost::shared_ptr<std::map<int, int> > dbRootPMMap = oamcache->getDBRootToPMMap();
pmNum = (*dbRootPMMap)[dbRoot];
// MCOL-66 The DBRM can't handle concurrent DDL
std::unique_lock lk(dbrmMutex);
boost::mutex::scoped_lock lk(dbrmMutex);
try
{

View File

@ -79,7 +79,7 @@ using namespace ddlpackage;
namespace ddlpackageprocessor
{
std::mutex DDLPackageProcessor::dbrmMutex;
boost::mutex DDLPackageProcessor::dbrmMutex;
DDLPackageProcessor::~DDLPackageProcessor()
{

View File

@ -861,7 +861,7 @@ class DDLPackageProcessor
int commitTransaction(uint64_t uniqueId, BRM::TxnID txnID);
// MCOL-66 The DBRM can't handle concurrent DDL
static std::mutex dbrmMutex;
static boost::mutex dbrmMutex;
private:
/** @brief clean beginning and ending glitches and spaces from string

View File

@ -130,7 +130,7 @@ DropTableProcessor::DDLResult DropTableProcessor::processPackage(
std::vector<int> moduleIds = oamcache->getModuleIds();
// MCOL-66 The DBRM can't handle concurrent DDL
std::unique_lock lk(dbrmMutex);
boost::mutex::scoped_lock lk(dbrmMutex);
try
{
@ -1035,7 +1035,7 @@ TruncTableProcessor::DDLResult TruncTableProcessor::processPackage(
ByteStream::byte tmp8;
// MCOL-66 The DBRM can't handle concurrent DDL
std::unique_lock lk(dbrmMutex);
boost::mutex::scoped_lock lk(dbrmMutex);
try
{

View File

@ -40,7 +40,7 @@
using namespace std;
namespace dmlpackage
{
std::mutex CalpontDMLFactory::fParserLock;
boost::mutex CalpontDMLFactory::fParserLock;
dmlpackage::CalpontDMLPackage* CalpontDMLFactory::makeCalpontDMLPackage(
dmlpackage::VendorDMLStatement& vpackage, std::string defaultSchema /*= ""*/)
@ -51,7 +51,7 @@ dmlpackage::CalpontDMLPackage* CalpontDMLFactory::makeCalpontDMLPackage(
{
std::string dmlStatement = vpackage.get_DMLStatement();
//@Bug 2680. DMLParser is not thread safe.
std::unique_lock lk(fParserLock);
boost::mutex::scoped_lock lk(fParserLock);
DMLParser parser;
if (defaultSchema.size())

View File

@ -60,7 +60,7 @@ class CalpontDMLFactory
protected:
private:
static std::mutex fParserLock;
static boost::mutex fParserLock;
};
} // namespace dmlpackage

View File

@ -23,8 +23,7 @@
#include <limits>
using namespace std;
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp>
using namespace boost;
@ -32,13 +31,13 @@ using namespace boost;
#include "autoincrementdata.h"
/*static*/
std::mutex AutoincrementData::map_mutex;
boost::mutex AutoincrementData::map_mutex;
/*static*/
AutoincrementData::AutoincDataMap AutoincrementData::fAutoincDataMap;
/* static */
AutoincrementData* AutoincrementData::makeAutoincrementData(uint32_t sessionID)
{
std::unique_lock lock(map_mutex);
boost::mutex::scoped_lock lock(map_mutex);
AutoincrementData* instance;
AutoincDataMap::const_iterator it = fAutoincDataMap.find(sessionID);
@ -55,7 +54,7 @@ AutoincrementData* AutoincrementData::makeAutoincrementData(uint32_t sessionID)
/* static */
void AutoincrementData::removeAutoincrementData(uint32_t sessionID)
{
std::unique_lock lock(map_mutex);
boost::mutex::scoped_lock lock(map_mutex);
AutoincDataMap::iterator it = fAutoincDataMap.find(sessionID);
if (it != fAutoincDataMap.end())
@ -74,13 +73,13 @@ AutoincrementData::~AutoincrementData()
void AutoincrementData::setNextValue(uint32_t columnOid, long long nextValue)
{
std::unique_lock lk(fOIDnextvalLock);
boost::mutex::scoped_lock lk(fOIDnextvalLock);
fOidNextValueMap[columnOid] = nextValue;
}
long long AutoincrementData::getNextValue(uint32_t columnOid)
{
std::unique_lock lk(fOIDnextvalLock);
boost::mutex::scoped_lock lk(fOIDnextvalLock);
long long nextValue = 0;
OIDNextValue::iterator it = fOidNextValueMap.find(columnOid);
@ -94,7 +93,7 @@ long long AutoincrementData::getNextValue(uint32_t columnOid)
AutoincrementData::OIDNextValue& AutoincrementData::getOidNextValueMap()
{
std::unique_lock lk(fOIDnextvalLock);
boost::mutex::scoped_lock lk(fOIDnextvalLock);
return fOidNextValueMap;
}

View File

@ -23,9 +23,8 @@
#include <stdint.h>
#include <map>
#include <mutex>
#include <condition_variable>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
class AutoincrementData
{
@ -44,9 +43,9 @@ class AutoincrementData
explicit AutoincrementData(const AutoincrementData& rhs);
~AutoincrementData();
static std::mutex map_mutex;
static boost::mutex map_mutex;
static AutoincDataMap fAutoincDataMap;
OIDNextValue fOidNextValueMap;
std::mutex fOIDnextvalLock;
boost::mutex fOIDnextvalLock;
};

View File

@ -51,7 +51,7 @@ namespace dmlpackageprocessor
{
// Tracks active cleartablelock commands by storing set of table lock IDs
/*static*/ std::set<uint64_t> CommandPackageProcessor::fActiveClearTableLockCmds;
/*static*/ std::mutex CommandPackageProcessor::fActiveClearTableLockCmdMutex;
/*static*/ boost::mutex CommandPackageProcessor::fActiveClearTableLockCmdMutex;
DMLPackageProcessor::DMLResult CommandPackageProcessor::processPackage(
dmlpackage::CalpontDMLPackage& cpackage)
@ -1068,7 +1068,7 @@ void CommandPackageProcessor::clearTableLock(uint64_t uniqueId, const dmlpackage
// Remove tableLockID out of the active cleartableLock command list
if (lockGrabbed)
{
std::unique_lock lock(fActiveClearTableLockCmdMutex);
boost::mutex::scoped_lock lock(fActiveClearTableLockCmdMutex);
fActiveClearTableLockCmds.erase(tableLockID);
}
@ -1107,7 +1107,7 @@ void CommandPackageProcessor::clearTableLock(uint64_t uniqueId, const dmlpackage
//------------------------------------------------------------------------------
void CommandPackageProcessor::establishTableLockToClear(uint64_t tableLockID, BRM::TableLockInfo& lockInfo)
{
std::unique_lock lock(fActiveClearTableLockCmdMutex);
boost::mutex::scoped_lock lock(fActiveClearTableLockCmdMutex);
// Get current table lock info
bool getLockInfo = fDbrm->getTableLockInfo(tableLockID, &lockInfo);

View File

@ -30,9 +30,8 @@
#include <boost/algorithm/string.hpp>
#include "dmlpackageprocessor.h"
#include "dmltable.h"
#include <map>
#include <mutex>
#include <condition_variable>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#define EXPORT
@ -62,7 +61,7 @@ class CommandPackageProcessor : public DMLPackageProcessor
// Tracks active cleartablelock commands by storing set of table lock IDs
static std::set<uint64_t> fActiveClearTableLockCmds;
static std::mutex fActiveClearTableLockCmdMutex;
static boost::mutex fActiveClearTableLockCmdMutex;
};
} // namespace dmlpackageprocessor

View File

@ -23,8 +23,7 @@
#include <limits>
using namespace std;
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp>
using namespace boost;
@ -34,13 +33,13 @@ using namespace boost;
namespace dmlpackageprocessor
{
/*static*/
std::mutex TablelockData::map_mutex;
boost::mutex TablelockData::map_mutex;
/*static*/
TablelockData::TablelockDataMap TablelockData::fTablelockDataMap;
/* static */
TablelockData* TablelockData::makeTablelockData(uint32_t sessionID)
{
std::unique_lock lock(map_mutex);
boost::mutex::scoped_lock lock(map_mutex);
TablelockData* instance;
TablelockDataMap::const_iterator it = fTablelockDataMap.find(sessionID);
@ -57,7 +56,7 @@ TablelockData* TablelockData::makeTablelockData(uint32_t sessionID)
/* static */
void TablelockData::removeTablelockData(uint32_t sessionID)
{
std::unique_lock lock(map_mutex);
boost::mutex::scoped_lock lock(map_mutex);
TablelockDataMap::iterator it = fTablelockDataMap.find(sessionID);
if (it != fTablelockDataMap.end())
@ -76,13 +75,13 @@ TablelockData::~TablelockData()
void TablelockData::setTablelock(uint32_t tableOid, uint64_t tablelockId)
{
std::unique_lock lk(fOIDTablelock);
boost::mutex::scoped_lock lk(fOIDTablelock);
fOIDTablelockMap[tableOid] = tablelockId;
}
uint64_t TablelockData::getTablelockId(uint32_t tableOid)
{
std::unique_lock lk(fOIDTablelock);
boost::mutex::scoped_lock lk(fOIDTablelock);
uint64_t tablelockId = 0;
OIDTablelock::iterator it = fOIDTablelockMap.find(tableOid);
@ -96,7 +95,7 @@ uint64_t TablelockData::getTablelockId(uint32_t tableOid)
TablelockData::OIDTablelock& TablelockData::getOidTablelockMap()
{
std::unique_lock lk(fOIDTablelock);
boost::mutex::scoped_lock lk(fOIDTablelock);
return fOIDTablelockMap;
}

View File

@ -23,9 +23,8 @@
#include <stdint.h>
#include <map>
#include <mutex>
#include <condition_variable>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#define EXPORT
@ -48,10 +47,10 @@ class TablelockData
explicit TablelockData(const TablelockData& rhs);
~TablelockData();
static std::mutex map_mutex;
static boost::mutex map_mutex;
static TablelockDataMap fTablelockDataMap;
OIDTablelock fOIDTablelockMap;
std::mutex fOIDTablelock;
boost::mutex fOIDTablelock;
};
} // namespace dmlpackageprocessor

View File

@ -72,8 +72,7 @@ using namespace rowgroup;
#include "installdir.h"
#include <boost/thread/thread.hpp>
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <boost/version.hpp>
@ -370,7 +369,7 @@ void CalpontSystemCatalog::TableAliasName::unserialize(messageqcpp::ByteStream&
}
/*static*/
std::mutex CalpontSystemCatalog::map_mutex;
boost::mutex CalpontSystemCatalog::map_mutex;
/*static*/
CalpontSystemCatalog::CatalogMap CalpontSystemCatalog::fCatalogMap;
/*static*/
@ -502,7 +501,7 @@ CalpontSystemCatalog::OID CalpontSystemCatalog::lookupOID(const TableColName& ta
checkSysCatVer();
}
std::unique_lock lk2(fOIDmapLock);
boost::mutex::scoped_lock lk2(fOIDmapLock);
if (fOIDmap.size() > 0)
{
@ -732,7 +731,7 @@ CalpontSystemCatalog::OID CalpontSystemCatalog::lookupOID(const TableColName& ta
// delete col[9];
ct.columnOID = coloid;
// populate colinfomap cache and oidbitmap
std::unique_lock lk3(fColinfomapLock);
boost::mutex::scoped_lock lk3(fColinfomapLock);
fColinfomap[coloid] = ct;
return coloid;
}
@ -1037,7 +1036,7 @@ const CalpontSystemCatalog::ColType CalpontSystemCatalog::colType(const OID& Oid
}
// check colinfomap first for system table column or cached column type
std::unique_lock lk3(fColinfomapLock);
boost::mutex::scoped_lock lk3(fColinfomapLock);
if (fColinfomap.size() > 0)
{
@ -1246,7 +1245,7 @@ const CalpontSystemCatalog::ColType CalpontSystemCatalog::colType(const OID& Oid
// populate colinfomap cache and oidbitmap
lk3.lock();
std::unique_lock lk2(fOIDmapLock);
boost::mutex::scoped_lock lk2(fOIDmapLock);
fColinfomap[Oid] = ct;
fOIDmap[tcn] = Oid;
@ -1367,7 +1366,7 @@ const CalpontSystemCatalog::TableColName CalpontSystemCatalog::colName(const OID
}
// check oidmap for system table columns and cached columns
std::unique_lock lk2(fOIDmapLock);
boost::mutex::scoped_lock lk2(fOIDmapLock);
OIDmap::const_iterator iter = fOIDmap.begin();
while (iter != fOIDmap.end())
@ -1872,7 +1871,7 @@ const CalpontSystemCatalog::SCN CalpontSystemCatalog::scn(void) const
/* static */
boost::shared_ptr<CalpontSystemCatalog> CalpontSystemCatalog::makeCalpontSystemCatalog(uint32_t sessionID)
{
std::unique_lock lock(map_mutex);
boost::mutex::scoped_lock lock(map_mutex);
boost::shared_ptr<CalpontSystemCatalog> instance;
CatalogMap::const_iterator it = fCatalogMap.find(sessionID);
@ -1917,7 +1916,7 @@ boost::shared_ptr<CalpontSystemCatalog> CalpontSystemCatalog::makeCalpontSystemC
/* static */
void CalpontSystemCatalog::removeCalpontSystemCatalog(uint32_t sessionID)
{
std::unique_lock lock(map_mutex);
boost::mutex::scoped_lock lock(map_mutex);
DEBUG << "remove calpont system catalog for session " << sessionID << endl;
fCatalogMap.erase(sessionID);
/*
@ -2294,9 +2293,9 @@ const CalpontSystemCatalog::IndexNameList CalpontSystemCatalog::colValueSysconst
boost::algorithm::to_lower(aTableColName.column);
#if BOOST_VERSION < 104000
std::unique_lock lk1(fColIndexListmapLock, false);
boost::mutex::scoped_lock lk1(fColIndexListmapLock, false);
#else
std::unique_lock lk1(fColIndexListmapLock, std::defer_lock);
boost::mutex::scoped_lock lk1(fColIndexListmapLock, boost::defer_lock);
#endif
if (useCache)
@ -2926,7 +2925,7 @@ const CalpontSystemCatalog::ROPair CalpontSystemCatalog::columnRID(const TableCo
tablename=tableColName.table and columnname=tableColName.column;*/
// this function is duplicate to lookupOID() and will be deprecated soon
rp.objnum = lookupOID(tableColName);
std::unique_lock lk2(fOIDmapLock);
boost::mutex::scoped_lock lk2(fOIDmapLock);
ColRIDmap::const_iterator iter = fColRIDmap.find(aTableColName);
@ -2962,18 +2961,18 @@ const CalpontSystemCatalog::RIDList CalpontSystemCatalog::columnRIDs(const Table
checkSysCatVer();
}
std::unique_lock lk1(fTableInfoMapLock);
boost::mutex::scoped_lock lk1(fTableInfoMapLock);
TableInfoMap::const_iterator ti_iter = fTableInfoMap.find(aTableName);
// search fOIDmap for system catalog tables
// or if fTableInfoMap has entry for this table, column oids are cached.
// because columnRIDs(), colType() and tableInfo() are actually binded.
#if BOOST_VERSION < 103800
std::unique_lock lk2(fOIDmapLock, false);
boost::mutex::scoped_lock lk2(fOIDmapLock, false);
#else
std::unique_lock lk2(fOIDmapLock, std::defer_lock);
boost::mutex::scoped_lock lk2(fOIDmapLock, boost::defer_lock);
#endif
std::unique_lock lk3(fColinfomapLock);
boost::mutex::scoped_lock lk3(fColinfomapLock);
if (aTableName.schema == CALPONT_SCHEMA || (useCache && ti_iter != fTableInfoMap.end()))
{
@ -3356,7 +3355,7 @@ const CalpontSystemCatalog::TableName CalpontSystemCatalog::tableName(const OID&
}
// check cache
std::unique_lock lk(fTableNameMapLock);
boost::mutex::scoped_lock lk(fTableNameMapLock);
if (fTableNameMap.size() > 0)
{
@ -3478,7 +3477,7 @@ const CalpontSystemCatalog::ROPair CalpontSystemCatalog::tableRID(const TableNam
// rp.rid = -1; @bug1866 use default
// calpontsys only needs oid
std::unique_lock lk1(fTableInfoMapLock);
boost::mutex::scoped_lock lk1(fTableInfoMapLock);
Tablemap::const_iterator iter = fTablemap.find(aTableName);
if (aTableName.schema.compare("calpontsys") == 0 && iter != fTablemap.end())
@ -3635,7 +3634,7 @@ CalpontSystemCatalog::OID CalpontSystemCatalog::tableAUXColumnOID(const TableNam
checkSysCatVer();
std::unique_lock lk1(fTableAUXColumnOIDMapLock);
boost::mutex::scoped_lock lk1(fTableAUXColumnOIDMapLock);
TableOIDmap::const_iterator iter = fTableAUXColumnOIDMap.find(aTableName);
if (iter != fTableAUXColumnOIDMap.end())
@ -3748,7 +3747,7 @@ CalpontSystemCatalog::OID CalpontSystemCatalog::isAUXColumnOID(const OID& oid)
checkSysCatVer();
std::unique_lock lk1(fAUXColumnOIDToTableOIDMapLock);
boost::mutex::scoped_lock lk1(fAUXColumnOIDToTableOIDMapLock);
AUXColumnOIDTableOIDmap::const_iterator iter = fAUXColumnOIDToTableOIDMap.find(oid);
if (iter != fAUXColumnOIDToTableOIDMap.end())
@ -5129,7 +5128,7 @@ const CalpontSystemCatalog::TableInfo CalpontSystemCatalog::tableInfo(const Tabl
return ti;
}
std::unique_lock lk1(fTableInfoMapLock);
boost::mutex::scoped_lock lk1(fTableInfoMapLock);
TableInfoMap::const_iterator ti_iter = fTableInfoMap.find(aTableName);
if (ti_iter != fTableInfoMap.end())
@ -5506,7 +5505,7 @@ void CalpontSystemCatalog::getSchemaInfo(const string& in_schema, int lower_case
// Check whether cache needs to be flushed
checkSysCatVer();
std::unique_lock lk(fSchemaCacheLock);
boost::mutex::scoped_lock lk(fSchemaCacheLock);
set<string>::iterator setIt = fSchemaCache.find(schema);
if (setIt != fSchemaCache.end())
@ -5809,7 +5808,7 @@ void CalpontSystemCatalog::getSchemaInfo(const string& in_schema, int lower_case
}
// populate colinfo cache
// std::unique_lock lk3(fColinfomapLock);
// boost::mutex::scoped_lock lk3(fColinfomapLock);
for (uint32_t i = 0; i < ctList.size(); i++)
fColinfomap[ctList[i].columnOID] = ctList[i];
@ -5858,32 +5857,32 @@ ostream& operator<<(ostream& os, const CalpontSystemCatalog::TableColName& rhs)
void CalpontSystemCatalog::flushCache()
{
std::unique_lock lk1(fOIDmapLock);
boost::mutex::scoped_lock lk1(fOIDmapLock);
fOIDmap.clear();
buildSysOIDmap();
lk1.unlock();
std::unique_lock lk2(fColinfomapLock);
boost::mutex::scoped_lock lk2(fColinfomapLock);
fColinfomap.clear();
buildSysColinfomap();
lk2.unlock();
std::unique_lock lk3(fTableInfoMapLock);
boost::mutex::scoped_lock lk3(fTableInfoMapLock);
fTableInfoMap.clear();
fTablemap.clear();
fTableRIDmap.clear();
buildSysTablemap();
lk3.unlock();
std::unique_lock namemaplk(fTableNameMapLock);
boost::mutex::scoped_lock namemaplk(fTableNameMapLock);
fTableNameMap.clear();
namemaplk.unlock();
std::unique_lock auxlk(fTableAUXColumnOIDMapLock);
boost::mutex::scoped_lock auxlk(fTableAUXColumnOIDMapLock);
fTableAUXColumnOIDMap.clear();
auxlk.unlock();
std::unique_lock auxtotableoidlk(fAUXColumnOIDToTableOIDMapLock);
boost::mutex::scoped_lock auxtotableoidlk(fAUXColumnOIDToTableOIDMapLock);
fAUXColumnOIDToTableOIDMap.clear();
auxtotableoidlk.unlock();
@ -5898,7 +5897,7 @@ void CalpontSystemCatalog::flushCache()
void CalpontSystemCatalog::updateColinfoCache(CalpontSystemCatalog::OIDNextvalMap& oidNextvalMap)
{
std::unique_lock lk(fColinfomapLock);
boost::mutex::scoped_lock lk(fColinfomapLock);
CalpontSystemCatalog::OIDNextvalMap::const_iterator iter = oidNextvalMap.begin();
OID oid = 0;
long long nextVal = 0;
@ -6293,7 +6292,7 @@ void CalpontSystemCatalog::checkSysCatVer()
newScn = fSessionManager->sysCatVerID().currentScn;
}
std::unique_lock sysCatLk(fSyscatSCNLock);
boost::mutex::scoped_lock sysCatLk(fSyscatSCNLock);
if (fSyscatSCN != newScn)
{

View File

@ -881,27 +881,27 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
void checkSysCatVer();
static std::mutex map_mutex;
static boost::mutex map_mutex;
static CatalogMap fCatalogMap;
typedef std::map<TableColName, OID> OIDmap;
OIDmap fOIDmap;
std::mutex fOIDmapLock; // Also locks fColRIDmap
boost::mutex fOIDmapLock; // Also locks fColRIDmap
typedef std::map<TableName, RID> Tablemap;
Tablemap fTablemap;
typedef std::map<TableName, OID> TableOIDmap;
TableOIDmap fTableAUXColumnOIDMap;
std::mutex fTableAUXColumnOIDMapLock;
boost::mutex fTableAUXColumnOIDMapLock;
typedef std::map<OID, OID> AUXColumnOIDTableOIDmap;
AUXColumnOIDTableOIDmap fAUXColumnOIDToTableOIDMap;
std::mutex fAUXColumnOIDToTableOIDMapLock;
boost::mutex fAUXColumnOIDToTableOIDMapLock;
typedef std::map<OID, ColType> Colinfomap;
Colinfomap fColinfomap;
std::mutex fColinfomapLock;
boost::mutex fColinfomapLock;
/** this structure is used by ddl only. it cache the rid for rows in syscolumn
that match the tableColName */
@ -916,11 +916,11 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
// this structure may combine with Tablemap, where RID is added to TalbeInfo struct
typedef std::map<TableName, TableInfo> TableInfoMap;
TableInfoMap fTableInfoMap;
std::mutex fTableInfoMapLock;
boost::mutex fTableInfoMapLock;
typedef std::map<TableColName, IndexNameList> ColIndexListmap;
ColIndexListmap fColIndexListmap;
std::mutex fColIndexListmapLock;
boost::mutex fColIndexListmapLock;
typedef std::map<OID, OID> DctTokenMap;
DctTokenMap fDctTokenMap;
@ -929,16 +929,16 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
typedef std::map<OID, TableName> TableNameMap;
TableNameMap fTableNameMap;
std::mutex fTableNameMapLock;
boost::mutex fTableNameMapLock;
ClientRotator* fExeMgr;
uint32_t fSessionID;
uint32_t fTxn;
int fIdentity;
std::set<std::string> fSchemaCache;
std::mutex fSchemaCacheLock;
boost::mutex fSchemaCacheLock;
// Cache flush
std::mutex fSyscatSCNLock;
boost::mutex fSyscatSCNLock;
SCN fSyscatSCN;
static uint32_t fModuleID;

View File

@ -222,7 +222,7 @@ void ClientRotator::write(const ByteStream& msg)
ByteStream ClientRotator::read()
{
std::unique_lock lk(fClientLock);
boost::mutex::scoped_lock lk(fClientLock);
ByteStream bs;

View File

@ -161,7 +161,7 @@ class ClientRotator
ClientList fClients;
config::Config* fCf;
int fDebug;
std::mutex fClientLock;
boost::mutex fClientLock;
bool fLocalQuery;
};

View File

@ -88,14 +88,14 @@ using namespace std;
namespace
{
std::mutex CtorMutex;
boost::mutex CtorMutex;
}
namespace execplan
{
ObjectIDManager::ObjectIDManager()
{
std::unique_lock lk(CtorMutex);
boost::mutex::scoped_lock lk(CtorMutex);
config::Config* conf;
string tmp;

View File

@ -26,7 +26,7 @@
#include <set>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include "largedatalist.h"
//#include "bucketdl.h"
@ -73,7 +73,7 @@ class BandedDL : public LargeDataList<std::vector<element_t>, element_t>
BandedDL& operator=(const BandedDL&){};
// vars to support the WSDL-like next() fcn
std::condition_variable nextSetLoaded;
boost::condition nextSetLoaded;
uint64_t waitingConsumers;
};

View File

@ -140,12 +140,12 @@ class DataList
void lock();
void unlock();
std::mutex& getMutex()
boost::mutex& getMutex()
{
return mutex; // why in the world is this necessary in FIFO?
}
std::mutex mutex;
boost::mutex mutex;
bool noMoreInput;
uint64_t consumersFinished;
uint32_t fElemDiskFirstSize; // byte size of element.first saved to disk

View File

@ -224,7 +224,7 @@ DistributedEngineComm::~DistributedEngineComm()
int32_t DistributedEngineComm::Setup()
{
// This is here to ensure that this function does not get invoked multiple times simultaneously.
std::unique_lock setupLock(fSetupMutex);
boost::mutex::scoped_lock setupLock(fSetupMutex);
makeBusy(true);
@ -329,7 +329,7 @@ int32_t DistributedEngineComm::Setup()
// for every entry in newClients up to newPmCount, scan for the same ip in the
// first pmCount. If there is no match, it's a new node,
// call the event listeners' newPMOnline() callbacks.
std::unique_lock lock(eventListenerLock);
boost::mutex::scoped_lock lock(eventListenerLock);
for (uint32_t i = 0; i < newPmCount; i++)
{
@ -437,7 +437,7 @@ Error:
/*
// reset the pmconnection vector
ClientList tempConns;
std::unique_lock onErrLock(fOnErrMutex);
boost::mutex::scoped_lock onErrLock(fOnErrMutex);
string moduleName = client->moduleName();
//cout << "moduleName=" << moduleName << endl;
for ( uint32_t i = 0; i < fPmConnections.size(); i++)
@ -468,9 +468,8 @@ void DistributedEngineComm::addQueue(uint32_t key, bool sendACKs)
{
bool b;
std::mutex* lock = new std::mutex();
std::condition_variable* cond = new std::condition_variable();
boost::mutex* lock = new boost::mutex();
condition* cond = new condition();
uint32_t firstPMInterleavedConnectionId =
key % (fPmConnections.size() / pmCount) * fDECConnectionsPerQuery * pmCount % fPmConnections.size();
boost::shared_ptr<MQE> mqe(new MQE(pmCount, firstPMInterleavedConnectionId));
@ -1195,7 +1194,7 @@ int DistributedEngineComm::writeToClient(size_t aPMIndex, const SBS& bs, uint32_
ClientList tempConns;
{
//cout << "WARNING: DEC WRITE BROKEN PIPE " <<
fPmConnections[index]->otherEnd()<< endl; std::unique_lock onErrLock(fOnErrMutex); string
fPmConnections[index]->otherEnd()<< endl; boost::mutex::scoped_lock onErrLock(fOnErrMutex); string
moduleName = fPmConnections[index]->moduleName();
//cout << "module name = " << moduleName << endl;
if (index >= fPmConnections.size()) return 0;
@ -1241,13 +1240,13 @@ uint32_t DistributedEngineComm::size(uint32_t key)
void DistributedEngineComm::addDECEventListener(DECEventListener* l)
{
std::unique_lock lk(eventListenerLock);
boost::mutex::scoped_lock lk(eventListenerLock);
eventListeners.push_back(l);
}
void DistributedEngineComm::removeDECEventListener(DECEventListener* l)
{
std::unique_lock lk(eventListenerLock);
boost::mutex::scoped_lock lk(eventListenerLock);
std::vector<DECEventListener*> newListeners;
uint32_t s = eventListeners.size();

View File

@ -33,7 +33,7 @@
#pragma once
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <boost/scoped_array.hpp>
#include <condition_variable>
#include <ifaddrs.h>
@ -47,7 +47,7 @@
#include "bytestream.h"
#include "primitivemsg.h"
#include "threadsafequeue.h"
#include "rwlock_local.h"
#include "resourcemanager.h"
#include "messagequeue.h"
@ -284,12 +284,12 @@ class DistributedEngineComm
std::vector<std::shared_ptr<std::mutex>> fWlock; // PrimProc socket write mutexes
bool fBusy;
volatile uint32_t pmCount;
std::mutex fOnErrMutex; // to lock function scope to reset pmconnections under error condition
std::mutex fSetupMutex;
boost::mutex fOnErrMutex; // to lock function scope to reset pmconnections under error condition
boost::mutex fSetupMutex;
// event listener data
std::vector<DECEventListener*> eventListeners;
std::mutex eventListenerLock;
boost::mutex eventListenerLock;
ClientList newClients;
std::vector<std::shared_ptr<std::mutex>> newLocks;
@ -308,7 +308,7 @@ class DistributedEngineComm
void nextPMToACK(boost::shared_ptr<MQE> mqe, uint32_t maxAck, uint32_t* sockIndex, uint16_t* numToAck);
void setFlowControl(bool enable, uint32_t uniqueID, boost::shared_ptr<MQE> mqe);
void doHasBigMsgs(boost::shared_ptr<MQE> mqe, uint64_t targetSize);
std::mutex ackLock;
boost::mutex ackLock;
std::vector<struct in_addr> localNetIfaceSins_;
std::mutex inMemoryEM2PPExchMutex_;

View File

@ -29,7 +29,7 @@
#include <vector>
#include <iostream>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <stdexcept>
#include "elementtype.h"
#include "datalistimpl.h"
@ -145,7 +145,7 @@ class FIFO : public DataListImpl<std::vector<element_t>, element_t>
protected:
private:
std::condition_variable finishedConsuming, moreData;
boost::condition finishedConsuming, moreData;
element_t* pBuffer;
element_t* cBuffer;
@ -243,7 +243,7 @@ bool FIFO<element_t>::swapBuffers(bool waitIfBlocked)
{
element_t* tmp;
std::unique_lock scoped(base::mutex);
boost::mutex::scoped_lock scoped(base::mutex);
if (cDone < base::numConsumers)
{
@ -340,7 +340,7 @@ inline void FIFO<element_t>::insert(const std::vector<element_t>& e)
template <typename element_t>
bool FIFO<element_t>::waitForSwap(uint64_t id)
{
std::unique_lock scoped(base::mutex);
boost::mutex::scoped_lock scoped(base::mutex);
#ifdef ONE_CS
@ -376,14 +376,14 @@ bool FIFO<element_t>::waitForSwap(uint64_t id)
template <typename element_t>
bool FIFO<element_t>::more(uint64_t id)
{
std::unique_lock scoped(base::mutex);
boost::mutex::scoped_lock scoped(base::mutex);
return !(cpos[id] == fMaxElements && base::noMoreInput);
}
template <typename element_t>
void FIFO<element_t>::signalPs()
{
std::unique_lock scoped(base::mutex);
boost::mutex::scoped_lock scoped(base::mutex);
if (++cDone == base::numConsumers)
finishedConsuming.notify_all();
@ -423,7 +423,7 @@ void FIFO<element_t>::endOfInput()
{
element_t* tmp;
std::unique_lock scoped(base::mutex);
boost::mutex::scoped_lock scoped(base::mutex);
if (ppos != 0)
{
@ -449,7 +449,7 @@ uint64_t FIFO<element_t>::getIterator()
{
uint64_t ret;
std::unique_lock scoped(base::mutex);
boost::mutex::scoped_lock scoped(base::mutex);
ret = base::getIterator();
return ret;
}

View File

@ -22,8 +22,7 @@
#include <string>
using namespace std;
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include "messageobj.h"
#include "messageids.h"
@ -34,7 +33,7 @@ using namespace logging;
namespace
{
std::mutex logMutex;
boost::mutex logMutex;
};
namespace joblist
@ -58,7 +57,7 @@ Logger::Logger() : fLogId(5), fImpl(new logging::Logger(5))
void catchHandler(const string& ex, int c, SErrorInfo& ei, unsigned sid, logging::LOG_TYPE level)
{
std::unique_lock lk(logMutex);
boost::mutex::scoped_lock lk(logMutex);
if (ei->errCode == 0)
{

View File

@ -56,7 +56,7 @@ int toInt(const string& val)
namespace joblist
{
std::mutex JobStep::fLogMutex; //=PTHREAD_MUTEX_INITIALIZER;
boost::mutex JobStep::fLogMutex; //=PTHREAD_MUTEX_INITIALIZER;
threadpool::ThreadPool JobStep::jobstepThreadPool(defaultJLThreadPoolSize, 0);

View File

@ -499,7 +499,7 @@ class JobStep
long fTimeZone;
private:
static std::mutex fLogMutex;
static boost::mutex fLogMutex;
friend class CommandJL;
};

View File

@ -33,7 +33,7 @@
#include <sstream>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <sys/types.h>
#include <sys/stat.h>
@ -184,7 +184,7 @@ class LargeDataList : public DataListImpl<container_t, element_t>
void setCompressionMode(); // set current compression mode
void saveRestoreInfo();
std::condition_variable consumePhase; // consumers block here until endOfInput()
boost::condition consumePhase; // consumers block here until endOfInput()
uint64_t filenameCounter;
std::string fFilename; // LDL file name
std::vector<std::fstream::pos_type> fSetStartPositions; // file offsets

View File

@ -30,7 +30,7 @@
using namespace std;
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
using namespace boost;
#include "messagequeue.h"

View File

@ -26,7 +26,7 @@
//#define NDEBUG
#include <cassert>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
using namespace std;
#include "distributedenginecomm.h"

View File

@ -25,7 +25,7 @@
#include <iostream>
#include <stdexcept>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
using namespace std;
#include "messagequeue.h"

View File

@ -31,7 +31,7 @@
using namespace std;
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include "distributedenginecomm.h"
#include "elementtype.h"

View File

@ -38,7 +38,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include "mcs_basic_types.h"
#include "calpontsystemcatalog.h"
@ -300,9 +300,9 @@ class pColStep : public JobStep
BRM::DBRM dbrm;
std::mutex mutex;
std::condition_variable condvar;
std::condition_variable flushed;
boost::mutex mutex;
boost::condition condvar;
boost::condition flushed;
SP_LBIDList lbidList;
std::vector<bool> scanFlags; // use to keep track of which extents to eliminate from this step
uint32_t uniqueID;
@ -509,8 +509,8 @@ class pColScanStep : public JobStep
BRM::DBRM dbrm;
SP_LBIDList lbidList;
std::condition_variable condvar;
std::condition_variable_any condvarWakeupProducer;
boost::condition condvar;
boost::condition condvarWakeupProducer;
bool finishedSending, sendWaiting, rDoNothing, fIsDict;
uint32_t recvWaiting, recvExited;
@ -648,8 +648,8 @@ class pDictionaryStep : public JobStep
DataList_t* requestList;
// StringDataList* stringList;
std::mutex mutex;
std::condition_variable condvar;
boost::mutex mutex;
boost::condition condvar;
uint32_t fInterval;
uint64_t fMsgBytesIn; // total byte count for incoming messages
uint64_t fMsgBytesOut; // total byte count for outcoming messages
@ -827,9 +827,9 @@ class pDictionaryScan : public JobStep
uint64_t cThread; // consumer thread. thread pool handle
DataList_t* requestList;
// StringDataList* stringList;
std::mutex mutex;
std::condition_variable_any condvar;
std::condition_variable_any condvarWakeupProducer;
boost::mutex mutex;
boost::condition condvar;
boost::condition condvarWakeupProducer;
BRM::LBIDRange_v fDictlbids;
std::vector<struct BRM::EMEntry> extents;
uint64_t extentSize;
@ -840,7 +840,7 @@ class pDictionaryScan : public JobStep
// consumer will tell producer to send
bool fStopSending;
uint64_t fPhysicalIO; // total physical I/O count
uint64_t fCacheIO; // total cache I/O countF
uint64_t fCacheIO; // total cache I/O count
uint64_t fMsgBytesIn; // total byte count for incoming messages
uint64_t fMsgBytesOut; // total byte count for outcoming messages
uint32_t fMsgsToPm; // total number of messages sent to PMs
@ -1278,11 +1278,11 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep
uint32_t fExtentsPerSegFile; // config num of Extents Per Segment File
// uint64_t cThread; //consumer thread. thread handle from thread pool
uint64_t pThread; // producer thread. thread handle from thread pool
std::mutex tplMutex;
std::mutex dlMutex;
std::mutex cpMutex;
std::mutex serializeJoinerMutex;
std::condition_variable_any condvarWakeupProducer, condvar;
boost::mutex tplMutex;
boost::mutex dlMutex;
boost::mutex cpMutex;
boost::mutex serializeJoinerMutex;
boost::condition condvarWakeupProducer, condvar;
std::vector<bool> scanFlags; // use to keep track of which extents to eliminate from this step
bool BPPIsAllocated;
@ -1314,7 +1314,7 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep
uint8_t bop; // BOP_AND or BOP_OR
// temporary hack to make sure JobList only calls run and join once
std::mutex jlLock;
boost::mutex jlLock;
bool runRan;
bool joinRan;

View File

@ -45,7 +45,7 @@ uint64_t ResourceDistributor::requestResource(uint32_t sessionID, uint64_t resou
if (fTraceOn)
logMessage(logging::LOG_TYPE_DEBUG, LogRDRequest, resource, sessionID);
std::unique_lock lk(fResourceLock);
boost::mutex::scoped_lock lk(fResourceLock);
while (fTotalResource < resource)
{
@ -68,7 +68,7 @@ void ResourceDistributor::returnResource(uint64_t resource)
if (fTraceOn)
logMessage(logging::LOG_TYPE_DEBUG, LogRDReturn, resource);
std::unique_lock lk(fResourceLock);
boost::mutex::scoped_lock lk(fResourceLock);
fTotalResource += resource;
fResourceAvailable.notify_all();
@ -91,7 +91,7 @@ void ResourceDistributor::logMessage(logging::LOG_TYPE logLevel, logging::Messag
void LockedSessionMap::updateAging(uint32_t sessionID)
{
std::unique_lock lock(fSessionLock);
boost::mutex::scoped_lock lock(fSessionLock);
SessionList::iterator pos = find(fSessionAgingList.begin(), fSessionAgingList.end(), sessionID);
if (fSessionAgingList.end() != pos)
@ -124,13 +124,13 @@ bool LockedSessionMap::addSession(uint32_t sessionID, uint64_t resource, uint64_
ret = false;
}
std::unique_lock maplock(fMapLock);
boost::mutex::scoped_lock maplock(fMapLock);
fSessionMap[sessionID] = resource;
updateAging(sessionID);
if (fMaxSessions < fSessionMap.size())
{
std::unique_lock lock(fSessionLock);
boost::mutex::scoped_lock lock(fSessionLock);
uint32_t oldsession = fSessionAgingList.front();
fSessionMap.erase(oldsession);
fSessionAgingList.erase(fSessionAgingList.begin());
@ -141,9 +141,9 @@ bool LockedSessionMap::addSession(uint32_t sessionID, uint64_t resource, uint64_
void LockedSessionMap::removeSession(uint32_t sessionID)
{
std::unique_lock maplock(fMapLock);
boost::mutex::scoped_lock maplock(fMapLock);
fSessionMap.erase(sessionID);
std::unique_lock listlock(fSessionLock);
boost::mutex::scoped_lock listlock(fSessionLock);
fSessionAgingList.erase(find(fSessionAgingList.begin(), fSessionAgingList.end(), sessionID));
}

View File

@ -27,7 +27,7 @@
#include <unistd.h>
#include <list>
#include <limits>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include "logger.h"
@ -72,10 +72,10 @@ class LockedSessionMap
private:
void updateAging(uint32_t sessionID);
std::mutex fMapLock;
boost::mutex fMapLock;
SessionMap fSessionMap;
uint64_t fResourceBlock;
std::mutex fSessionLock;
boost::mutex fSessionLock;
SessionList fSessionAgingList;
const unsigned fMaxSessions;
};
@ -135,8 +135,8 @@ class ResourceDistributor
std::string fIdentity;
uint64_t fTotalResource;
uint64_t fResourceBlock;
std::mutex fResourceLock;
std::condition_variable fResourceAvailable;
boost::mutex fResourceLock;
boost::condition fResourceAvailable;
LockedSessionMap fSessionMap;
uint32_t fTraceOn;

View File

@ -42,11 +42,11 @@ using namespace config;
namespace joblist
{
ResourceManager* ResourceManager::fInstance = NULL;
std::mutex mx;
boost::mutex mx;
ResourceManager* ResourceManager::instance(bool runningInExeMgr, config::Config* aConfig)
{
std::unique_lock lk(mx);
boost::mutex::scoped_lock lk(mx);
if (!fInstance)
fInstance = new ResourceManager(runningInExeMgr, aConfig);

View File

@ -33,8 +33,7 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@ -794,7 +793,7 @@ void* BucketReUseDriver::reuseThread(void* arg)
if (entry->fileStatus() == BucketReuseControlEntry::progress_c)
{
std::unique_lock lock(BucketReuseManager::instance()->getMutex());
boost::mutex::scoped_lock lock(BucketReuseManager::instance()->getMutex());
dl->reuseControl()->stateChange().wait(lock);
}
else
@ -839,7 +838,7 @@ void* BucketReUseDriver::raceThread(void* arg)
ResourceManager rm;
BucketReuseControlEntry* entry = NULL;
{
std::unique_lock lock(BucketReuseManager::instance()->getMutex());
boost::mutex::scoped_lock lock(BucketReuseManager::instance()->getMutex());
boost::shared_ptr<execplan::CalpontSystemCatalog> c =
execplan::CalpontSystemCatalog::makeCalpontSystemCatalog(0x80000000);
execplan::CalpontSystemCatalog::TableColName tcn = c->colName(a->oid);
@ -880,7 +879,7 @@ void* BucketReUseDriver::raceThread(void* arg)
if (entry->fileStatus() == BucketReuseControlEntry::progress_c)
{
std::unique_lock lock(BucketReuseManager::instance()->getMutex());
boost::mutex::scoped_lock lock(BucketReuseManager::instance()->getMutex());
dl->reuseControl()->stateChange().wait(lock);
}
else

View File

@ -56,7 +56,7 @@ class ThreadSafeQueue
*
* @warning this class takes ownership of the passed-in pointers.
*/
ThreadSafeQueue(std::mutex* pimplLock = 0, std::condition_variable* pimplCond = 0)
ThreadSafeQueue(boost::mutex* pimplLock = 0, boost::condition* pimplCond = 0)
: fShutdown(false), bytes(0), zeroCount(0)
{
fPimplLock.reset(pimplLock);
@ -90,7 +90,7 @@ class ThreadSafeQueue
if (fPimplLock == 0 || fPimplCond == 0)
throw std::runtime_error("TSQ: front() const: no sync!");
std::unique_lock lk(*fPimplLock);
boost::mutex::scoped_lock lk(*fPimplLock);
if (fImpl.empty())
{
@ -116,7 +116,7 @@ class ThreadSafeQueue
if (fPimplLock == 0 || fPimplCond == 0)
throw std::runtime_error("TSQ: front(): no sync!");
std::unique_lock lk(*fPimplLock);
boost::mutex::scoped_lock lk(*fPimplLock);
if (fImpl.empty())
{
@ -146,7 +146,7 @@ class ThreadSafeQueue
if (fShutdown)
return ret;
std::unique_lock lk(*fPimplLock);
boost::mutex::scoped_lock lk(*fPimplLock);
fImpl.push(v);
bytes += v->lengthWithHdrOverhead();
fPimplCond->notify_one();
@ -170,7 +170,7 @@ class ThreadSafeQueue
return ret;
}
std::unique_lock lk(*fPimplLock);
boost::mutex::scoped_lock lk(*fPimplLock);
if (out != NULL)
{
@ -221,7 +221,7 @@ class ThreadSafeQueue
if (fShutdown)
return ret;
std::unique_lock lk(*fPimplLock);
boost::mutex::scoped_lock lk(*fPimplLock);
curSize = fImpl.size();
if (curSize < min)
@ -271,7 +271,7 @@ class ThreadSafeQueue
if (fPimplLock == 0)
throw std::runtime_error("TSQ: empty(): no sync!");
std::unique_lock lk(*fPimplLock);
boost::mutex::scoped_lock lk(*fPimplLock);
return fImpl.empty();
}
/** @brief how many items are in the queue
@ -284,7 +284,7 @@ class ThreadSafeQueue
if (fPimplLock == 0)
throw std::runtime_error("TSQ: size(): no sync!");
std::unique_lock lk(*fPimplLock);
boost::mutex::scoped_lock lk(*fPimplLock);
ret.size = bytes;
ret.count = fImpl.size();
return ret;
@ -309,7 +309,7 @@ class ThreadSafeQueue
if (fPimplLock == 0)
throw std::runtime_error("TSQ: clear(): no sync!");
std::unique_lock lk(*fPimplLock);
boost::mutex::scoped_lock lk(*fPimplLock);
while (!fImpl.empty())
fImpl.pop();
@ -320,8 +320,8 @@ class ThreadSafeQueue
private:
typedef std::queue<T> impl_type;
typedef boost::shared_ptr<std::mutex> SPBM;
typedef boost::shared_ptr<std::condition_variable> SPBC;
typedef boost::shared_ptr<boost::mutex> SPBM;
typedef boost::shared_ptr<boost::condition> SPBC;
// defaults okay
// ThreadSafeQueue<T>(const ThreadSafeQueue<T>& rhs);

View File

@ -30,7 +30,7 @@
using namespace std;
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <boost/uuid/uuid_io.hpp>
using namespace boost;
@ -79,7 +79,7 @@ using namespace querytele;
#include "pseudocolumn.h"
//#define DEBUG 1
extern std::mutex fileLock_g;
extern boost::mutex fileLock_g;
namespace
{
@ -1160,7 +1160,7 @@ void TupleBPS::serializeJoiner()
{
{
// code block to release the lock immediatly
std::unique_lock lk(serializeJoinerMutex);
boost::mutex::scoped_lock lk(serializeJoinerMutex);
more = fBPP->nextTupleJoinerMsg(*sbs);
}
#ifdef JLF_DEBUG
@ -1175,7 +1175,7 @@ void TupleBPS::serializeJoiner()
void TupleBPS::serializeJoiner(uint32_t conn)
{
// We need this lock for TupleBPS::serializeJoiner()
std::unique_lock lk(serializeJoinerMutex);
boost::mutex::scoped_lock lk(serializeJoinerMutex);
ByteStream bs;
bool more = true;
@ -1195,7 +1195,7 @@ void TupleBPS::prepCasualPartitioning()
uint32_t i;
int64_t min, max, seq;
int128_t bigMin, bigMax;
std::unique_lock lk(cpMutex);
boost::mutex::scoped_lock lk(cpMutex);
for (i = 0; i < scannedExtents.size(); i++)
{
@ -1405,7 +1405,7 @@ void TupleBPS::reloadExtentLists()
void TupleBPS::run()
{
uint32_t i;
std::unique_lock lk(jlLock);
boost::mutex::scoped_lock lk(jlLock);
uint32_t retryCounter = 0;
const uint32_t retryMax = 1000; // 50s max; we've seen a 15s window so 50s should be 'safe'
const uint32_t waitInterval = 50000; // in us
@ -1500,7 +1500,7 @@ void TupleBPS::run()
void TupleBPS::join()
{
std::unique_lock lk(jlLock);
boost::mutex::scoped_lock lk(jlLock);
if (joinRan)
return;
@ -1512,7 +1512,7 @@ void TupleBPS::join()
if (msgsRecvd < msgsSent)
{
// wake up the sending thread, it should drain the input dl and exit
std::unique_lock<std::mutex> tplLock(tplMutex);
boost::unique_lock<boost::mutex> tplLock(tplMutex);
condvarWakeupProducer.notify_all();
tplLock.unlock();
}
@ -1669,7 +1669,7 @@ void TupleBPS::interleaveJobs(vector<Job>* jobs) const
void TupleBPS::sendJobs(const vector<Job>& jobs)
{
uint32_t i;
std::unique_lock<std::mutex> tplLock(tplMutex, std::defer_lock);
boost::unique_lock<boost::mutex> tplLock(tplMutex, boost::defer_lock);
for (i = 0; i < jobs.size() && !cancelled(); i++)
{
@ -2142,7 +2142,7 @@ void TupleBPS::sendPrimitiveMessages()
}
abort:
std::unique_lock<std::mutex> tplLock(tplMutex);
boost::unique_lock<boost::mutex> tplLock(tplMutex);
finishedSending = true;
condvar.notify_all();
tplLock.unlock();
@ -2402,7 +2402,7 @@ void TupleBPS::receiveMultiPrimitiveMessages()
initializeJoinLocalDataPool(1);
vector<boost::shared_ptr<messageqcpp::ByteStream>> bsv;
std::unique_lock<std::mutex> tplLock(tplMutex, std::defer_lock);
boost::unique_lock<boost::mutex> tplLock(tplMutex, boost::defer_lock);
try
{
@ -3393,6 +3393,7 @@ void TupleBPS::abort_nolock()
void TupleBPS::abort()
{
boost::mutex::scoped_lock scoped(boost::mutex);
abort_nolock();
}

View File

@ -386,7 +386,7 @@ void TupleAggregateStep::initializeMultiThread()
for (i = 0; i < fNumOfBuckets; i++)
{
std::mutex* lock = new std::mutex();
boost::mutex* lock = new boost::mutex();
fAgg_mutex.push_back(lock);
fRowGroupOuts[i] = fRowGroupOut;
rgData.reinit(fRowGroupOut);

View File

@ -209,8 +209,8 @@ class TupleAggregateStep : public JobStep, public TupleDeliveryStep
uint32_t fNumOfRowGroups;
uint32_t fBucketNum;
std::mutex fMutex;
std::vector<std::mutex*> fAgg_mutex;
boost::mutex fMutex;
std::vector<boost::mutex*> fAgg_mutex;
std::vector<rowgroup::RGData> fRowGroupDatas;
std::vector<rowgroup::SP_ROWAGG_UM_t> fAggregators;
std::vector<rowgroup::RowGroup> fRowGroupIns;

View File

@ -170,7 +170,7 @@ class TupleAnnexStep : public JobStep, public TupleDeliveryStep
std::vector<LimitedOrderBy*> fOrderByList;
std::vector<uint64_t> fRunnersList;
uint16_t fFinishedThreads;
std::mutex fParallelFinalizeMutex;
boost::mutex fParallelFinalizeMutex;
};
template <class T>

View File

@ -81,7 +81,7 @@ TupleHashJoinStep::TupleHashJoinStep(const JobInfo& jobInfo)
, isExeMgr(jobInfo.isExeMgr)
, lastSmallOuterJoiner(-1)
, fTokenJoin(-1)
, fStatsMutexPtr(new std::mutex())
, fStatsMutexPtr(new boost::mutex())
, fFunctionJoinKeys(jobInfo.keyInfo->functionJoinKeys)
, sessionMemLimit(jobInfo.umMemLimit)
, rgdLock(false)
@ -148,7 +148,7 @@ void TupleHashJoinStep::run()
{
uint32_t i;
std::unique_lock lk(jlLock);
boost::mutex::scoped_lock lk(jlLock);
if (runRan)
return;
@ -190,7 +190,7 @@ void TupleHashJoinStep::run()
void TupleHashJoinStep::join()
{
std::unique_lock lk(jlLock);
boost::mutex::scoped_lock lk(jlLock);
if (joinRan)
return;
@ -218,7 +218,7 @@ void TupleHashJoinStep::trackMem(uint index)
ssize_t memBefore = 0, memAfter = 0;
bool gotMem;
std::unique_lock<std::mutex> scoped(memTrackMutex);
boost::unique_lock<boost::mutex> scoped(memTrackMutex);
while (!stopMemTracking)
{
memAfter = joiner->getMemUsage();
@ -232,7 +232,7 @@ void TupleHashJoinStep::trackMem(uint index)
memBefore = memAfter;
}
memTrackDone.wait_for(scoped, std::chrono::seconds(1));
memTrackDone.timed_wait(scoped, boost::posix_time::seconds(1));
}
// one more iteration to capture mem usage since last poll, for this one
@ -376,7 +376,7 @@ void TupleHashJoinStep::startSmallRunners(uint index)
joiner->doneInserting();
}
std::unique_lock lk(*fStatsMutexPtr);
boost::mutex::scoped_lock lk(*fStatsMutexPtr);
fExtendedInfo += extendedInfo;
formatMiniStats(index);
}
@ -427,7 +427,7 @@ void TupleHashJoinStep::smallRunnerFcn(uint32_t index, uint threadID, uint64_t*
if disk join is enabled, use it.
else abort.
*/
std::unique_lock<std::mutex> sl(saneErrMsg);
boost::unique_lock<boost::mutex> sl(saneErrMsg);
if (cancelled())
return;
if (!allowDJS || isDML || (fSessionId & 0x80000000) || (tableOid() < 3000 && tableOid() >= 1000))
@ -739,7 +739,7 @@ void TupleHashJoinStep::hjRunner()
for (i = 0; i <= smallSideCount; i++)
fifos[i].reset(new RowGroupDL(1, 5));
std::unique_lock sl(djsLock);
boost::mutex::scoped_lock sl(djsLock);
for (i = 0; i < smallSideCount; i++)
{
@ -1000,7 +1000,7 @@ uint32_t TupleHashJoinStep::nextBand(messageqcpp::ByteStream& bs)
idbassert(fDelivery);
std::unique_lock lk(deliverMutex);
boost::mutex::scoped_lock lk(deliverMutex);
RowGroup* deliveredRG;
@ -1672,7 +1672,7 @@ void TupleHashJoinStep::processFE2(RowGroup& input, RowGroup& output, Row& inRow
void TupleHashJoinStep::sendResult(const vector<RGData>& res)
{
std::unique_lock lock(outputDLLock);
boost::mutex::scoped_lock lock(outputDLLock);
for (uint32_t i = 0; i < res.size(); i++)
// INSERT_ADAPTER(outputDL, res[i]);
@ -1681,7 +1681,7 @@ void TupleHashJoinStep::sendResult(const vector<RGData>& res)
void TupleHashJoinStep::grabSomeWork(vector<RGData>* work)
{
std::unique_lock lock(inputDLLock);
boost::mutex::scoped_lock lock(inputDLLock);
work->clear();
if (!moreInput)
@ -1934,7 +1934,7 @@ void TupleHashJoinStep::segregateJoiners()
}
#endif
std::unique_lock sl(djsLock);
boost::mutex::scoped_lock sl(djsLock);
/* For now if there is no largeBPS all joins need to either be DJS or not, not mixed */
if (!largeBPS)
{
@ -2009,7 +2009,7 @@ void TupleHashJoinStep::segregateJoiners()
void TupleHashJoinStep::abort()
{
JobStep::abort();
std::unique_lock sl(djsLock);
boost::mutex::scoped_lock sl(djsLock);
if (djs)
{

View File

@ -493,7 +493,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep
SJSTEP fDeliveryStep;
// temporary hack to make sure JobList only calls run, join once
std::mutex jlLock;
boost::mutex jlLock;
bool runRan, joinRan;
/* Iteration 18 mods */
@ -560,7 +560,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep
void processDupList(uint32_t threadID, rowgroup::RowGroup& ingrp, std::vector<rowgroup::RGData>* rowData);
std::vector<uint64_t> joinRunners; // thread handles from thread pool
std::mutex inputDLLock, outputDLLock;
boost::mutex inputDLLock, outputDLLock;
std::shared_ptr<std::shared_ptr<int[]>[]> columnMappings, fergMappings;
std::shared_ptr<int[]> fe2Mapping;
uint32_t joinThreadCount;
@ -577,7 +577,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep
uint32_t fTokenJoin;
// moved from base class JobStep
std::mutex* fStatsMutexPtr;
boost::mutex* fStatsMutexPtr;
//@bug3683 function join
boost::shared_ptr<FunctionJoinInfo> fFunctionJoinInfo;
@ -627,7 +627,7 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep
// THJS configuration is settled. Debatable whether to use a bool and poll instead;
// once the config is settled it stays settled, technically no need to
// keep grabbing locks after that.
std::mutex deliverMutex;
boost::mutex deliverMutex;
bool ownsOutputDL;
void segregateJoiners();
@ -635,13 +635,13 @@ class TupleHashJoinStep : public JobStep, public TupleDeliveryStep
std::vector<std::shared_ptr<joiner::TupleJoiner> > djsJoiners;
std::vector<int> djsJoinerMap;
boost::scoped_array<ssize_t> memUsedByEachJoin;
std::mutex djsLock;
boost::mutex djsLock;
boost::shared_ptr<int64_t> sessionMemLimit;
/* Threaded UM join support */
int numCores;
std::mutex dlMutex, memTrackMutex, saneErrMsg;
std::condition_variable memTrackDone;
boost::mutex dlMutex, memTrackMutex, saneErrMsg;
boost::condition memTrackDone;
std::atomic<bool> rgdLock;
bool stopMemTracking;
void trackMem(uint index);

View File

@ -23,8 +23,7 @@
#include <string>
#include <boost/thread.hpp>
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <boost/uuid/uuid_io.hpp>
#include "querytele.h"
@ -81,12 +80,12 @@ namespace
return ival;
}
void normalizeIntToIntNoScale(const Row& in, Row* out, uint32_t i)
void normalizeIntToIntNoScale(const Row& in, Row* out, uint32_t i)
{
out->setIntField(in.getIntField(i), i);
out->setIntField(in.getIntField(i), i);
}
void normalizeIntToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
void normalizeIntToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -94,20 +93,20 @@ namespace
out->setInt128Field(val, i);
}
void normalizeIntToIntWithScaleInt64(const Row& in, Row* out, uint32_t i)
void normalizeIntToIntWithScaleInt64(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
int64_t val = datatypes::applySignedScale<int64_t>(in.getIntField(i), diff);
out->setIntField(val, i);
}
void normalizeIntToUintNoScale(const Row& in, Row* out, uint32_t i)
void normalizeIntToUintNoScale(const Row& in, Row* out, uint32_t i)
{
out->setUintField(in.getIntField(i), i);
out->setUintField(in.getIntField(i), i);
}
void normalizeIntToUintWithScaleInt128(const Row& in, Row* out, uint32_t i)
void normalizeIntToUintWithScaleInt128(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -115,7 +114,7 @@ namespace
out->setInt128Field(val, i);
}
void normalizeIntToUintWithScaleInt64(const Row& in, Row* out, uint32_t i)
void normalizeIntToUintWithScaleInt64(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -123,7 +122,7 @@ namespace
out->setIntField(val, i);
}
void normalizeIntToStringWithScale(const Row& in, Row* out, uint32_t i)
void normalizeIntToStringWithScale(const Row& in, Row* out, uint32_t i)
{
ostringstream os;
double d = in.getIntField(i);
@ -134,7 +133,7 @@ namespace
out->setStringField(ns, i);
}
void normalizeIntToStringNoScale(const Row& in, Row* out, uint32_t i)
void normalizeIntToStringNoScale(const Row& in, Row* out, uint32_t i)
{
ostringstream os;
os << in.getIntField(i);
@ -142,25 +141,25 @@ namespace
out->setStringField(ns, i);
}
void normalizeIntToXFloat(const Row& in, Row* out, uint32_t i)
void normalizeIntToXFloat(const Row& in, Row* out, uint32_t i)
{
auto d = in.getScaledSInt64FieldAsXFloat<double>(i);
out->setFloatField((float)d, i);
}
void normalizeIntToXDouble(const Row& in, Row* out, uint32_t i)
void normalizeIntToXDouble(const Row& in, Row* out, uint32_t i)
{
auto d = in.getScaledSInt64FieldAsXFloat<double>(i);
out->setDoubleField(d, i);
}
void normalizeIntToLongDouble(const Row& in, Row* out, uint32_t i)
void normalizeIntToLongDouble(const Row& in, Row* out, uint32_t i)
{
auto d = in.getScaledSInt64FieldAsXFloat<long double>(i);
out->setLongDoubleField(d, i);
}
void normalizeIntToXDecimalInt128(const Row& in, Row* out, uint32_t i)
void normalizeIntToXDecimalInt128(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -168,7 +167,7 @@ namespace
out->setInt128Field(val, i);
}
void normalizeIntToXDecimalInt64(const Row& in, Row* out, uint32_t i)
void normalizeIntToXDecimalInt64(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -176,12 +175,12 @@ namespace
out->setIntField(val, i);
}
void normalizeUintToIntNoScale(const Row& in, Row* out, uint32_t i)
void normalizeUintToIntNoScale(const Row& in, Row* out, uint32_t i)
{
out->setIntField(in.getUintField(i), i);
out->setIntField(in.getUintField(i), i);
}
void normalizeUintToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
void normalizeUintToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -189,7 +188,7 @@ namespace
out->setInt128Field(val, i);
}
void normalizeUntToIntWithScaleInt64(const Row& in, Row* out, uint32_t i)
void normalizeUntToIntWithScaleInt64(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -197,12 +196,12 @@ namespace
out->setIntField(val, i);
}
void normalizeUintToUint(const Row& in, Row* out, uint32_t i)
void normalizeUintToUint(const Row& in, Row* out, uint32_t i)
{
out->setUintField(in.getUintField(i), i);
out->setUintField(in.getUintField(i), i);
}
void normalizeUintToStringWithScale(const Row& in, Row* out, uint32_t i)
void normalizeUintToStringWithScale(const Row& in, Row* out, uint32_t i)
{
ostringstream os;
double d = in.getUintField(i);
@ -213,7 +212,7 @@ namespace
out->setStringField(ns, i);
}
void normalizeUintToStringNoScale(const Row& in, Row* out, uint32_t i)
void normalizeUintToStringNoScale(const Row& in, Row* out, uint32_t i)
{
ostringstream os;
os << in.getUintField(i);
@ -221,25 +220,25 @@ namespace
out->setStringField(ns, i);
}
void normalizUintToXFloat(const Row& in, Row* out, uint32_t i)
void normalizUintToXFloat(const Row& in, Row* out, uint32_t i)
{
auto d = in.getScaledUInt64FieldAsXFloat<double>(i);
out->setFloatField((float)d, i);
}
void normalizeUintToXDouble(const Row& in, Row* out, uint32_t i)
void normalizeUintToXDouble(const Row& in, Row* out, uint32_t i)
{
auto d = in.getScaledUInt64FieldAsXFloat<double>(i);
out->setDoubleField(d, i);
}
void normalizeUintToLongDouble(const Row& in, Row* out, uint32_t i)
void normalizeUintToLongDouble(const Row& in, Row* out, uint32_t i)
{
auto d = in.getScaledUInt64FieldAsXFloat<long double>(i);
out->setLongDoubleField(d, i);
}
void normalizeUintToXDecimalInt128(const Row& in, Row* out, uint32_t i)
void normalizeUintToXDecimalInt128(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -247,7 +246,7 @@ namespace
out->setInt128Field(val, i);
}
void normalizeUintToXDecimalInt64(const Row& in, Row* out, uint32_t i)
void normalizeUintToXDecimalInt64(const Row& in, Row* out, uint32_t i)
{
const int diff = out->getScale(i) - in.getScale(i);
idbassert(diff >= 0);
@ -255,17 +254,17 @@ namespace
out->setIntField(val, i);
}
void normalizeStringToString(const Row& in, Row* out, uint32_t i)
void normalizeStringToString(const Row& in, Row* out, uint32_t i)
{
out->setStringField(in.getStringField(i), i);
}
void normalizeDateToDate(const Row& in, Row* out, uint32_t i)
void normalizeDateToDate(const Row& in, Row* out, uint32_t i)
{
out->setIntField(in.getIntField(i), i);
}
void normalizeDateToDatetime(const Row& in, Row* out, uint32_t i)
void normalizeDateToDatetime(const Row& in, Row* out, uint32_t i)
{
uint64_t date = in.getUintField(i);
date &= ~0x3f; // zero the 'spare' field
@ -273,7 +272,7 @@ namespace
out->setUintField(date, i);
}
void normalizeDateToTimestamp(const Row& in, Row* out, uint32_t i, long fTimeZone)
void normalizeDateToTimestamp(const Row& in, Row* out, uint32_t i, long fTimeZone)
{
dataconvert::Date date(in.getUintField(i));
dataconvert::MySQLTime m_time;
@ -303,26 +302,26 @@ namespace
out->setUintField(outValue, i);
}
void normalizeDateToString(const Row& in, Row* out, uint32_t i)
void normalizeDateToString(const Row& in, Row* out, uint32_t i)
{
string d = DataConvert::dateToString(in.getUintField(i));
utils::NullString ns(d);
out->setStringField(ns, i);
}
void normalizeDatetimeToDatetime(const Row& in, Row* out, uint32_t i)
void normalizeDatetimeToDatetime(const Row& in, Row* out, uint32_t i)
{
out->setIntField(in.getIntField(i), i);
}
void normalizeDatetimeToDate(const Row& in, Row* out, uint32_t i)
void normalizeDatetimeToDate(const Row& in, Row* out, uint32_t i)
{
uint64_t val = in.getUintField(i);
val >>= 32;
out->setUintField(val, i);
}
void normalizeDatetimeToTimestamp(const Row& in, Row* out, uint32_t i, long fTimeZone)
void normalizeDatetimeToTimestamp(const Row& in, Row* out, uint32_t i, long fTimeZone)
{
uint64_t val = in.getUintField(i);
dataconvert::DateTime dtime(val);
@ -354,19 +353,19 @@ namespace
out->setUintField(outValue, i);
}
void normalizeDatetimeToString(const Row& in, Row* out, uint32_t i)
void normalizeDatetimeToString(const Row& in, Row* out, uint32_t i)
{
string d = DataConvert::datetimeToString(in.getUintField(i));
utils::NullString ns(d);
out->setStringField(ns, i);
}
void normalizeTimestampToTimestamp(const Row& in, Row* out, uint32_t i)
void normalizeTimestampToTimestamp(const Row& in, Row* out, uint32_t i)
{
out->setIntField(in.getIntField(i), i);
}
void normalizeTimestampToDate(const Row& in, Row* out, uint32_t i, long fTimeZone)
void normalizeTimestampToDate(const Row& in, Row* out, uint32_t i, long fTimeZone)
{
uint64_t val = in.getUintField(i);
dataconvert::TimeStamp timestamp(val);
@ -386,7 +385,7 @@ namespace
out->setUintField(outValue, i);
}
void normalizeTimestampToDatetime(const Row& in, Row* out, uint32_t i, long fTimeZone)
void normalizeTimestampToDatetime(const Row& in, Row* out, uint32_t i, long fTimeZone)
{
uint64_t val = in.getUintField(i);
dataconvert::TimeStamp timestamp(val);
@ -409,110 +408,110 @@ namespace
out->setUintField(outValue, i);
}
void normalizeTimestampToString(const Row& in, Row* out, uint32_t i, long fTimeZone)
void normalizeTimestampToString(const Row& in, Row* out, uint32_t i, long fTimeZone)
{
string d = DataConvert::timestampToString(in.getUintField(i), fTimeZone);
utils::NullString ns(d);
out->setStringField(ns, i);
}
void normalizeTimeToTime(const Row& in, Row* out, uint32_t i)
void normalizeTimeToTime(const Row& in, Row* out, uint32_t i)
{
out->setIntField(in.getIntField(i), i);
}
void normalizeTimeToString(const Row& in, Row* out, uint32_t i)
void normalizeTimeToString(const Row& in, Row* out, uint32_t i)
{
string d = DataConvert::timeToString(in.getIntField(i));
utils::NullString ns(d);
out->setStringField(ns, i);
}
void normalizeXFloatToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setInt128Field(pickScaleForDouble(out, i, val), i);
}
void normalizeXDoubleToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setInt128Field(pickScaleForDouble(out, i, val), i);
}
void normalizeXFloatToIntWithScaleInt64(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToIntWithScaleInt64(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setIntField(pickScaleForDouble(out, i, val), i);
}
void normalizeXDoubleToIntWithScaleInt64(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToIntWithScaleInt64(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setIntField(pickScaleForDouble(out, i, val), i);
}
void normalizeXFloatToIntNoScale(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToIntNoScale(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setIntField((int64_t)val, i);
}
void normalizeXDoubleToIntNoScale(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToIntNoScale(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setIntField((int64_t)val, i);
}
void normalizeXFloatToUint(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToUint(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setUintField((uint64_t)val, i);
}
void normalizeXDoubleToUint(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToUint(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setUintField((uint64_t)val, i);
}
void normalizeXFloatToXFloat(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToXFloat(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setFloatField(val, i);
}
void normalizeXDoubleToXFloat(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToXFloat(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setFloatField(val, i);
}
void normalizeXFloatToXDouble(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToXDouble(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setDoubleField(val, i);
}
void normalizeXDoubleToXDouble(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToXDouble(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setDoubleField(val, i);
}
void normalizeXFloatToLongDouble(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToLongDouble(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setLongDoubleField(val, i);
}
void normalizeXDoubleToLongDouble(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToLongDouble(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setLongDoubleField(val, i);
}
void normalizeXFloatToString(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToString(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
ostringstream os;
@ -522,7 +521,7 @@ namespace
out->setStringField(ns, i);
}
void normalizeXDoubleToString(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToString(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
ostringstream os;
@ -532,73 +531,73 @@ namespace
out->setStringField(ns, i);
}
void normalizeXFloatToWideXDecimal(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToWideXDecimal(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setInt128Field(pickScaleForDouble(out, i, val), i);
}
void normalizeXDoubleToWideXDecimal(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToWideXDecimal(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setInt128Field(pickScaleForDouble(out, i, val), i);
}
void normalizeXFloatToXDecimal(const Row& in, Row* out, uint32_t i)
void normalizeXFloatToXDecimal(const Row& in, Row* out, uint32_t i)
{
double val = in.getFloatField(i);
out->setIntField(pickScaleForDouble(out, i, val), i);
}
void normalizeXDoubleToXDecimal(const Row& in, Row* out, uint32_t i)
void normalizeXDoubleToXDecimal(const Row& in, Row* out, uint32_t i)
{
double val = in.getDoubleField(i);
out->setIntField(pickScaleForDouble(out, i, val), i);
}
void normalizeLongDoubleToIntNoScale(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToIntNoScale(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setIntField((int64_t)val, i);
}
void normalizeLongDoubleToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToIntWithScaleInt128(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setInt128Field(pickScaleForLongDouble(out, i, val), i);
}
void normalizeLongDoubleToIntWithScaleInt(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToIntWithScaleInt(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setIntField(pickScaleForLongDouble(out, i, val), i);
}
void normalizeLongDoubleToUint(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToUint(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setUintField((uint64_t)val, i);
}
void normalizeLongDoubleToXFloat(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToXFloat(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setFloatField(val, i);
}
void normalizeLongDoubleToXDouble(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToXDouble(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setDoubleField(val, i);
}
void normalizeLongDoubleToLongDouble(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToLongDouble(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setLongDoubleField(val, i);
}
void normalizeLongDoubleToString(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToString(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
ostringstream os;
@ -608,32 +607,32 @@ namespace
out->setStringField(ns, i);
}
void normalizeLongDoubleToXDecimalInt128(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToXDecimalInt128(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setInt128Field(pickScaleForLongDouble(out, i, val), i);
}
void normalizeLongDoubleToXDecimalInt(const Row& in, Row* out, uint32_t i)
void normalizeLongDoubleToXDecimalInt(const Row& in, Row* out, uint32_t i)
{
long double val = in.getLongDoubleField(i);
out->setIntField(pickScaleForLongDouble(out, i, val), i);
}
void normalizeWideXDecimalToWideXDecimalNoScale(const Row& in, Row* out, uint32_t i)
void normalizeWideXDecimalToWideXDecimalNoScale(const Row& in, Row* out, uint32_t i)
{
int128_t val128 = 0;
in.getInt128Field(i, val128);
out->setInt128Field(val128, i);
}
void normalizeXDecimalToWideXDecimalNoScale(const Row& in, Row* out, uint32_t i)
void normalizeXDecimalToWideXDecimalNoScale(const Row& in, Row* out, uint32_t i)
{
int64_t val = in.getIntField(i);
int64_t val = in.getIntField(i);
out->setInt128Field(val, i);
}
void normalizeWideXDecimalToWideXDecimalWithScale(const Row& in, Row* out, uint32_t i)
void normalizeWideXDecimalToWideXDecimalWithScale(const Row& in, Row* out, uint32_t i)
{
int128_t val128 = 0;
in.getInt128Field(i, val128);
@ -641,48 +640,48 @@ namespace
out->setInt128Field(temp, i);
}
void normalizeXDecimalToWideXDecimalWithScale(const Row& in, Row* out, uint32_t i)
void normalizeXDecimalToWideXDecimalWithScale(const Row& in, Row* out, uint32_t i)
{
int64_t val = in.getIntField(i);
int128_t temp = datatypes::applySignedScale<int128_t>(val, out->getScale(i) - in.getScale(i));
out->setInt128Field(temp, i);
}
void normalizeXDecimalToOtherNoScale(const Row& in, Row* out, uint32_t i)
void normalizeXDecimalToOtherNoScale(const Row& in, Row* out, uint32_t i)
{
int64_t val = in.getIntField(i);
out->setIntField(val, i);
}
void normalizeXDecimalToOtherWithScale(const Row& in, Row* out, uint32_t i)
void normalizeXDecimalToOtherWithScale(const Row& in, Row* out, uint32_t i)
{
int64_t val = in.getIntField(i);
int64_t temp = datatypes::applySignedScale<int64_t>(val, out->getScale(i) - in.getScale(i));
out->setIntField(temp, i);
}
void normalizeXDecimalToXFloat(const Row& in, Row* out, uint32_t i)
void normalizeXDecimalToXFloat(const Row& in, Row* out, uint32_t i)
{
int64_t val = in.getIntField(i);
float fval = ((float)val) / IDB_pow[in.getScale(i)];
out->setFloatField(fval, i);
}
void normalizeXDecimalToXDouble(const Row& in, Row* out, uint32_t i)
void normalizeXDecimalToXDouble(const Row& in, Row* out, uint32_t i)
{
int64_t val = in.getIntField(i);
double dval = ((double)val) / IDB_pow[in.getScale(i)];
out->setDoubleField(dval, i);
}
void normalizeXDecimalToLongDouble(const Row& in, Row* out, uint32_t i)
void normalizeXDecimalToLongDouble(const Row& in, Row* out, uint32_t i)
{
int64_t val = in.getIntField(i);
long double dval = ((long double)val) / IDB_pow[in.getScale(i)];
out->setLongDoubleField(dval, i);
}
void normalizeWideXDecimalToString(const Row& in, Row* out, uint32_t i)
void normalizeWideXDecimalToString(const Row& in, Row* out, uint32_t i)
{
int128_t val128 = 0;
in.getInt128Field(i, val128);
@ -690,14 +689,14 @@ namespace
out->setStringField(dec.toNullString(), i);
}
void normalizeXDecimalToString(const Row& in, Row* out, uint32_t i)
void normalizeXDecimalToString(const Row& in, Row* out, uint32_t i)
{
int64_t val = in.getIntField(i);
datatypes::Decimal dec(val, in.getScale(i), in.getPrecision(i));
out->setStringField(dec.toNullString(), i);
}
void normalizeBlobVarbinary(const Row& in, Row* out, uint32_t i)
void normalizeBlobVarbinary(const Row& in, Row* out, uint32_t i)
{
// out->setVarBinaryField(in.getVarBinaryStringField(i), i); // not efficient
out->setVarBinaryField(in.getVarBinaryField(i), in.getVarBinaryLength(i), i);
@ -725,15 +724,15 @@ namespace
case CalpontSystemCatalog::INT:
case CalpontSystemCatalog::BIGINT:
{
if (out->getScale(i) || in.getScale(i))
if (out->getScale(i) || in.getScale(i))
{
if (out->getColumnWidth(i) == datatypes::MAXDECIMALWIDTH)
result.emplace_back(normalizeIntToIntWithScaleInt128);
else
result.emplace_back(normalizeIntToIntWithScaleInt64);
}
}
else
result.emplace_back(normalizeIntToIntNoScale);
result.emplace_back(normalizeIntToIntNoScale);
break;
}
@ -749,15 +748,15 @@ namespace
result.emplace_back(normalizeIntToUintWithScaleInt128);
else
result.emplace_back(normalizeIntToUintWithScaleInt64);
}
}
else
result.emplace_back(normalizeIntToUintNoScale);
result.emplace_back(normalizeIntToUintNoScale);
break;
}
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARCHAR:
{
if (in.getScale(i))
result.emplace_back(normalizeIntToStringWithScale);
@ -830,9 +829,9 @@ namespace
result.emplace_back(normalizeUintToIntWithScaleInt128);
else
result.emplace_back(normalizeUntToIntWithScaleInt64);
}
}
else
result.emplace_back(normalizeUintToIntNoScale);
result.emplace_back(normalizeUintToIntNoScale);
break;
}
@ -844,7 +843,7 @@ namespace
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARCHAR:
{
if (in.getScale(i))
result.emplace_back(normalizeUintToStringWithScale);
@ -852,7 +851,7 @@ namespace
result.emplace_back(normalizeUintToStringNoScale);
break;
}
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
case CalpontSystemCatalog::TIME:
@ -921,7 +920,7 @@ namespace
case CalpontSystemCatalog::DATETIME: result.emplace_back(normalizeDateToDatetime); break;
case CalpontSystemCatalog::TIMESTAMP: result.emplace_back(std::bind(normalizeDateToTimestamp, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, fTimeZone)); break;
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::VARCHAR: result.emplace_back(normalizeDateToString); break;
@ -966,9 +965,9 @@ namespace
case CalpontSystemCatalog::TIMESTAMP: result.emplace_back(normalizeTimestampToTimestamp); break;
case CalpontSystemCatalog::DATE: result.emplace_back(std::bind(normalizeTimestampToDate, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, fTimeZone)); break;
case CalpontSystemCatalog::DATETIME: result.emplace_back(std::bind(normalizeTimestampToDatetime, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, fTimeZone)); break;
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::VARCHAR: result.emplace_back(std::bind(normalizeTimestampToString, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, fTimeZone)); break;
@ -1032,7 +1031,7 @@ namespace
else
result.emplace_back(normalizeXDoubleToIntWithScaleInt64);
}
}
}
else
{
if (in.getColTypes()[i] == CalpontSystemCatalog::FLOAT || in.getColTypes()[i] == CalpontSystemCatalog::UFLOAT)
@ -1047,7 +1046,7 @@ namespace
case CalpontSystemCatalog::USMALLINT:
case CalpontSystemCatalog::UMEDINT:
case CalpontSystemCatalog::UINT:
case CalpontSystemCatalog::UBIGINT:
case CalpontSystemCatalog::UBIGINT:
{
if (in.getColTypes()[i] == CalpontSystemCatalog::FLOAT || in.getColTypes()[i] == CalpontSystemCatalog::UFLOAT)
result.emplace_back(normalizeXFloatToUint);
@ -1057,7 +1056,7 @@ namespace
}
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::UFLOAT:
case CalpontSystemCatalog::UFLOAT:
{
if (in.getColTypes()[i] == CalpontSystemCatalog::FLOAT || in.getColTypes()[i] == CalpontSystemCatalog::UFLOAT)
result.emplace_back(normalizeXFloatToXFloat);
@ -1065,9 +1064,9 @@ namespace
result.emplace_back(normalizeXDoubleToXFloat);
break;
}
case CalpontSystemCatalog::DOUBLE:
case CalpontSystemCatalog::UDOUBLE:
case CalpontSystemCatalog::UDOUBLE:
{
if (in.getColTypes()[i] == CalpontSystemCatalog::FLOAT || in.getColTypes()[i] == CalpontSystemCatalog::UFLOAT)
result.emplace_back(normalizeXFloatToXDouble);
@ -1075,8 +1074,8 @@ namespace
result.emplace_back(normalizeXDoubleToXDouble);
break;
}
case CalpontSystemCatalog::LONGDOUBLE:
case CalpontSystemCatalog::LONGDOUBLE:
{
if (in.getColTypes()[i] == CalpontSystemCatalog::FLOAT || in.getColTypes()[i] == CalpontSystemCatalog::UFLOAT)
result.emplace_back(normalizeXFloatToLongDouble);
@ -1084,18 +1083,18 @@ namespace
result.emplace_back(normalizeXDoubleToLongDouble);
break;
}
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARCHAR:
{
if (in.getColTypes()[i] == CalpontSystemCatalog::FLOAT || in.getColTypes()[i] == CalpontSystemCatalog::UFLOAT)
result.emplace_back(normalizeXFloatToString);
else
result.emplace_back(normalizeXDoubleToString);
break;
}
}
case CalpontSystemCatalog::DECIMAL:
case CalpontSystemCatalog::UDECIMAL:
{
@ -1113,14 +1112,14 @@ namespace
result.emplace_back(normalizeXDoubleToWideXDecimal);
break;
}
else
else
{
if (in.getColTypes()[i] == CalpontSystemCatalog::FLOAT || in.getColTypes()[i] == CalpontSystemCatalog::UFLOAT)
result.emplace_back(normalizeXFloatToXDecimal);
else
result.emplace_back(normalizeXDoubleToXDecimal);
break;
}
}
break;
}
@ -1150,9 +1149,9 @@ namespace
result.emplace_back(normalizeLongDoubleToIntWithScaleInt128);
else
result.emplace_back(normalizeLongDoubleToIntWithScaleInt);
}
}
else
result.emplace_back(normalizeLongDoubleToIntNoScale);
result.emplace_back(normalizeLongDoubleToIntNoScale);
break;
}
@ -1186,7 +1185,7 @@ namespace
result.emplace_back(normalizeLongDoubleToXDecimalInt128);
else
result.emplace_back(normalizeLongDoubleToXDecimalInt);
break;
}
@ -1253,7 +1252,7 @@ namespace
}
case CalpontSystemCatalog::FLOAT:
case CalpontSystemCatalog::UFLOAT: result.emplace_back(normalizeXDecimalToXFloat); break;
case CalpontSystemCatalog::UFLOAT: result.emplace_back(normalizeXDecimalToXFloat); break;
case CalpontSystemCatalog::DOUBLE:
case CalpontSystemCatalog::UDOUBLE: result.emplace_back(normalizeXDecimalToXDouble); break;
@ -1463,7 +1462,7 @@ void TupleUnion::readInput(uint32_t which)
l_tmpRG.getRow(0, &tmpRow);
{
std::unique_lock lk(uniquerMutex);
boost::mutex::scoped_lock lk(uniquerMutex);
getOutput(&l_outputRG, &outRow, &outRGData);
memUsageBefore = allocator.getMemUsage();
@ -1542,8 +1541,8 @@ void TupleUnion::readInput(uint32_t which)
more = dl->next(it, &inRGData);
{
std::unique_lock lock1(uniquerMutex);
std::unique_lock lock2(sMutex);
boost::mutex::scoped_lock lock1(uniquerMutex);
boost::mutex::scoped_lock lock2(sMutex);
if (!distinct && l_outputRG.getRowCount() > 0)
output->insert(outRGData);
@ -1641,7 +1640,7 @@ void TupleUnion::addToOutput(Row* r, RowGroup* rg, bool keepit, RGData& data, ui
{
rg->setRowCount(8192);
{
std::unique_lock lock(sMutex);
boost::mutex::scoped_lock lock(sMutex);
output->insert(data);
}
data = RGData(*rg);
@ -1678,7 +1677,7 @@ void TupleUnion::run()
{
uint32_t i;
std::unique_lock lk(jlLock);
boost::mutex::scoped_lock lk(jlLock);
if (runRan)
return;
@ -1721,7 +1720,7 @@ void TupleUnion::run()
void TupleUnion::join()
{
std::unique_lock lk(jlLock);
boost::mutex::scoped_lock lk(jlLock);
if (joinRan)
return;

View File

@ -177,7 +177,7 @@ class TupleUnion : public JobStep, public TupleDeliveryStep
boost::scoped_ptr<Uniquer_t> uniquer;
std::vector<rowgroup::RGData> rowMemory;
std::mutex sMutex, uniquerMutex;
boost::mutex sMutex, uniquerMutex;
uint64_t memUsage;
uint32_t rowLength;
rowgroup::Row row, row2;
@ -193,7 +193,7 @@ class TupleUnion : public JobStep, public TupleDeliveryStep
uint64_t fRowsReturned;
// temporary hack to make sure JobList only calls run, join once
std::mutex jlLock;
boost::mutex jlLock;
bool runRan, joinRan;
boost::shared_ptr<int64_t> sessionMemLimit;

View File

@ -34,7 +34,7 @@
namespace joblist
{
/* static */ UniqueNumberGenerator* UniqueNumberGenerator::fUnique32Generator = 0;
/* static */ std::mutex UniqueNumberGenerator::fLock;
/* static */ boost::mutex UniqueNumberGenerator::fLock;
//------------------------------------------------------------------------------
// Accessor to singleton handle
@ -42,7 +42,7 @@ namespace joblist
/* static */
UniqueNumberGenerator* UniqueNumberGenerator::instance()
{
std::unique_lock lk(fLock);
boost::mutex::scoped_lock lk(fLock);
if (!fUnique32Generator)
{
@ -60,7 +60,7 @@ UniqueNumberGenerator* UniqueNumberGenerator::instance()
/* static */
void UniqueNumberGenerator::deleteInstance()
{
std::unique_lock lk(fLock);
boost::mutex::scoped_lock lk(fLock);
if (fUnique32Generator)
{

View File

@ -57,7 +57,7 @@ class UniqueNumberGenerator
}
static UniqueNumberGenerator* fUnique32Generator;
static std::mutex fLock;
static boost::mutex fLock;
BRM::DBRM fDbrm;
};

View File

@ -19,8 +19,7 @@
//
/** @file */
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp>
using namespace boost;
@ -46,9 +45,9 @@ using namespace logging;
#include "dbrm.h"
using namespace BRM;
using namespace messageqcpp;
std::mutex mute;
std::condition_variable cond;
std::mutex fLock;
boost::mutex mute;
boost::condition_variable cond;
boost::mutex fLock;
namespace dmlprocessor
{
@ -178,7 +177,7 @@ uint64_t BatchInsertProc::grabTableLock(int32_t sessionId)
BatchInsertProc::SP_PKG BatchInsertProc::getInsertQueue()
{
std::unique_lock lk(fLock);
boost::mutex::scoped_lock lk(fLock);
return fInsertPkgQueue;
}
@ -188,14 +187,14 @@ void BatchInsertProc::setLastPkg(bool lastPkg)
}
void BatchInsertProc::addPkg(messageqcpp::ByteStream& insertBs)
{
std::unique_lock lk(fLock);
boost::mutex::scoped_lock lk(fLock);
fInsertPkgQueue->push(insertBs);
}
messageqcpp::ByteStream BatchInsertProc::getPkg()
{
messageqcpp::ByteStream bs;
std::unique_lock lk(fLock);
boost::mutex::scoped_lock lk(fLock);
bs = fInsertPkgQueue->front();
fInsertPkgQueue->pop();
return bs;
@ -533,13 +532,13 @@ void BatchInsertProc::setHwm()
void BatchInsertProc::setError(int errorCode, std::string errMsg)
{
std::unique_lock lk(fLock);
boost::mutex::scoped_lock lk(fLock);
fErrorCode = errorCode;
fErrMsg = errMsg;
}
void BatchInsertProc::getError(int& errorCode, std::string& errMsg)
{
std::unique_lock lk(fLock);
boost::mutex::scoped_lock lk(fLock);
errorCode = fErrorCode;
errMsg = fErrMsg;
}

View File

@ -26,11 +26,10 @@
#include <queue>
#include <boost/shared_ptr.hpp>
#include <map>
#include <mutex>
#include <condition_variable>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <boost/scoped_array.hpp>
#include "insertdmlpackage.h"
#include "resourcemanager.h"
@ -71,7 +70,7 @@ class BatchInsertProc
private:
SP_PKG fInsertPkgQueue;
std::condition_variable condvar;
boost::condition condvar;
execplan::CalpontSystemCatalog::SCN fTxnid;
int fErrorCode;
std::string fErrMsg;

View File

@ -26,8 +26,7 @@
#include <ctime>
//#define SERIALIZE_DDL_DML_CPIMPORT 1
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
@ -61,8 +60,8 @@ using namespace WriteEngine;
#include "querytele.h"
using namespace querytele;
extern std::mutex mute;
extern std::condition_variable cond;
extern boost::mutex mute;
extern boost::condition_variable cond;
#define MCOL_140 // Undefine to test VSS for out of order transactions
@ -76,16 +75,16 @@ namespace dmlprocessor
// Map to store the package handler objects so we can set flags during execution
// for things like ctrl+c
DMLProcessor::PackageHandlerMap_t DMLProcessor::packageHandlerMap;
std::mutex DMLProcessor::packageHandlerMapLock;
boost::mutex DMLProcessor::packageHandlerMapLock;
// Map to store the BatchInsertProc object
std::map<uint32_t, BatchInsertProc*> DMLProcessor::batchinsertProcessorMap;
std::mutex DMLProcessor::batchinsertProcessorMapLock;
boost::mutex DMLProcessor::batchinsertProcessorMapLock;
// MCOL-140 Map to hold table oids for tables being changed.
std::map<uint32_t, PackageHandler::tableAccessQueue_t> PackageHandler::tableOidMap;
std::condition_variable PackageHandler::tableOidCond;
std::mutex PackageHandler::tableOidMutex;
boost::condition_variable PackageHandler::tableOidCond;
boost::mutex PackageHandler::tableOidMutex;
//------------------------------------------------------------------------------
// A thread to periodically call dbrm to see if a user is
@ -146,7 +145,7 @@ struct CancellationThread
// Tell any active processors to stop working and return an error
// The front end will respond with a ROLLBACK command.
// Mark all active processors to rollback
std::unique_lock lk2(DMLProcessor::packageHandlerMapLock);
boost::mutex::scoped_lock lk2(DMLProcessor::packageHandlerMapLock);
for (phIter = DMLProcessor::packageHandlerMap.begin();
phIter != DMLProcessor::packageHandlerMap.end(); ++phIter)
@ -366,7 +365,7 @@ int PackageHandler::synchTableAccess(dmlpackage::CalpontDMLPackage* dmlPackage)
{
// MCOL-140 Wait for any other DML using this table.
std::map<uint32_t, PackageHandler::tableAccessQueue_t>::iterator it;
std::unique_lock<std::mutex> lock(tableOidMutex);
boost::unique_lock<boost::mutex> lock(tableOidMutex);
BRM::TxnID txnid;
if (fPackageType != dmlpackage::DML_COMMAND)
@ -466,7 +465,7 @@ int PackageHandler::releaseTableAccess()
{
// take us out of the queue
std::map<uint32_t, PackageHandler::tableAccessQueue_t>::iterator it;
boost::lock_guard<std::mutex> lock(tableOidMutex);
boost::lock_guard<boost::mutex> lock(tableOidMutex);
if (fTableOid == 0 || (it = tableOidMap.find(fTableOid)) == tableOidMap.end())
{
@ -513,7 +512,7 @@ int PackageHandler::forceReleaseTableAccess()
// By removing the txnid from the queue, the logic after the wait in
// synchTableAccess() will release the thread and clean up if needed.
std::map<uint32_t, PackageHandler::tableAccessQueue_t>::iterator it;
boost::lock_guard<std::mutex> lock(tableOidMutex);
boost::lock_guard<boost::mutex> lock(tableOidMutex);
if (fTableOid == 0 || (it = tableOidMap.find(fTableOid)) == tableOidMap.end())
{
@ -604,7 +603,7 @@ void PackageHandler::run()
// cout << "This is batch insert " << endl;
BatchInsertProc* batchProcessor = NULL;
{
std::unique_lock lk(DMLProcessor::batchinsertProcessorMapLock);
boost::mutex::scoped_lock lk(DMLProcessor::batchinsertProcessorMapLock);
std::map<uint32_t, BatchInsertProc*>::iterator batchIter =
DMLProcessor::batchinsertProcessorMap.find(fSessionID);
@ -751,7 +750,7 @@ void PackageHandler::run()
// remove the batch insert object
{
std::unique_lock lk(DMLProcessor::batchinsertProcessorMapLock);
boost::mutex::scoped_lock lk(DMLProcessor::batchinsertProcessorMapLock);
std::map<uint32_t, BatchInsertProc*>::iterator batchIter =
DMLProcessor::batchinsertProcessorMap.find(fSessionID);
@ -867,7 +866,7 @@ void PackageHandler::run()
// remove from map
{
std::unique_lock lk(DMLProcessor::batchinsertProcessorMapLock);
boost::mutex::scoped_lock lk(DMLProcessor::batchinsertProcessorMapLock);
std::map<uint32_t, BatchInsertProc*>::iterator batchIter =
DMLProcessor::batchinsertProcessorMap.find(fSessionID);
@ -912,7 +911,7 @@ void PackageHandler::run()
logger.logMessage(LOG_TYPE_DEBUG, msg, logid);
// remove from map
{
std::unique_lock lk(DMLProcessor::batchinsertProcessorMapLock);
boost::mutex::scoped_lock lk(DMLProcessor::batchinsertProcessorMapLock);
std::map<uint32_t, BatchInsertProc*>::iterator batchIter =
DMLProcessor::batchinsertProcessorMap.find(fSessionID);
@ -1164,7 +1163,7 @@ void PackageHandler::run()
// If we remove it after sending the results, it's possible for a commit
// or rollback be sent and get processed before it is removed, and that
// will fail.
std::unique_lock lk2(DMLProcessor::packageHandlerMapLock);
boost::mutex::scoped_lock lk2(DMLProcessor::packageHandlerMapLock);
DMLProcessor::packageHandlerMap.erase(getSessionID());
lk2.unlock();
@ -1453,7 +1452,7 @@ void DMLProcessor::operator()()
if (insertPkg.get_isBatchInsert() && insertPkg.get_Logending())
{
{
std::unique_lock lk(DMLProcessor::batchinsertProcessorMapLock);
boost::mutex::scoped_lock lk(DMLProcessor::batchinsertProcessorMapLock);
std::map<uint32_t, BatchInsertProc*>::iterator batchIter =
DMLProcessor::batchinsertProcessorMap.find(sessionID);
@ -1503,7 +1502,7 @@ void DMLProcessor::operator()()
// This mechanism may prove useful for other things, so the above
// comment may change.
{
std::unique_lock lk2(DMLProcessor::packageHandlerMapLock);
boost::mutex::scoped_lock lk2(DMLProcessor::packageHandlerMapLock);
DMLProcessor::PackageHandlerMap_t::iterator phIter = packageHandlerMap.find(sessionID);
if (phIter != packageHandlerMap.end())
@ -1741,7 +1740,7 @@ void DMLProcessor::operator()()
sessionID, txnid.id, fDbrm, fQtc, csc));
// We put the packageHandler into a map so that if we receive a
// message to affect the previous command, we can find it.
std::unique_lock lk2(DMLProcessor::packageHandlerMapLock, std::defer_lock);
boost::mutex::scoped_lock lk2(DMLProcessor::packageHandlerMapLock, boost::defer_lock);
lk2.lock();
packageHandlerMap[sessionID] = php;
@ -1783,7 +1782,7 @@ void DMLProcessor::operator()()
fIos, bs1, packageType, fEC, fConcurrentSupport, maxDeleteRows, sessionID, 0, fDbrm, fQtc, csc));
// We put the packageHandler into a map so that if we receive a
// message to affect the previous command, we can find it.
std::unique_lock lk2(DMLProcessor::packageHandlerMapLock, std::defer_lock);
boost::mutex::scoped_lock lk2(DMLProcessor::packageHandlerMapLock, boost::defer_lock);
lk2.lock();
packageHandlerMap[sessionID] = php;

View File

@ -229,8 +229,8 @@ class PackageHandler
int forceReleaseTableAccess();
typedef iterable_queue<execplan::CalpontSystemCatalog::SCN> tableAccessQueue_t;
static std::map<uint32_t, tableAccessQueue_t> tableOidMap;
static std::condition_variable tableOidCond;
static std::mutex tableOidMutex;
static boost::condition_variable tableOidCond;
static boost::mutex tableOidMutex;
public:
static int clearTableAccess();
@ -295,11 +295,11 @@ class DMLProcessor
// A map to hold pointers to all active PackageProcessors
typedef std::map<uint32_t, boost::shared_ptr<PackageHandler> > PackageHandlerMap_t;
static PackageHandlerMap_t packageHandlerMap;
static std::mutex packageHandlerMapLock;
static boost::mutex packageHandlerMapLock;
// A map to hold pointers to all BatchInsertProc object
static std::map<uint32_t, BatchInsertProc*> batchinsertProcessorMap;
static std::mutex batchinsertProcessorMapLock;
static boost::mutex batchinsertProcessorMapLock;
friend struct CancellationThread;
friend class PackageHandler;

View File

@ -41,7 +41,7 @@ DMLResultBuffer::~DMLResultBuffer()
void DMLResultBuffer::put(dmlpackageprocessor::DMLPackageProcessor::DMLResult result, int sessionID)
{
std::unique_lock lock(fMutex);
scoped_lock lock(fMutex);
if (fFull == fBufferSize)
{
@ -60,7 +60,7 @@ void DMLResultBuffer::put(dmlpackageprocessor::DMLPackageProcessor::DMLResult re
DMLResultBuffer::ResultPair DMLResultBuffer::get()
{
std::unique_lock lk(fMutex);
scoped_lock lk(fMutex);
if (fFull == 0)
{

View File

@ -25,8 +25,7 @@
#pragma once
#include <deque>
#include <boost/thread/thread.hpp>
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include "dmlpackageprocessor.h"
namespace dmlprocessor
@ -36,6 +35,8 @@ namespace dmlprocessor
class DMLResultBuffer
{
public:
typedef boost::mutex::scoped_lock scoped_lock;
/** @brief the type of a <DMLResult, sessionID> pair
*
*/
@ -79,8 +80,8 @@ class DMLResultBuffer
ResultPair get();
private:
std::mutex fMutex;
std::condition_variable fCond;
boost::mutex fMutex;
boost::condition fCond;
typedef std::deque<ResultPair> ResultBuffer;
ResultBuffer fResultBuffer;

View File

@ -39,7 +39,7 @@ using namespace boost;
namespace
{
oam::OamCache* oamCache = nullptr;
std::mutex cacheLock;
boost::mutex cacheLock;
} // namespace
namespace oam
@ -50,7 +50,7 @@ OamCache* OamCache::makeOamCache()
{
if (!hasOAMCache.load(std::memory_order_relaxed))
{
std::unique_lock lk(cacheLock);
boost::mutex::scoped_lock lk(cacheLock);
if (oamCache == nullptr)
{

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)

View File

@ -19,8 +19,8 @@
//
#include <unistd.h>
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
using namespace boost;
#include "activestatementcounter.h"
@ -30,7 +30,7 @@ void ActiveStatementCounter::incr(bool& counted)
return;
counted = true;
std::unique_lock lk(fMutex);
boost::mutex::scoped_lock lk(fMutex);
if (upperLimit > 0)
while (fStatementCount >= upperLimit)
@ -49,7 +49,7 @@ void ActiveStatementCounter::decr(bool& counted)
return;
counted = false;
std::unique_lock lk(fMutex);
boost::mutex::scoped_lock lk(fMutex);
if (fStatementCount == 0)
return;

View File

@ -23,9 +23,8 @@
#include <stdint.h>
#include <map>
#include <mutex>
#include <condition_variable>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include "vss.h"
@ -58,8 +57,8 @@ class ActiveStatementCounter
uint32_t fStatementCount;
uint32_t upperLimit;
uint32_t fStatementsWaiting;
std::mutex fMutex;
std::condition_variable condvar;
boost::mutex fMutex;
boost::condition condvar;
BRM::VSS fVss;
};

View File

@ -320,11 +320,11 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs)
for (uint j = 0; j < joinerCount; ++j)
tlJoiners[j].reset(new boost::shared_ptr<TLJoiner>[processorThreads]);
addToJoinerLocks.reset(new boost::scoped_array<std::mutex>[joinerCount]);
addToJoinerLocks.reset(new boost::scoped_array<boost::mutex>[joinerCount]);
for (uint j = 0; j < joinerCount; ++j)
addToJoinerLocks[j].reset(new std::mutex[processorThreads]);
addToJoinerLocks[j].reset(new boost::mutex[processorThreads]);
smallSideDataLocks.reset(new std::mutex[joinerCount]);
smallSideDataLocks.reset(new boost::mutex[joinerCount]);
tJoinerSizes.reset(new std::atomic<uint32_t>[joinerCount]);
largeSideKeyColumns.reset(new uint32_t[joinerCount]);
tlLargeSideKeyColumns.reset(new vector<uint32_t>[joinerCount]);
@ -830,7 +830,7 @@ void BatchPrimitiveProcessor::addToJoiner(ByteStream& bs)
// TODO: write an RGData fcn to let it interpret data within a ByteStream to avoid
// the extra copying.
offTheWire.deserialize(bs);
std::unique_lock lk(smallSideDataLocks[joinerNum]);
boost::mutex::scoped_lock lk(smallSideDataLocks[joinerNum]);
smallSide.setData(&smallSideRowData[joinerNum]);
smallSide.append(offTheWire, startPos);
@ -868,7 +868,7 @@ int BatchPrimitiveProcessor::endOfJoiner()
uint32_t i;
size_t currentSize;
// it should be safe to run this without grabbing this lock
// std::unique_lock scoped(addToJoinerLock);
// boost::mutex::scoped_lock scoped(addToJoinerLock);
if (endOfJoinerRan)
return 0;
@ -2183,7 +2183,7 @@ void BatchPrimitiveProcessor::sendResponse()
}
else
{
std::unique_lock lk(*writelock);
boost::mutex::scoped_lock lk(*writelock);
sock->write(*serialized);
}

View File

@ -264,7 +264,7 @@ class BatchPrimitiveProcessor
bool hasWideColumnOut;
uint8_t wideColumnWidthOut;
// IO counters
std::mutex counterLock;
boost::mutex counterLock;
uint32_t busyLoaderCount;
uint32_t physIO, cachedIO, touchedBlocks;
@ -284,8 +284,8 @@ class BatchPrimitiveProcessor
/* Join support TODO: Make join ops a seperate Command class. */
bool doJoin;
boost::scoped_array<boost::scoped_array<std::mutex>> addToJoinerLocks;
boost::scoped_array<std::mutex> smallSideDataLocks;
boost::scoped_array<boost::scoped_array<boost::mutex>> addToJoinerLocks;
boost::scoped_array<boost::mutex> smallSideDataLocks;
// uint32_t ridsIn, ridsOut;

View File

@ -70,7 +70,7 @@ typedef std::tr1::unordered_map<pthread_t, SPPTLogs_t> PTLogsMap_t;
PTLogsMap_t gFDList;
SPPTLogs_t gLogFD;
std::mutex gFDMutex; // pthread_mutex_t gFDMutex=PTHREAD_MUTEX_INITIALIZER;
boost::mutex gFDMutex; // pthread_mutex_t gFDMutex=PTHREAD_MUTEX_INITIALIZER;
int gThdCnt = 0;
extern dbbc::BlockRequestProcessor** BRPp;
@ -133,7 +133,7 @@ int BPPSeeder::operator()()
PTLogs_t* logFD = NULL;
int ret = 0;
pthread_t tid = 0;
std::unique_lock scoped(bppLock, std::defer_lock);
boost::mutex::scoped_lock scoped(bppLock, boost::defer_lock_t());
try
{
@ -370,7 +370,7 @@ void BPPSeeder::sendErrorMsg(uint32_t id, uint16_t status, uint32_t step)
msg.append((uint8_t*)&ism, sizeof(ism));
msg.append((uint8_t*)&ph, sizeof(ph));
std::unique_lock lk(*writelock);
boost::mutex::scoped_lock lk(*writelock);
sock->write(msg);
}

View File

@ -258,7 +258,7 @@ void BPPSendThread::mainLoop()
try
{
std::unique_lock sl2(*lock);
boost::mutex::scoped_lock sl2(*lock);
sock->write(*msg[msgsSent].msg);
// cout << "sent 1 msg\n";
}

View File

@ -101,7 +101,7 @@ bool FEMsgHandler::aborted()
if (sawData)
return true;
std::unique_lock sl(mutex);
boost::mutex::scoped_lock sl(mutex);
int err;
int connectionNum = sock->getConnectionNum();
@ -127,7 +127,7 @@ void FEMsgHandler::threadFcn()
*/
while (!die && err == 0)
{
std::unique_lock sl(mutex);
boost::mutex::scoped_lock sl(mutex);
err = InetStreamSocket::pollConnection(connectionNum, 1000);
}

View File

@ -42,6 +42,6 @@ class FEMsgHandler
bool die, running, sawData;
messageqcpp::IOSocket* sock;
boost::shared_ptr<joblist::JobList> jl;
std::mutex mutex;
boost::mutex mutex;
uint64_t thr;
};

View File

@ -46,7 +46,7 @@ Logger::Logger() : fMl1(LoggingID(28))
void Logger::logMessage(const Message::MessageID mid, const Message::Args& args, bool critical)
{
std::scoped_lock lk(fLogLock);
mutex::scoped_lock lk(fLogLock);
MsgMap::iterator msgIter = fMsgMap.find(mid);
if (msgIter == fMsgMap.end())
@ -67,7 +67,7 @@ void Logger::logMessage(const Message::MessageID mid, const Message::Args& args,
void Logger::logInfoMessage(const Message::MessageID mid, const Message::Args& args)
{
std::scoped_lock lk(fLogLock);
mutex::scoped_lock lk(fLogLock);
MsgMap::iterator msgIter = fMsgMap.find(mid);
if (msgIter == fMsgMap.end())

View File

@ -57,7 +57,7 @@ class Logger
typedef std::map<logging::Message::MessageID, logging::Message> MsgMap;
MsgMap fMsgMap;
std::mutex fLogLock;
boost::mutex fLogLock;
logging::MessageLog fMl1;
};

View File

@ -34,7 +34,7 @@
//#define NDEBUG
#include <cassert>
#include <boost/thread.hpp>
#include <condition_variable>
#include <boost/thread/condition.hpp>
#include <boost/foreach.hpp>
#include <tr1/unordered_map>
#include <tr1/unordered_set>
@ -142,11 +142,11 @@ int directIOFlag = O_DIRECT;
int noVB = 0;
BPPMap bppMap;
std::mutex bppLock;
boost::mutex bppLock;
#define DJLOCK_READ 0
#define DJLOCK_WRITE 1
std::mutex djMutex; // lock for djLock, lol.
boost::mutex djMutex; // lock for djLock, lol.
std::map<uint64_t, shared_mutex*> djLock; // djLock synchronizes destroy and joiner msgs, see bug 2619
volatile int32_t asyncCounter;
@ -155,7 +155,7 @@ const int asyncMax = 20; // current number of asynchronous loads
struct preFetchCond
{
// uint64_t lbid;
std::condition_variable_any cond;
boost::condition cond;
unsigned waiters;
preFetchCond(const uint64_t l)
@ -173,13 +173,13 @@ typedef std::tr1::unordered_map<uint64_t, preFetchBlock_t*> pfBlockMap_t;
typedef std::tr1::unordered_map<uint64_t, preFetchBlock_t*>::iterator pfBlockMapIter_t;
pfBlockMap_t pfBlockMap;
std::mutex pfbMutex; // = PTHREAD_MUTEX_INITIALIZER;
boost::mutex pfbMutex; // = PTHREAD_MUTEX_INITIALIZER;
pfBlockMap_t pfExtentMap;
std::mutex pfMutex; // = PTHREAD_MUTEX_INITIALIZER;
boost::mutex pfMutex; // = PTHREAD_MUTEX_INITIALIZER;
map<uint32_t, boost::shared_ptr<DictEqualityFilter> > dictEqualityFilters;
std::mutex eqFilterMutex;
boost::mutex eqFilterMutex;
uint32_t cacheNum(uint64_t lbid)
{
@ -600,7 +600,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
memcpy(bufferPtr, readBufferPtr, i);
#ifdef IDB_COMP_POC_DEBUG
{
std::unique_lock lk(primitiveprocessor::compDebugMutex);
boost::mutex::scoped_lock lk(primitiveprocessor::compDebugMutex);
cout << "pread2(" << fd << ", 0x" << hex << (ptrdiff_t)readBufferPtr << dec << ", "
<< DATA_BLOCK_SIZE << ", " << offset << ") = " << i << endl;
}
@ -838,7 +838,7 @@ void loadBlock(uint64_t lbid, QueryContext v, uint32_t t, int compType, void* bu
struct AsynchLoader
{
AsynchLoader(uint64_t l, const QueryContext& v, uint32_t t, int ct, uint32_t* cCount, uint32_t* rCount,
bool trace, uint32_t sesID, std::mutex* m, uint32_t* loaderCount,
bool trace, uint32_t sesID, boost::mutex* m, uint32_t* loaderCount,
boost::shared_ptr<BPPSendThread> st, // sendThread for abort upon exception.
VSSCache* vCache)
: lbid(l)
@ -922,13 +922,13 @@ struct AsynchLoader
uint32_t* cacheCount;
uint32_t* readCount;
uint32_t* busyLoaders;
std::mutex* mutex;
boost::mutex* mutex;
boost::shared_ptr<BPPSendThread> sendThread;
VSSCache* vssCache;
};
void loadBlockAsync(uint64_t lbid, const QueryContext& c, uint32_t txn, int compType, uint32_t* cCount,
uint32_t* rCount, bool LBIDTrace, uint32_t sessionID, std::mutex* m,
uint32_t* rCount, bool LBIDTrace, uint32_t sessionID, boost::mutex* m,
uint32_t* busyLoaders,
boost::shared_ptr<BPPSendThread> sendThread, // sendThread for abort upon exception.
VSSCache* vssCache)
@ -965,7 +965,7 @@ void loadBlockAsync(uint64_t lbid, const QueryContext& c, uint32_t txn, int comp
(void)atomicops::atomicInc(&asyncCounter);
std::unique_lock sl(*m);
boost::mutex::scoped_lock sl(*m);
try
{
@ -1061,7 +1061,7 @@ void DictScanJob::write(const SBS& sbs)
exeMgrDecPtr->addDataToOutput(sbs);
return;
}
std::unique_lock lk(*fWriteLock);
boost::mutex::scoped_lock lk(*fWriteLock);
fIos->write(*sbs);
}
@ -1103,7 +1103,7 @@ int DictScanJob::operator()()
/* Grab the equality filter if one is specified */
if (cmd->flags & HAS_EQ_FILTER)
{
std::unique_lock sl(eqFilterMutex);
boost::mutex::scoped_lock sl(eqFilterMutex);
map<uint32_t, boost::shared_ptr<DictEqualityFilter> >::iterator it;
it = dictEqualityFilters.find(uniqueId);
@ -1202,7 +1202,7 @@ struct BPPHandler
~BPPHandler()
{
std::unique_lock scoped(bppLock);
boost::mutex::scoped_lock scoped(bppLock);
for (bppKeysIt = bppKeys.begin(); bppKeysIt != bppKeys.end(); ++bppKeysIt)
{
@ -1314,7 +1314,7 @@ struct BPPHandler
return -1;
}
std::unique_lock scoped(bppLock);
boost::mutex::scoped_lock scoped(bppLock);
bppKeysIt = std::find(bppKeys.begin(), bppKeys.end(), key);
if (bppKeysIt != bppKeys.end())
@ -1406,7 +1406,7 @@ struct BPPHandler
}
}
std::unique_lock scoped(bppLock);
boost::mutex::scoped_lock scoped(bppLock);
key = bpp->getUniqueID();
bppKeys.push_back(key);
bool newInsert;
@ -1435,7 +1435,7 @@ struct BPPHandler
*/
SBPPV ret;
std::unique_lock scoped(bppLock);
boost::mutex::scoped_lock scoped(bppLock);
it = bppMap.find(uniqueID);
if (it != bppMap.end())
@ -1464,7 +1464,7 @@ struct BPPHandler
inline shared_mutex& getDJLock(uint32_t uniqueID)
{
std::unique_lock lk(djMutex);
boost::mutex::scoped_lock lk(djMutex);
auto it = djLock.find(uniqueID);
if (it != djLock.end())
return *it->second;
@ -1477,7 +1477,7 @@ struct BPPHandler
inline void deleteDJLock(uint32_t uniqueID)
{
std::unique_lock lk(djMutex);
boost::mutex::scoped_lock lk(djMutex);
auto it = djLock.find(uniqueID);
if (it != djLock.end())
{
@ -1538,7 +1538,7 @@ struct BPPHandler
return -1;
}
std::unique_lock<shared_mutex> lk(getDJLock(uniqueID));
boost::unique_lock<shared_mutex> lk(getDJLock(uniqueID));
for (i = 0; i < bppv->get().size(); i++)
{
@ -1579,8 +1579,8 @@ struct BPPHandler
bs >> stepID;
bs >> uniqueID;
std::unique_lock<shared_mutex> lk(getDJLock(uniqueID));
std::unique_lock scoped(bppLock);
boost::unique_lock<shared_mutex> lk(getDJLock(uniqueID));
boost::mutex::scoped_lock scoped(bppLock);
bppKeysIt = std::find(bppKeys.begin(), bppKeys.end(), uniqueID);
@ -1750,7 +1750,7 @@ class CreateEqualityFilter : public DictionaryOp
filter->insert(str);
}
std::unique_lock sl(eqFilterMutex);
boost::mutex::scoped_lock sl(eqFilterMutex);
dictEqualityFilters[uniqueID] = filter;
}
};
@ -1774,7 +1774,7 @@ class DestroyEqualityFilter : public DictionaryOp
bs->advance(sizeof(ISMPacketHeader));
*bs >> uniqueID;
std::unique_lock sl(eqFilterMutex);
boost::mutex::scoped_lock sl(eqFilterMutex);
it = dictEqualityFilters.find(uniqueID);
if (it != dictEqualityFilters.end())
@ -2053,7 +2053,7 @@ struct ReadThread
// IOSocket. If we end up rotating through multiple output sockets
// for the same UM, we will use UmSocketSelector to select output.
SP_UM_IOSOCK outIosDefault(new IOSocket(fIos));
SP_UM_MUTEX writeLockDefault(new std::mutex());
SP_UM_MUTEX writeLockDefault(new boost::mutex());
bool bRotateDest = fPrimitiveServerPtr->rotatingDestination();

View File

@ -45,7 +45,7 @@ namespace primitiveprocessor
{
extern dbbc::BlockRequestProcessor** BRPp;
extern BRM::DBRM* brm;
extern std::mutex bppLock;
extern boost::mutex bppLock;
extern uint32_t highPriorityThreads, medPriorityThreads, lowPriorityThreads;
class BPPSendThread;
@ -90,7 +90,7 @@ void loadBlock(uint64_t lbid, BRM::QueryContext q, uint32_t txn, int compType, v
bool* pWasBlockInCache, uint32_t* rCount = NULL, bool LBIDTrace = false,
uint32_t sessionID = 0, bool doPrefetch = true, VSSCache* vssCache = NULL);
void loadBlockAsync(uint64_t lbid, const BRM::QueryContext& q, uint32_t txn, int CompType, uint32_t* cCount,
uint32_t* rCount, bool LBIDTrace, uint32_t sessionID, std::mutex* m,
uint32_t* rCount, bool LBIDTrace, uint32_t sessionID, boost::mutex* m,
uint32_t* busyLoaders, boost::shared_ptr<BPPSendThread> sendThread,
VSSCache* vssCache = 0);
uint32_t loadBlocks(BRM::LBID_t* lbids, BRM::QueryContext q, BRM::VER_t txn, int compType,

View File

@ -111,7 +111,7 @@ const int MAX_BUFFER_SIZE = 32768 * 2;
// const logging::LoggingID lid1(28);
// extern logging::Message msg16;
// extern logging::MessageLog ml1;
// extern std::mutex logLock;
// extern boost::mutex logLock;
extern Logger* mlp;
} // namespace primitiveprocessor

View File

@ -73,7 +73,7 @@ int main()
sock[i][j].setSocketImpl(new InetStreamSocket());
sa.sin_port = htons((i * 4) + j);
sock[i][j].sa(sa);
sockSel->addConnection(SP_UM_IOSOCK(new IOSocket(sock[i][j])), SP_UM_MUTEX(new std::mutex()));
sockSel->addConnection(SP_UM_IOSOCK(new IOSocket(sock[i][j])), SP_UM_MUTEX(new boost::mutex()));
}
}
@ -146,7 +146,7 @@ int main()
sockUnknown[i][j].setSocketImpl(new InetStreamSocket());
saUnknown.sin_port = htons((i * 4) + j);
sockUnknown[i][j].sa(saUnknown);
sockSel->addConnection(SP_UM_IOSOCK(new IOSocket(sockUnknown[i][j])), SP_UM_MUTEX(new std::mutex()));
sockSel->addConnection(SP_UM_IOSOCK(new IOSocket(sockUnknown[i][j])), SP_UM_MUTEX(new boost::mutex()));
}
}

View File

@ -307,7 +307,7 @@ const std::string UmSocketSelector::toString() const
//------------------------------------------------------------------------------
void UmModuleIPs::addIP(in_addr_t ip)
{
std::unique_lock lock(fUmModuleMutex);
boost::mutex::scoped_lock lock(fUmModuleMutex);
#ifdef MOD_CONN_DEBUG
std::ostringstream oss;
@ -331,7 +331,7 @@ bool UmModuleIPs::addSocketConn(const SP_UM_IOSOCK& ioSock, const SP_UM_MUTEX& w
{
bool bConnAdded = false;
std::unique_lock lock(fUmModuleMutex);
boost::mutex::scoped_lock lock(fUmModuleMutex);
for (unsigned int i = 0; i < fUmIPSocketConns.size(); ++i)
{
@ -367,7 +367,7 @@ bool UmModuleIPs::addSocketConn(const SP_UM_IOSOCK& ioSock, const SP_UM_MUTEX& w
//------------------------------------------------------------------------------
void UmModuleIPs::delSocketConn(const messageqcpp::IOSocket& ioSock)
{
std::unique_lock lock(fUmModuleMutex);
boost::mutex::scoped_lock lock(fUmModuleMutex);
for (unsigned int i = 0; i < fUmIPSocketConns.size(); ++i)
{
@ -408,7 +408,7 @@ bool UmModuleIPs::nextIOSocket(SP_UM_IOSOCK& outIos, SP_UM_MUTEX& writeLock)
{
bool found = false;
std::unique_lock lock(fUmModuleMutex);
boost::mutex::scoped_lock lock(fUmModuleMutex);
if ((fUmIPSocketConns.size() > 0) && (fNextUmIPSocketIdx != NEXT_IP_SOCKET_UNASSIGNED))
{
@ -468,7 +468,7 @@ const std::string UmModuleIPs::toString()
{
std::ostringstream oss;
std::unique_lock lock(fUmModuleMutex);
boost::mutex::scoped_lock lock(fUmModuleMutex);
oss << "UM module name: " << fUmModuleName << "; nextUmIPIdx: " << fNextUmIPSocketIdx << std::endl;
for (unsigned int i = 0; i < fUmIPSocketConns.size(); ++i)

View File

@ -48,7 +48,7 @@ class UmIPSocketConns;
typedef boost::shared_ptr<UmModuleIPs> SP_UM_MODIPS;
typedef boost::shared_ptr<UmIPSocketConns> SP_UM_IPCONNS;
typedef boost::shared_ptr<messageqcpp::IOSocket> SP_UM_IOSOCK;
typedef boost::shared_ptr<std::mutex> SP_UM_MUTEX;
typedef boost::shared_ptr<boost::mutex> SP_UM_MUTEX;
//------------------------------------------------------------------------------
/** @brief Public API class used to track and select socket for outgoing msgs.
@ -219,7 +219,7 @@ class UmModuleIPs
static const int32_t NEXT_IP_SOCKET_UNASSIGNED;
std::string fUmModuleName; // UM module name
int32_t fNextUmIPSocketIdx; // index to "next" IP address
std::mutex fUmModuleMutex;
boost::mutex fUmModuleMutex;
// collection of IP addresses and their corresponding socket/port conns
std::vector<SP_UM_IPCONNS> fUmIPSocketConns;

View File

@ -32,7 +32,7 @@ namespace bf = boost::filesystem;
namespace
{
std::mutex m;
boost::mutex m;
storagemanager::Cache* inst = NULL;
} // namespace
@ -42,7 +42,7 @@ Cache* Cache::get()
{
if (inst)
return inst;
std::unique_lock<std::mutex> s(m);
boost::unique_lock<boost::mutex> s(m);
if (inst)
return inst;
inst = new Cache();
@ -122,7 +122,7 @@ Cache::~Cache()
// be careful using this! SM should be idle. No ongoing reads or writes.
void Cache::validateCacheSize()
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
for (auto it = prefixCaches.begin(); it != prefixCaches.end(); ++it)
it->second->validateCacheSize();
@ -196,7 +196,7 @@ void Cache::deletedObject(const bf::path& prefix, const string& key, size_t size
void Cache::setMaxCacheSize(size_t size)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
maxCacheSize = size;
for (auto it = prefixCaches.begin(); it != prefixCaches.end(); ++it)
@ -231,7 +231,7 @@ size_t Cache::getCurrentCacheSize()
{
size_t totalSize = 0;
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
for (auto it = prefixCaches.begin(); it != prefixCaches.end(); ++it)
totalSize += it->second->getCurrentCacheSize();
@ -259,7 +259,7 @@ size_t Cache::getCurrentCacheElementCount(const bf::path& prefix)
void Cache::reset()
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
for (auto it = prefixCaches.begin(); it != prefixCaches.end(); ++it)
it->second->reset();
@ -267,7 +267,7 @@ void Cache::reset()
void Cache::newPrefix(const bf::path& prefix)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
// cerr << "Cache: making new prefix " << prefix.string() << endl;
assert(prefixCaches.find(prefix) == prefixCaches.end());
@ -280,7 +280,7 @@ void Cache::newPrefix(const bf::path& prefix)
void Cache::dropPrefix(const bf::path& prefix)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
auto* pCache = prefixCaches[prefix];
prefixCaches.erase(prefix);
@ -290,7 +290,7 @@ void Cache::dropPrefix(const bf::path& prefix)
inline PrefixCache& Cache::getPCache(const bf::path& prefix)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
// cerr << "Getting pcache for " << prefix.string() << endl;
PrefixCache* ret;
@ -316,7 +316,7 @@ Downloader* Cache::getDownloader() const
void Cache::shutdown()
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
downloader.reset();
}

View File

@ -32,8 +32,7 @@
#include <map>
#include <boost/utility.hpp>
#include <boost/filesystem/path.hpp>
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
// Setting to min possible based on
// using 1k in config file. If wrong
@ -114,7 +113,7 @@ class Cache : public boost::noncopyable, public ConfigListener
PrefixCache& getPCache(const boost::filesystem::path& prefix);
std::map<boost::filesystem::path, PrefixCache*> prefixCaches;
mutable std::mutex lru_mutex; // protects the prefixCaches
mutable boost::mutex lru_mutex; // protects the prefixCaches
};
} // namespace storagemanager

View File

@ -22,7 +22,7 @@
namespace
{
storagemanager::ClientRequestProcessor* crp = NULL;
std::mutex m;
boost::mutex m;
}; // namespace
namespace storagemanager
@ -39,7 +39,7 @@ ClientRequestProcessor* ClientRequestProcessor::get()
{
if (crp)
return crp;
std::unique_lock s(m);
boost::mutex::scoped_lock s(m);
if (crp)
return crp;
crp = new ClientRequestProcessor();

View File

@ -20,8 +20,7 @@
#include "S3Storage.h"
#include "LocalStorage.h"
#include "SMLogging.h"
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <string>
#include <ctype.h>
#include <iostream>
@ -30,7 +29,7 @@ using namespace std;
namespace
{
std::mutex m;
boost::mutex m;
storagemanager::CloudStorage* inst = NULL;
string tolower(const string& s)
@ -53,7 +52,7 @@ CloudStorage* CloudStorage::get()
SMLogging* logger = SMLogging::get();
Config* conf = Config::get();
string type = tolower(conf->getValue("ObjectStorage", "service"));
std::unique_lock s(m);
boost::mutex::scoped_lock s(m);
if (inst)
return inst;
if (type == "s3")

View File

@ -20,10 +20,7 @@
// This one is the build system config
#include "mcsconfig.h"
#include <map>
#include <mutex>
#include <thread>
#include <boost/thread/mutex.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/filesystem.hpp>
#include <boost/regex.hpp>
@ -42,7 +39,7 @@ using namespace std;
namespace
{
std::mutex m;
boost::mutex m;
storagemanager::Config* inst = NULL;
} // namespace
@ -52,7 +49,7 @@ Config* Config::get()
{
if (inst)
return inst;
std::unique_lock s(m);
boost::mutex::scoped_lock s(m);
if (inst)
return inst;
inst = new Config();
@ -63,7 +60,7 @@ Config* Config::get(const string& configFile)
{
if (inst)
return inst;
std::unique_lock s(m);
boost::mutex::scoped_lock s(m);
if (inst)
return inst;
inst = new Config(configFile);
@ -162,7 +159,7 @@ bool Config::reload()
return rtn;
last_mtime = statbuf.st_mtim;
rtn = true;
std::unique_lock<std::mutex> s(mutex);
boost::unique_lock<boost::mutex> s(mutex);
contents.clear();
boost::property_tree::ini_parser::read_ini(filename, contents);
return rtn;
@ -194,7 +191,7 @@ string Config::getValue(const string& section, const string& key) const
{
// if we care, move this envvar substition stuff to where the file is loaded
string ret;
std::unique_lock<std::mutex> s(mutex);
boost::unique_lock<boost::mutex> s(mutex);
try
{
ret = contents.get<string>(section + "." + key);

View File

@ -67,7 +67,7 @@ class Config : public boost::noncopyable
void reloadThreadFcn();
std::vector<ConfigListener*> configListeners;
struct ::timespec last_mtime;
mutable std::mutex mutex;
mutable boost::mutex mutex;
boost::thread reloader;
boost::posix_time::time_duration reloadInterval;

View File

@ -44,10 +44,10 @@ Downloader::~Downloader()
}
void Downloader::download(const vector<const string*>& keys, vector<int>* errnos, vector<size_t>* sizes,
const bf::path& prefix, std::mutex* cache_lock)
const bf::path& prefix, boost::mutex* cache_lock)
{
uint counter = keys.size();
std::condition_variable condvar;
boost::condition condvar;
DownloadListener listener(&counter, &condvar);
vector<boost::shared_ptr<Download> > ownedDownloads(keys.size());
@ -56,7 +56,7 @@ void Downloader::download(const vector<const string*>& keys, vector<int>* errnos
if it is not already being downloaded, make a new Download instance.
wait for the listener to tell us that it's done.
*/
std::unique_lock<std::mutex> s(lock);
boost::unique_lock<boost::mutex> s(lock);
for (uint i = 0; i < keys.size(); i++)
{
boost::shared_ptr<Download> newDL(new Download(*keys[i], prefix, cache_lock, this));
@ -86,10 +86,8 @@ void Downloader::download(const vector<const string*>& keys, vector<int>* errnos
}
s.unlock();
// wait for the downloads to finish
////XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx
// while (counter > 0)
// condvar.wait(*cache_lock);
while (counter > 0)
condvar.wait(*cache_lock);
// check success, gather sizes from downloads started by this thread
sizes->resize(keys.size());
@ -124,7 +122,7 @@ void Downloader::printKPIs() const
bool Downloader::inProgress(const string& key)
{
boost::shared_ptr<Download> tmp(new Download(key));
std::unique_lock<std::mutex> s(lock);
boost::unique_lock<boost::mutex> s(lock);
auto it = downloads.find(tmp);
if (it != downloads.end())
@ -137,7 +135,7 @@ const bf::path& Downloader::getTmpPath() const
return tmpPath;
}
/* The helper fcns */
Downloader::Download::Download(const string& source, const bf::path& _dlPath, std::mutex* _lock,
Downloader::Download::Download(const string& source, const bf::path& _dlPath, boost::mutex* _lock,
Downloader* _dl)
: dlPath(_dlPath), key(source), dl_errno(0), size(0), lock(_lock), finished(false), itRan(false), dl(_dl)
{
@ -186,7 +184,7 @@ void Downloader::Download::operator()()
lock->unlock();
}
Downloader::DownloadListener::DownloadListener(uint* _counter, std::condition_variable* condvar)
Downloader::DownloadListener::DownloadListener(uint* _counter, boost::condition* condvar)
: counter(_counter), cond(condvar)
{
}

View File

@ -28,9 +28,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <map>
#include <mutex>
#include <condition_variable>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/filesystem/path.hpp>
namespace storagemanager
@ -44,7 +43,7 @@ class Downloader : public ConfigListener
// caller owns the memory for the strings.
// errors are reported through errnos
void download(const std::vector<const std::string*>& keys, std::vector<int>* errnos,
std::vector<size_t>* sizes, const boost::filesystem::path& prefix, std::mutex* lock);
std::vector<size_t>* sizes, const boost::filesystem::path& prefix, boost::mutex* lock);
bool inProgress(const std::string&); // call this holding the cache's lock
const boost::filesystem::path& getTmpPath() const;
@ -55,17 +54,17 @@ class Downloader : public ConfigListener
private:
uint maxDownloads;
// boost::filesystem::path downloadPath;
std::mutex lock;
boost::mutex lock;
class DownloadListener
{
public:
DownloadListener(uint* counter, std::condition_variable* condvar);
DownloadListener(uint* counter, boost::condition* condvar);
void downloadFinished();
private:
uint* counter;
std::condition_variable* cond;
boost::condition* cond;
};
/* Possible optimization. Downloads used to use pointers to strings to avoid an extra copy.
@ -74,7 +73,7 @@ class Downloader : public ConfigListener
*/
struct Download : public ThreadPool::Job
{
Download(const std::string& source, const boost::filesystem::path& _dlPath, std::mutex*, Downloader*);
Download(const std::string& source, const boost::filesystem::path& _dlPath, boost::mutex*, Downloader*);
Download(const std::string& source);
virtual ~Download();
void operator()();
@ -82,7 +81,7 @@ class Downloader : public ConfigListener
const std::string key;
int dl_errno; // to propagate errors from the download job to the caller
size_t size;
std::mutex* lock;
boost::mutex* lock;
bool finished, itRan;
Downloader* dl;
std::vector<DownloadListener*> listeners;

View File

@ -39,7 +39,7 @@ using namespace std;
namespace
{
storagemanager::IOCoordinator* ioc = NULL;
std::mutex m;
boost::mutex m;
} // namespace
namespace bf = boost::filesystem;
@ -95,7 +95,7 @@ IOCoordinator* IOCoordinator::get()
{
if (ioc)
return ioc;
std::unique_lock s(m);
boost::mutex::scoped_lock s(m);
if (ioc)
return ioc;
ioc = new IOCoordinator();
@ -1495,7 +1495,7 @@ int IOCoordinator::mergeJournalInMem_bigJ(std::shared_ptr<uint8_t[]>& objData, s
void IOCoordinator::readLock(const string& filename)
{
std::unique_lock<std::mutex> s(lockMutex);
boost::unique_lock<boost::mutex> s(lockMutex);
// cout << "read-locking " << filename << endl;
assert(filename[0] != '/');
@ -1507,7 +1507,7 @@ void IOCoordinator::readLock(const string& filename)
void IOCoordinator::readUnlock(const string& filename)
{
std::unique_lock<std::mutex> s(lockMutex);
boost::unique_lock<boost::mutex> s(lockMutex);
auto it = locks.find(filename);
it->second->readUnlock();
@ -1520,7 +1520,7 @@ void IOCoordinator::readUnlock(const string& filename)
void IOCoordinator::writeLock(const string& filename)
{
std::unique_lock<std::mutex> s(lockMutex);
boost::unique_lock<boost::mutex> s(lockMutex);
// cout << "write-locking " << filename << endl;
assert(filename[0] != '/');
@ -1532,7 +1532,7 @@ void IOCoordinator::writeLock(const string& filename)
void IOCoordinator::writeUnlock(const string& filename)
{
std::unique_lock<std::mutex> s(lockMutex);
boost::unique_lock<boost::mutex> s(lockMutex);
auto it = locks.find(filename);
it->second->writeUnlock();

View File

@ -23,8 +23,7 @@
#include <vector>
#include <string>
#include <boost/utility.hpp>
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
#include <boost/filesystem.hpp>
@ -105,7 +104,7 @@ class IOCoordinator : public boost::noncopyable
boost::filesystem::path metaPath;
std::map<std::string, RWLock*> locks;
std::mutex lockMutex; // lol
boost::mutex lockMutex; // lol
void remove(const boost::filesystem::path& path);
void deleteMetaFile(const boost::filesystem::path& file);

View File

@ -48,7 +48,7 @@ namespace bf = boost::filesystem;
namespace
{
std::mutex mdfLock;
boost::mutex mdfLock;
storagemanager::MetadataFile::MetadataConfig* inst = NULL;
uint64_t metadataFilesAccessed = 0;
} // namespace
@ -59,7 +59,7 @@ MetadataFile::MetadataConfig* MetadataFile::MetadataConfig::get()
{
if (inst)
return inst;
std::unique_lock<std::mutex> s(mdfLock);
boost::unique_lock<boost::mutex> s(mdfLock);
if (inst)
return inst;
inst = new MetadataConfig();
@ -124,7 +124,7 @@ MetadataFile::MetadataFile(const boost::filesystem::path& filename)
mFilename = mpConfig->msMetadataPath / (filename.string() + ".meta");
std::unique_lock<std::mutex> s(jsonCache.getMutex());
boost::unique_lock<boost::mutex> s(jsonCache.getMutex());
jsontree = jsonCache.get(mFilename);
if (!jsontree)
{
@ -165,7 +165,7 @@ MetadataFile::MetadataFile(const boost::filesystem::path& filename, no_create_t,
if (appendExt)
mFilename = mpConfig->msMetadataPath / (mFilename.string() + ".meta");
std::unique_lock<std::mutex> s(jsonCache.getMutex());
boost::unique_lock<boost::mutex> s(jsonCache.getMutex());
jsontree = jsonCache.get(mFilename);
if (!jsontree)
{
@ -325,7 +325,7 @@ int MetadataFile::writeMetadata()
write_json(mFilename.string(), *jsontree);
_exists = true;
std::unique_lock<std::mutex> s(jsonCache.getMutex());
boost::unique_lock<boost::mutex> s(jsonCache.getMutex());
jsonCache.put(mFilename, jsontree);
return 0;
@ -367,7 +367,7 @@ void MetadataFile::removeAllEntries()
void MetadataFile::deletedMeta(const bf::path& p)
{
std::unique_lock<std::mutex> s(jsonCache.getMutex());
boost::unique_lock<boost::mutex> s(jsonCache.getMutex());
jsonCache.erase(p);
}
@ -533,7 +533,7 @@ MetadataFile::MetadataCache::MetadataCache()
{
}
inline std::mutex& MetadataFile::MetadataCache::getMutex()
inline boost::mutex& MetadataFile::MetadataCache::getMutex()
{
return mutex;
}

View File

@ -130,7 +130,7 @@ class MetadataFile
Jsontree_t get(const boost::filesystem::path&);
void put(const boost::filesystem::path&, const Jsontree_t&);
void erase(const boost::filesystem::path&);
std::mutex& getMutex();
boost::mutex& getMutex();
private:
// there's a more efficient way to do this, KISS for now.
@ -139,7 +139,7 @@ class MetadataFile
Lookup_t lookup;
Lru_t lru;
uint max_lru_size;
std::mutex mutex;
boost::mutex mutex;
};
static MetadataCache jsonCache;
};

View File

@ -24,7 +24,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <boost/filesystem.hpp>
#include <thread>
using namespace std;
namespace bf = boost::filesystem;
@ -149,7 +148,7 @@ void Ownership::touchFlushing(const bf::path& prefix, volatile bool* doneFlushin
TOUCH(prefix, "FLUSHING");
try
{
std::this_thread::sleep_for(std::chrono::seconds(1));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
}
catch (boost::thread_interrupted&)
{
@ -160,7 +159,7 @@ void Ownership::touchFlushing(const bf::path& prefix, volatile bool* doneFlushin
void Ownership::releaseOwnership(const bf::path& p, bool isDtor)
{
logger->log(LOG_DEBUG, "Ownership: releasing ownership of %s", p.string().c_str());
std::unique_lock<std::mutex> s(mutex);
boost::unique_lock<boost::mutex> s(mutex);
auto it = ownedPrefixes.find(p);
if (it == ownedPrefixes.end())
@ -218,7 +217,7 @@ void Ownership::takeOwnership(const bf::path& p)
if (!bf::is_directory(metadataPrefix / p))
return;
std::unique_lock<std::mutex> s(mutex);
boost::unique_lock<boost::mutex> s(mutex);
auto it = ownedPrefixes.find(p);
if (it != ownedPrefixes.end())
@ -295,7 +294,7 @@ void Ownership::Monitor::watchForInterlopers()
while (!stop)
{
releaseList.clear();
std::unique_lock<std::mutex> s(owner->mutex);
boost::unique_lock<boost::mutex> s(owner->mutex);
for (auto& prefix : owner->ownedPrefixes)
{
@ -323,7 +322,7 @@ void Ownership::Monitor::watchForInterlopers()
break;
try
{
std::this_thread::sleep_for(std::chrono::seconds(1));
boost::this_thread::sleep_for(boost::chrono::seconds(1));
}
catch (boost::thread_interrupted&)
{

View File

@ -65,7 +65,7 @@ class Ownership : public boost::noncopyable
// for use.
std::map<boost::filesystem::path, bool> ownedPrefixes;
Monitor* monitor;
std::mutex mutex;
boost::mutex mutex;
};
inline bool Ownership::sharedFS()

View File

@ -181,7 +181,7 @@ void PrefixCache::populate()
// be careful using this! SM should be idle. No ongoing reads or writes.
void PrefixCache::validateCacheSize()
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
if (!doNotEvict.empty() || !toBeDeleted.empty())
{
@ -212,7 +212,7 @@ void PrefixCache::read(const vector<string>& keys)
vector<int> dlErrnos;
vector<size_t> dlSizes;
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
M_LRU_t::iterator mit;
for (const string& key : keys)
@ -283,7 +283,7 @@ void PrefixCache::read(const vector<string>& keys)
void PrefixCache::doneReading(const vector<string>& keys)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
for (const string& key : keys)
{
removeFromDNE(key);
@ -345,20 +345,20 @@ const bf::path& PrefixCache::getJournalPath()
void PrefixCache::exists(const vector<string>& keys, vector<bool>* out) const
{
out->resize(keys.size());
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
for (uint i = 0; i < keys.size(); i++)
(*out)[i] = (m_lru.find(keys[i]) != m_lru.end());
}
bool PrefixCache::exists(const string& key) const
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
return m_lru.find(key) != m_lru.end();
}
void PrefixCache::newObject(const string& key, size_t size)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
assert(m_lru.find(key) == m_lru.end());
if (m_lru.find(key) != m_lru.end())
{
@ -375,14 +375,14 @@ void PrefixCache::newObject(const string& key, size_t size)
void PrefixCache::newJournalEntry(size_t size)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
//_makeSpace(size);
currentCacheSize += size;
}
void PrefixCache::deletedJournal(size_t size)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
if (currentCacheSize >= size)
currentCacheSize -= size;
@ -397,7 +397,7 @@ void PrefixCache::deletedJournal(size_t size)
void PrefixCache::deletedObject(const string& key, size_t size)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
M_LRU_t::iterator mit = m_lru.find(key);
assert(mit != m_lru.end());
@ -422,7 +422,7 @@ void PrefixCache::deletedObject(const string& key, size_t size)
void PrefixCache::setMaxCacheSize(size_t size)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
if (size < maxCacheSize)
_makeSpace(maxCacheSize - size);
maxCacheSize = size;
@ -430,7 +430,7 @@ void PrefixCache::setMaxCacheSize(size_t size)
void PrefixCache::makeSpace(size_t size)
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
_makeSpace(size);
}
@ -530,7 +530,7 @@ void PrefixCache::rename(const string& oldKey, const string& newKey, ssize_t siz
// rename it in the LRU
// erase/insert to rehash it everywhere else
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
auto it = m_lru.find(oldKey);
if (it == m_lru.end())
return;
@ -569,7 +569,7 @@ int PrefixCache::ifExistsThenDelete(const string& key)
bf::path cachedPath = cachePrefix / key;
bf::path journalPath = journalPrefix / (key + ".journal");
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
bool objectExists = false;
auto it = m_lru.find(key);
@ -605,14 +605,14 @@ size_t PrefixCache::getCurrentCacheSize() const
size_t PrefixCache::getCurrentCacheElementCount() const
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
assert(m_lru.size() == lru.size());
return m_lru.size();
}
void PrefixCache::reset()
{
std::unique_lock<std::mutex> s(lru_mutex);
boost::unique_lock<boost::mutex> s(lru_mutex);
m_lru.clear();
lru.clear();
toBeDeleted.clear();

View File

@ -32,8 +32,7 @@
#include <unordered_set>
#include <boost/utility.hpp>
#include <boost/filesystem/path.hpp>
#include <map>
#include <mutex>
#include <boost/thread/mutex.hpp>
namespace storagemanager
{
@ -160,7 +159,7 @@ class PrefixCache : public boost::noncopyable
typedef std::set<LRU_t::iterator, TBDLess> TBD_t;
TBD_t toBeDeleted;
mutable std::mutex lru_mutex; // protects the main PrefixCache structures & the do-not-evict set
mutable boost::mutex lru_mutex; // protects the main PrefixCache structures & the do-not-evict set
};
} // namespace storagemanager

View File

@ -16,7 +16,6 @@
MA 02110-1301, USA. */
#include "RWLock.h"
#include <cassert>
namespace storagemanager
{
@ -34,13 +33,13 @@ RWLock::~RWLock()
bool RWLock::inUse()
{
std::unique_lock<std::mutex> s(m);
boost::unique_lock<boost::mutex> s(m);
return readersWaiting || readersRunning || writersWaiting || writersRunning;
}
void RWLock::readLock()
{
std::unique_lock<std::mutex> s(m);
boost::unique_lock<boost::mutex> s(m);
++readersWaiting;
while (writersWaiting != 0 || writersRunning != 0)
@ -50,9 +49,9 @@ void RWLock::readLock()
--readersWaiting;
}
void RWLock::readLock(std::unique_lock<std::mutex>& l)
void RWLock::readLock(boost::unique_lock<boost::mutex>& l)
{
std::unique_lock<std::mutex> s(m);
boost::unique_lock<boost::mutex> s(m);
l.unlock();
++readersWaiting;
@ -65,7 +64,7 @@ void RWLock::readLock(std::unique_lock<std::mutex>& l)
void RWLock::readUnlock()
{
std::unique_lock<std::mutex> s(m);
boost::unique_lock<boost::mutex> s(m);
assert(readersRunning > 0);
--readersRunning;
@ -75,7 +74,7 @@ void RWLock::readUnlock()
void RWLock::writeLock()
{
std::unique_lock<std::mutex> s(m);
boost::unique_lock<boost::mutex> s(m);
++writersWaiting;
while (readersRunning != 0 || writersRunning != 0)
@ -85,9 +84,9 @@ void RWLock::writeLock()
--writersWaiting;
}
void RWLock::writeLock(std::unique_lock<std::mutex>& l)
void RWLock::writeLock(boost::unique_lock<boost::mutex>& l)
{
std::unique_lock<std::mutex> s(m);
boost::unique_lock<boost::mutex> s(m);
l.unlock();
++writersWaiting;
@ -100,7 +99,7 @@ void RWLock::writeLock(std::unique_lock<std::mutex>& l)
void RWLock::writeUnlock()
{
std::unique_lock<std::mutex> s(m);
boost::unique_lock<boost::mutex> s(m);
assert(writersRunning > 0);
--writersRunning;

View File

@ -15,9 +15,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <map>
#include <mutex>
#include <condition_variable>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
/* Quicky impl of a read-write lock that prioritizes writers. */
namespace storagemanager
@ -30,11 +29,11 @@ class RWLock
void readLock();
// this version will release the lock in the parameter after locking this instance
void readLock(std::unique_lock<std::mutex>&);
void readLock(boost::unique_lock<boost::mutex>&);
void readUnlock();
void writeLock();
// this version will release the lock in the parameter after locking this instance
void writeLock(std::unique_lock<std::mutex>&);
void writeLock(boost::unique_lock<boost::mutex>&);
void writeUnlock();
// returns true if anything is blocked on or owns this lock instance.
@ -45,8 +44,8 @@ class RWLock
uint readersRunning;
uint writersWaiting;
uint writersRunning;
std::mutex m;
std::condition_variable okToWrite;
std::condition_variable okToRead;
boost::mutex m;
boost::condition okToWrite;
boost::condition okToRead;
};
} // namespace storagemanager

View File

@ -38,7 +38,7 @@ using namespace std;
namespace
{
storagemanager::Replicator* rep = NULL;
std::mutex m;
boost::mutex m;
} // namespace
namespace storagemanager
{
@ -95,7 +95,7 @@ Replicator* Replicator::get()
{
if (rep)
return rep;
std::unique_lock s(m);
boost::mutex::scoped_lock s(m);
if (rep)
return rep;
rep = new Replicator();

View File

@ -718,7 +718,7 @@ int S3Storage::exists(const string& _key, bool* out)
ms3_st* S3Storage::getConnection()
{
std::unique_lock<std::mutex> s(connMutex);
boost::unique_lock<boost::mutex> s(connMutex);
// prune the list. Most-idle connections are at the back.
timespec now;
@ -810,7 +810,7 @@ void S3Storage::returnConnection(ms3_st* ms3)
conn.conn = ms3;
clock_gettime(CLOCK_MONOTONIC_COARSE, &conn.idleSince);
std::unique_lock<std::mutex> s(connMutex);
boost::unique_lock<boost::mutex> s(connMutex);
freeConns.push_front(conn);
// connMutexes[ms3].unlock();
}

View File

@ -82,9 +82,9 @@ class S3Storage : public CloudStorage
};
// for sanity checking
// std::map<ms3_st *, std::mutex> connMutexes;
// std::map<ms3_st *, boost::mutex> connMutexes;
std::mutex connMutex;
boost::mutex connMutex;
std::deque<Connection> freeConns; // using this as a stack to keep lru objects together
const time_t maxIdleSecs = 30;
};

View File

@ -24,7 +24,7 @@ using namespace std;
namespace
{
storagemanager::SMLogging* smLog = NULL;
std::mutex m;
boost::mutex m;
}; // namespace
namespace storagemanager
@ -46,7 +46,7 @@ SMLogging* SMLogging::get()
{
if (smLog)
return smLog;
std::unique_lock s(m);
boost::mutex::scoped_lock s(m);
if (smLog)
return smLog;
smLog = new SMLogging();

Some files were not shown because too many files have changed in this diff Show More