1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

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

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

View File

@ -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;
};