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

Remove windows ifdefs

This commit is contained in:
Leonid Fedorov
2023-03-02 15:59:42 +00:00
parent 123c345b40
commit 56f2346083
328 changed files with 9 additions and 19602 deletions

View File

@ -46,11 +46,7 @@ BlockRequestProcessor::BlockRequestProcessor(uint32_t numBlcks, int thrCount, in
config::Config* fConfig = config::Config::makeConfig();
string val = fConfig->getConfig("DBBC", "BRPTracing");
int temp = 0;
#ifdef _MSC_VER
int tid = GetCurrentThreadId();
#else
pthread_t tid = pthread_self();
#endif
if (val.length() > 0)
temp = static_cast<int>(config::Config::fromText(val));
@ -63,11 +59,7 @@ BlockRequestProcessor::BlockRequestProcessor(uint32_t numBlcks, int thrCount, in
if (fTrace)
{
ostringstream brpLogFileName;
#ifdef _MSC_VER
brpLogFileName << "C:/Calpont/log/trace/brp." << tid;
#else
brpLogFileName << MCSLOGDIR << "/trace/brp." << tid;
#endif
fLogFile.open(brpLogFileName.str().c_str(), ios_base::app | ios_base::ate);
}
}

View File

@ -34,9 +34,7 @@
#include <limits>
#include <boost/thread.hpp>
#ifndef _MSC_VER
#include <pthread.h>
#endif
#include "stats.h"
#include "configcpp.h"
@ -71,11 +69,7 @@ FileBufferMgr::FileBufferMgr(const uint32_t numBlcks, const uint32_t blkSz, cons
fFBPool.reserve(numBlcks);
fConfig = Config::makeConfig();
setReportingFrequency(0);
#ifdef _MSC_VER
fLog.open("C:/Calpont/log/trace/bc", ios_base::app | ios_base::ate);
#else
fLog.open(string(MCSLOGDIR) + "/trace/bc", ios_base::app | ios_base::ate);
#endif
}
FileBufferMgr::~FileBufferMgr()
@ -433,21 +427,11 @@ bool FileBufferMgr::find(const HashObject_t& keyFb, void* bufferPtr)
bool ret = false;
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(keyFb.lbid, GetCurrentThreadId(), gSession, 'L');
#else
gPMStatsPtr->markEvent(keyFb.lbid, pthread_self(), gSession, 'L');
#endif
boost::mutex::scoped_lock lk(fWLock);
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(keyFb.lbid, GetCurrentThreadId(), gSession, 'M');
#else
gPMStatsPtr->markEvent(keyFb.lbid, pthread_self(), gSession, 'M');
#endif
filebuffer_uset_iter_t it = fbSet.find(keyFb);
if (fbSet.end() != it)
@ -461,12 +445,7 @@ bool FileBufferMgr::find(const HashObject_t& keyFb, void* bufferPtr)
memcpy(bufferPtr, (fFBPool[idx]).getData(), 8192);
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(keyFb.lbid, GetCurrentThreadId(), gSession, 'U');
#else
gPMStatsPtr->markEvent(keyFb.lbid, pthread_self(), gSession, 'U');
#endif
ret = true;
}
@ -484,11 +463,7 @@ uint32_t FileBufferMgr::bulkFind(const BRM::LBID_t* lbids, const BRM::VER_t* ver
{
for (i = 0; i < count; i++)
{
#ifdef _MSC_VER
gPMStatsPtr->markEvent(lbids[i], GetCurrentThreadId(), gSession, 'L');
#else
gPMStatsPtr->markEvent(lbids[i], pthread_self(), gSession, 'L');
#endif
}
}
@ -498,11 +473,7 @@ uint32_t FileBufferMgr::bulkFind(const BRM::LBID_t* lbids, const BRM::VER_t* ver
{
for (i = 0; i < count; i++)
{
#ifdef _MSC_VER
gPMStatsPtr->markEvent(lbids[i], GetCurrentThreadId(), gSession, 'M');
#else
gPMStatsPtr->markEvent(lbids[i], pthread_self(), gSession, 'M');
#endif
}
}
@ -536,11 +507,7 @@ uint32_t FileBufferMgr::bulkFind(const BRM::LBID_t* lbids, const BRM::VER_t* ver
if (gPMProfOn && gPMStatsPtr)
{
#ifdef _MSC_VER
gPMStatsPtr->markEvent(lbids[i], GetCurrentThreadId(), gSession, 'U');
#else
gPMStatsPtr->markEvent(lbids[i], pthread_self(), gSession, 'U');
#endif
}
}
@ -578,12 +545,7 @@ int FileBufferMgr::insert(const BRM::LBID_t lbid, const BRM::VER_t ver, const ui
int ret = 0;
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(lbid, GetCurrentThreadId(), gSession, 'I');
#else
gPMStatsPtr->markEvent(lbid, pthread_self(), gSession, 'I');
#endif
boost::mutex::scoped_lock lk(fWLock);
@ -612,12 +574,7 @@ int FileBufferMgr::insert(const BRM::LBID_t lbid, const BRM::VER_t ver, const ui
{
// if it's a duplicate there's nothing to do
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(lbid, GetCurrentThreadId(), gSession, 'D');
#else
gPMStatsPtr->markEvent(lbid, pthread_self(), gSession, 'D');
#endif
return ret;
}
@ -683,12 +640,7 @@ int FileBufferMgr::insert(const BRM::LBID_t lbid, const BRM::VER_t ver, const ui
fFBPool[pi].listLoc(fbList.begin());
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(lbid, GetCurrentThreadId(), gSession, 'J');
#else
gPMStatsPtr->markEvent(lbid, pthread_self(), gSession, 'J');
#endif
idbassert(fCacheSize <= maxCacheSize());
// idbassert(fCacheSize == fbSet.size());
@ -800,12 +752,7 @@ int FileBufferMgr::bulkInsert(const vector<CacheInsert_t>& ops)
const CacheInsert_t& op = ops[i];
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(op.lbid, GetCurrentThreadId(), gSession, 'I');
#else
gPMStatsPtr->markEvent(op.lbid, pthread_self(), gSession, 'I');
#endif
HashObject_t fbIndex(op.lbid, op.ver, 0);
filebuffer_pair_t pr = fbSet.insert(fbIndex);
@ -813,12 +760,7 @@ int FileBufferMgr::bulkInsert(const vector<CacheInsert_t>& ops)
if (!pr.second)
{
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(op.lbid, GetCurrentThreadId(), gSession, 'D');
#else
gPMStatsPtr->markEvent(op.lbid, pthread_self(), gSession, 'D');
#endif
continue;
}
@ -837,12 +779,7 @@ int FileBufferMgr::bulkInsert(const vector<CacheInsert_t>& ops)
fFBPool[pi].listLoc(fbList.begin());
if (gPMProfOn && gPMStatsPtr)
#ifdef _MSC_VER
gPMStatsPtr->markEvent(op.lbid, GetCurrentThreadId(), gSession, 'J');
#else
gPMStatsPtr->markEvent(op.lbid, pthread_self(), gSession, 'J');
#endif
ret++;
}
if (fReportFrequency)

View File

@ -26,11 +26,7 @@
#include <iostream>
#include <fstream>
#include <iomanip>
#ifndef _MSC_VER
#include <tr1/unordered_set>
#else
#include <unordered_set>
#endif
#include <boost/thread.hpp>
#include <deque>

View File

@ -48,7 +48,6 @@ const string resolveInDir(const string& dir, const string& name)
return ret;
idbassert(fs::exists(path));
#ifndef _MSC_VER
if (!fs::is_symlink(path))
return ret;
@ -65,7 +64,6 @@ const string resolveInDir(const string& dir, const string& name)
fs::path realpath("/dev");
realpath /= linkname.filename();
ret = realpath.string();
#endif
return ret;
}
@ -86,7 +84,6 @@ namespace fsutils
const string symname2devname(const string& sympath)
{
string ret;
#ifndef _MSC_VER
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep("=");
tokenizer tokens(sympath, sep);
@ -112,7 +109,6 @@ const string symname2devname(const string& sympath)
else if (symtype == "UUID")
ret = uuid2dev(symname);
#endif
return ret;
}

View File

@ -32,10 +32,8 @@
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE64_SOURCE
#ifdef __linux__
#include <sys/mount.h>
#include <linux/fs.h>
#endif
#ifdef BLOCK_SIZE
#undef BLOCK_SIZE
#endif
@ -50,13 +48,8 @@
#include <stdlib.h>
#include <string>
#include <sstream>
#ifdef _MSC_VER
#include <unordered_map>
#include <unordered_set>
#else
#include <tr1/unordered_map>
#include <tr1/unordered_set>
#endif
#include <set>
#include <sys/types.h>
#include <sys/stat.h>
@ -67,11 +60,7 @@
#include <boost/scoped_array.hpp>
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#ifdef _MSC_VER
typedef int pthread_t;
#else
#include <pthread.h>
#endif
//#define NDEBUG
#include <cassert>
@ -431,13 +420,8 @@ void* thr_popper(ioManager* arg)
if (iom->IOTrace())
{
#ifdef _MSC_VER
threadId = GetCurrentThreadId();
iomLogFileName << "C:/Calpont/log/trace/iom." << threadId;
#else
threadId = pthread_self();
iomLogFileName << MCSLOGDIR << "/trace/iom." << threadId;
#endif
lFile.open(iomLogFileName.str().c_str(), ios_base::app | ios_base::ate);
}
@ -1005,11 +989,7 @@ void* thr_popper(ioManager* arg)
if (blocksThisRead > 0 && fdit->second->isCompressed())
{
#ifdef _MSC_VER
unsigned int blen = 4 * 1024 * 1024 + 4;
#else
size_t blen = 4 * 1024 * 1024 + 4;
#endif
#ifdef IDB_COMP_POC_DEBUG
{
boost::mutex::scoped_lock lk(primitiveprocessor::compDebugMutex);
@ -1308,11 +1288,7 @@ ioManager::ioManager(FileBufferMgr& fbm, fileBlockRequestQueue& fbrq, int thrCou
if (temp > 0)
{
fFDCacheTrace = true;
#ifdef _MSC_VER
FDTraceFile().open("C:/Calpont/log/trace/fdcache", ios_base::ate | ios_base::app);
#else
FDTraceFile().open(string(MCSLOGDIR) + "/trace/fdcache", ios_base::ate | ios_base::app);
#endif
}
fThreadCount = thrCount;

View File

@ -22,11 +22,7 @@
#include <ctime>
#include <sys/time.h>
#ifndef _MSC_VER
#include <pthread.h>
#else
typedef int pthread_t;
#endif
#include <iomanip>
#include <map>
// #define NDEBUG
@ -58,9 +54,6 @@ void pause_(unsigned delay)
rem.tv_sec = 0;
rem.tv_nsec = 0;
#ifdef _MSC_VER
Sleep(req.tv_sec * 1000);
#else
again:
if (nanosleep(&req, &rem) != 0)
@ -70,7 +63,6 @@ again:
goto again;
}
#endif
}
const string timestr()
@ -104,11 +96,7 @@ class TraceFile
outName = name;
ostringstream oss;
#ifdef _MSC_VER
oss << "C:/Calpont/log/trace/" << outName << '.' << sessionID;
#else
oss << MCSLOGDIR << "/trace/" << outName << '.' << sessionID;
#endif
oFile.reset(new ofstream());
oFile->open(oss.str().c_str(), ios_base::out | ios_base::ate | ios_base::app);
}
@ -185,14 +173,12 @@ class StatMon
public:
StatMon()
{
#ifndef _MSC_VER
sigset_t sigset;
sigemptyset(&sigset);
sigaddset(&sigset, SIGPIPE);
sigaddset(&sigset, SIGUSR1);
sigaddset(&sigset, SIGUSR2);
pthread_sigmask(SIG_BLOCK, &sigset, 0);
#endif
}
void operator()() const
{

View File

@ -23,12 +23,7 @@
#pragma once
#ifndef _MSC_VER
#include <pthread.h>
#else
// FIXME: find a portable solution
typedef int pthread_t;
#endif
#include <boost/thread.hpp>
#include <iostream>
#include <sstream>