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

chore(codestyle): mark virtual methods as override

This commit is contained in:
Aleksei Antipovskii
2024-09-12 12:27:02 +02:00
committed by Leonid Fedorov
parent ad80ab40aa
commit 0ab03c7258
303 changed files with 4085 additions and 4886 deletions

View File

@ -66,7 +66,7 @@ class BulkLoad : public FileOp
/**
* @brief BulkLoad destructor
*/
EXPORT ~BulkLoad();
EXPORT ~BulkLoad() override;
/**
* @brief Load job information
@ -523,12 +523,12 @@ inline void BulkLoad::setUsername(const std::string& username)
inline void BulkLoad::startTimer()
{
gettimeofday(&fStartTime, 0);
gettimeofday(&fStartTime, nullptr);
}
inline void BulkLoad::stopTimer()
{
gettimeofday(&fEndTime, 0);
gettimeofday(&fEndTime, nullptr);
fTotalTime = (fEndTime.tv_sec + (fEndTime.tv_usec / 1000000.0)) -
(fStartTime.tv_sec + (fStartTime.tv_usec / 1000000.0));
}

View File

@ -54,19 +54,19 @@ class ColumnBufferCompressed : public ColumnBuffer
/** @brief default Destructor
*/
virtual ~ColumnBufferCompressed();
~ColumnBufferCompressed() override;
/** @brief Final flushing of data and headers prior to closing the file.
* @param bTruncFile is file to be truncated
* @return NO_ERROR or success
*/
virtual int finishFile(bool bTruncFile);
int finishFile(bool bTruncFile) override;
/** @brief Reset the ColBuf to-be-compressed buffer prior to importing the
* next extent.
* @param startFileOffset Byte offset where next extent chunk will start
*/
virtual int resetToBeCompressedColBuf(long long& startFileOffset);
int resetToBeCompressedColBuf(long long& startFileOffset) override;
/** @brief file mutator
*
@ -74,7 +74,7 @@ class ColumnBufferCompressed : public ColumnBuffer
* @param startHwm Starting HWM for cFile
* @param hdrs Headers with ptr information.
*/
virtual int setDbFile(IDBDataFile* const cFile, HWM startHwm, const char* hdrs);
int setDbFile(IDBDataFile* const cFile, HWM startHwm, const char* hdrs) override;
/** @brief Write data to FILE
*
@ -83,7 +83,7 @@ class ColumnBufferCompressed : public ColumnBuffer
* @param fillUpWEmpties The flag to fill the buffer with empty magic
* values up to the block boundary.
*/
virtual int writeToFile(int startOffset, int writeSize, bool fillUpWEmpties = false);
int writeToFile(int startOffset, int writeSize, bool fillUpWEmpties = false) override;
private:
// Disable copy constructor and assignment operator by declaring and

View File

@ -260,9 +260,9 @@ class ColumnBufferManagerDctnry : public ColumnBufferManager
{
public:
ColumnBufferManagerDctnry(ColumnInfo* pColInfo, int colWidth, Log* logger, int compressionType);
virtual ~ColumnBufferManagerDctnry();
~ColumnBufferManagerDctnry() override;
virtual int rowsExtentCheck(int nRows, int& nRows2);
int rowsExtentCheck(int nRows, int& nRows2) override;
using ColumnBufferManager::writeToFileExtentCheck;
virtual int writeToFileExtentCheck(uint32_t startOffset, uint32_t writeSize);
};

View File

@ -136,12 +136,8 @@ struct uint64Hasher
class ColExtInfBase
{
public:
ColExtInfBase()
{
}
virtual ~ColExtInfBase()
{
}
ColExtInfBase() = default;
virtual ~ColExtInfBase() = default;
virtual void addFirstEntry(RID lastInputRow, BRM::LBID_t lbid, bool bIsNewExtent)
{
@ -192,9 +188,7 @@ class ColExtInf : public ColExtInfBase
ColExtInf(OID oid, Log* logger) : fColOid(oid), fLog(logger)
{
}
virtual ~ColExtInf()
{
}
~ColExtInf() override = default;
/** @brief Add an entry for first extent, for the specified Row and LBID.
* @param lastInputRow Last input Row for old extent we are adding data to
@ -202,7 +196,7 @@ class ColExtInf : public ColExtInfBase
* @param bIsNewExtent Treat as new or existing extent when CP min/max is
* sent to BRM
*/
virtual void addFirstEntry(RID lastInputRow, BRM::LBID_t lbid, bool bIsNewExtent);
void addFirstEntry(RID lastInputRow, BRM::LBID_t lbid, bool bIsNewExtent) override;
/** @brief Add or update an entry for the specified Row and its min/max val.
* If new extent, LBID will be added later when extent is allocated.
@ -213,31 +207,31 @@ class ColExtInf : public ColExtInfBase
template <typename T>
void addOrUpdateEntryTemplate(RID lastInputRow, T minVal, T maxVal, ColDataType colDataType, int width);
virtual void addOrUpdateEntry(RID lastInputRow, int64_t minVal, int64_t maxVal, ColDataType colDataType,
int width)
void addOrUpdateEntry(RID lastInputRow, int64_t minVal, int64_t maxVal, ColDataType colDataType,
int width) override
{
addOrUpdateEntryTemplate(lastInputRow, minVal, maxVal, colDataType, width);
}
virtual void addOrUpdateEntry(RID lastInputRow, int128_t minVal, int128_t maxVal, ColDataType colDataType,
int width)
void addOrUpdateEntry(RID lastInputRow, int128_t minVal, int128_t maxVal, ColDataType colDataType,
int width) override
{
addOrUpdateEntryTemplate(lastInputRow, minVal, maxVal, colDataType, width);
}
/** @brief Send updated Casual Partition (CP) info to BRM.
*/
virtual void getCPInfoForBRM(JobColumn column, BRMReporter& brmReporter);
void getCPInfoForBRM(JobColumn column, BRMReporter& brmReporter) override;
/** @brief Debug print function.
*/
virtual void print(const JobColumn& column);
void print(const JobColumn& column) override;
/** @brief Add extent's LBID to the oldest entry that is awaiting an LBID
* @param startLbid Starting LBID for a pending extent.
* @return NO_ERROR upon success; else error if extent entry not found
*/
virtual int updateEntryLbid(BRM::LBID_t startLbid);
int updateEntryLbid(BRM::LBID_t startLbid) override;
private:
OID fColOid; // Column OID for the relevant extents

View File

@ -44,16 +44,15 @@ class ColumnOpBulk : public ColumnOp
public:
ColumnOpBulk();
ColumnOpBulk(Log* logger, int compressionType);
virtual ~ColumnOpBulk();
~ColumnOpBulk() override;
virtual bool abbreviatedExtent(IDBDataFile*, int) const;
virtual int blocksInFile(IDBDataFile*) const;
virtual IDBDataFile* openFile(const WriteEngine::Column& column, uint16_t dbRoot, uint32_t partition,
uint16_t segment, std::string& segFile, bool useTmpSuffix,
const char* mode = "r+b", int ioBuffSize = DEFAULT_BUFSIZ,
bool isReadOnly = false) const;
virtual int readBlock(IDBDataFile*, unsigned char*, const uint64_t);
virtual int saveBlock(IDBDataFile*, const unsigned char*, const uint64_t);
bool abbreviatedExtent(IDBDataFile*, int) const override;
int blocksInFile(IDBDataFile*) const override;
IDBDataFile* openFile(const WriteEngine::Column& column, uint16_t dbRoot, uint32_t partition,
uint16_t segment, std::string& segFile, bool useTmpSuffix, const char* mode = "r+b",
int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const override;
int readBlock(IDBDataFile*, unsigned char*, const uint64_t) override;
int saveBlock(IDBDataFile*, const unsigned char*, const uint64_t) override;
};
} // namespace WriteEngine

View File

@ -97,9 +97,9 @@ class ColumnAutoIncJob : public ColumnAutoInc
{
public:
explicit ColumnAutoIncJob(Log* logger);
virtual ~ColumnAutoIncJob();
~ColumnAutoIncJob() override;
virtual int reserveNextRange(uint32_t autoIncCount, uint64_t& nextValue);
int reserveNextRange(uint32_t autoIncCount, uint64_t& nextValue) override;
};
//------------------------------------------------------------------------------
@ -115,9 +115,9 @@ class ColumnAutoIncIncremental : public ColumnAutoInc
{
public:
explicit ColumnAutoIncIncremental(Log* logger);
virtual ~ColumnAutoIncIncremental();
~ColumnAutoIncIncremental() override;
virtual int reserveNextRange(uint32_t autoIncCount, uint64_t& nextValue);
int reserveNextRange(uint32_t autoIncCount, uint64_t& nextValue) override;
};
} // namespace WriteEngine

View File

@ -184,7 +184,7 @@ class ColumnInfo : public WeUIDGID
/** @brief Destructor
*/
virtual ~ColumnInfo();
~ColumnInfo() override;
/** @brief Returns last input Row num in current "logical" extent; used
* to track min/max value per extent, as the data is parsed. 0-based

View File

@ -50,14 +50,14 @@ class ColumnInfoCompressed : public ColumnInfo
/** @brief Destructor
*/
virtual ~ColumnInfoCompressed();
~ColumnInfoCompressed() override;
/** @brief Close the current Column file.
* @param bCompletedExtent are we completing an extent
* @param bAbort indicates if job is aborting and file should be
* closed without doing extra work: flushing buffer, etc.
*/
virtual int closeColumnFile(bool bCompletingExtent, bool bAbort);
int closeColumnFile(bool bCompletingExtent, bool bAbort) override;
/** @brief Truncate specified dictionary file. Only applies if compressed.
* @param dctnryOid Dictionary store OID
@ -65,21 +65,21 @@ class ColumnInfoCompressed : public ColumnInfo
* @param pNum Partition number of relevant dictionary store segment file.
* @param sNum Segment number of relevant dictionary store segment file.
*/
virtual int truncateDctnryStore(OID dctnryOid, uint16_t root, uint32_t pNum, uint16_t sNum) const;
int truncateDctnryStore(OID dctnryOid, uint16_t root, uint32_t pNum, uint16_t sNum) const override;
private:
virtual int resetFileOffsetsNewExtent(const char* hdr);
int resetFileOffsetsNewExtent(const char* hdr) override;
// Prepare initial compressed column seg file for importing of data.
// oldHWM - Current HWM prior to initial block skipping. This is only
// used for abbreviated extents, to detect when block skipping has
// caused us to require a full expanded extent.
// newHWM - Starting point for adding data after initial blockskipping
virtual int setupInitialColumnFile(HWM oldHWM, HWM newHWM);
int setupInitialColumnFile(HWM oldHWM, HWM newHWM) override;
virtual int saveDctnryStoreHWMChunk(bool& needBackup);
virtual int extendColumnOldExtent(uint16_t dbRootNext, uint32_t partitionNext, uint16_t segmentNext,
HWM hwmNext);
int saveDctnryStoreHWMChunk(bool& needBackup) override;
int extendColumnOldExtent(uint16_t dbRootNext, uint32_t partitionNext, uint16_t segmentNext,
HWM hwmNext) override;
RBMetaWriter* fRBMetaWriter;
FileOp fTruncateDctnryFileOp; // Used to truncate dctnry store file

View File

@ -217,7 +217,7 @@ class TableInfo : public WeUIDGID
/** @brief Default destructor
*/
~TableInfo();
~TableInfo() override;
/** @brief Acquire the DB table lock for this table
*/

View File

@ -38,9 +38,9 @@ class TempXMLGenData : public XMLGenData
public:
TempXMLGenData(const std::string& jobId, const std::string& schema, const std::string& table);
virtual ~TempXMLGenData();
~TempXMLGenData() override;
virtual void print(std::ostream& os) const;
void print(std::ostream& os) const override;
private:
TempXMLGenData(const TempXMLGenData&); // disable default copy ctor

View File

@ -381,7 +381,7 @@ class BRMWrapper : public WEObj
* @brief Commit the transaction
*/
EXPORT int commit(const BRM::VER_t transID);
EXPORT uint8_t newCpimportJob(uint32_t &jobId);
EXPORT uint8_t newCpimportJob(uint32_t& jobId);
EXPORT void finishCpimportJob(uint32_t jobId);
/**
@ -489,10 +489,9 @@ inline BRMWrapper::BRMWrapper()
inline BRMWrapper::~BRMWrapper()
{
if (blockRsltnMgrPtr)
delete blockRsltnMgrPtr;
delete blockRsltnMgrPtr;
blockRsltnMgrPtr = 0;
blockRsltnMgrPtr = nullptr;
}
inline BRM::DBRM* BRMWrapper::getDbrmObject()

View File

@ -53,7 +53,7 @@ class BulkRollbackFileCompressed : public BulkRollbackFile
/** @brief BulkRollbackFile destructor
*/
virtual ~BulkRollbackFileCompressed();
~BulkRollbackFileCompressed() override;
/** @brief Do we reinit trailing blocks in the HWM extent for the specified
* segment file
@ -63,7 +63,7 @@ class BulkRollbackFileCompressed : public BulkRollbackFile
* @param partNum Partition number for the segment file in question
* @param segNum Segment number for the segment file in question
*/
virtual bool doWeReInitExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum) const;
bool doWeReInitExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum) const override;
/** @brief Reinitialize the specified column segment file starting at
* startOffsetBlk, and truncate trailing extents.
@ -78,10 +78,10 @@ class BulkRollbackFileCompressed : public BulkRollbackFile
* @param colWidth Width in bytes of column.
* @param restoreHwmChk Restore HWM chunk
*/
virtual void reInitTruncColumnExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long startOffsetBlk, int nBlocks,
execplan::CalpontSystemCatalog::ColDataType colType, uint32_t colWidth,
bool restoreHwmChk);
void reInitTruncColumnExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long startOffsetBlk, int nBlocks,
execplan::CalpontSystemCatalog::ColDataType colType, uint32_t colWidth,
bool restoreHwmChk) override;
/** @brief Reinitialize the specified dictionary store segment file starting
* at startOffsetBlk, and truncate trailing extents.
@ -93,8 +93,8 @@ class BulkRollbackFileCompressed : public BulkRollbackFile
* reinitialized
* @param nBlocks Number of blocks to be reinitialized
*/
virtual void reInitTruncDctnryExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long startOffsetBlk, int nBlocks);
void reInitTruncDctnryExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long startOffsetBlk, int nBlocks) override;
/** @brief Truncate the specified segment file to a specified num of bytes
* @param columnOID OID of the relevant segment file
@ -103,8 +103,8 @@ class BulkRollbackFileCompressed : public BulkRollbackFile
* @param segNum Segment number of the relevant segment file
* @param fileSizeBlocks Number of blocks to retain in the file
*/
virtual void truncateSegmentFile(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long filesSizeBlocks);
void truncateSegmentFile(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long filesSizeBlocks) override;
private:
// Disable unnecessary copy constructor and assignment operator

View File

@ -51,7 +51,7 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile
/** @brief BulkRollbackFile destructor
*/
virtual ~BulkRollbackFileCompressedHdfs();
~BulkRollbackFileCompressedHdfs() override;
/** @brief Do we reinit trailing blocks in the HWM extent for the specified
* segment file
@ -61,7 +61,7 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile
* @param partNum Partition number for the segment file in question
* @param segNum Segment number for the segment file in question
*/
virtual bool doWeReInitExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum) const;
bool doWeReInitExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum) const override;
/** @brief Reinitialize the specified column segment file starting at
* startOffsetBlk, and truncate trailing extents.
@ -76,10 +76,10 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile
* @param colWidth Width in bytes of column.
* @param restoreHwmChk Restore HWM chunk
*/
virtual void reInitTruncColumnExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long startOffsetBlk, int nBlocks,
execplan::CalpontSystemCatalog::ColDataType colType, uint32_t colWidth,
bool restoreHwmChk);
void reInitTruncColumnExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long startOffsetBlk, int nBlocks,
execplan::CalpontSystemCatalog::ColDataType colType, uint32_t colWidth,
bool restoreHwmChk) override;
/** @brief Reinitialize the specified dictionary store segment file starting
* at startOffsetBlk, and truncate trailing extents.
@ -91,8 +91,8 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile
* reinitialized
* @param nBlocks Number of blocks to be reinitialized
*/
virtual void reInitTruncDctnryExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long startOffsetBlk, int nBlocks);
void reInitTruncDctnryExtent(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long startOffsetBlk, int nBlocks) override;
/** @brief Truncate the specified segment file to a specified num of bytes
* @param columnOID OID of the relevant segment file
@ -101,8 +101,8 @@ class BulkRollbackFileCompressedHdfs : public BulkRollbackFile
* @param segNum Segment number of the relevant segment file
* @param fileSizeBlocks Number of blocks to retain in the file
*/
virtual void truncateSegmentFile(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long filesSizeBlocks);
void truncateSegmentFile(OID columnOID, uint32_t dbRoot, uint32_t partNum, uint32_t segNum,
long long filesSizeBlocks) override;
private:
// Disable unnecessary copy constructor and assignment operator

View File

@ -68,7 +68,7 @@ class BulkRollbackMgr
* Currently used for logging only.
*/
EXPORT BulkRollbackMgr(OID tableOID, uint64_t lockID, const std::string& tableName,
const std::string& applName, Log* logger = 0);
const std::string& applName, Log* logger = nullptr);
/**
* @brief BulkRollbackMgr destructor

View File

@ -27,11 +27,11 @@ using namespace std;
namespace WriteEngine
{
CacheControl* Cache::m_cacheParam = NULL;
FreeBufList* Cache::m_freeList = NULL;
CacheMap* Cache::m_lruList = NULL;
CacheMap* Cache::m_writeList = NULL;
bool Cache::m_useCache = false;
CacheControl* Cache::m_cacheParam = nullptr;
FreeBufList* Cache::m_freeList = nullptr;
CacheMap* Cache::m_lruList = nullptr;
CacheMap* Cache::m_writeList = nullptr;
bool Cache::m_useCache = false;
/***********************************************************
* DESCRIPTION:
* Clear all list and free memory
@ -47,7 +47,7 @@ void Cache::clear()
size_t i;
// free list
if (m_freeList != NULL)
if (m_freeList != nullptr)
{
for (i = 0; i < m_freeList->size(); i++)
{
@ -57,7 +57,7 @@ void Cache::clear()
}
// LRU list
if (m_lruList != NULL)
if (m_lruList != nullptr)
{
for (it = m_lruList->begin(); it != m_lruList->end(); it++)
{
@ -70,7 +70,7 @@ void Cache::clear()
}
// Write list
if (m_writeList != NULL)
if (m_writeList != nullptr)
{
for (it = m_writeList->begin(); it != m_writeList->end(); it++)
{
@ -97,13 +97,13 @@ int Cache::flushCache()
BlockBuffer* curBuf;
// add lock here
if (m_lruList && m_lruList->size() > 0)
if (m_lruList && !m_lruList->empty())
{
bHasReadBlock = true;
for (CacheMapIt it = m_lruList->begin(); it != m_lruList->end(); it++)
for (auto& it : *m_lruList)
{
curBuf = it->second;
curBuf = it.second;
curBuf->clear();
m_freeList->push_back(curBuf);
}
@ -112,19 +112,19 @@ int Cache::flushCache()
}
// must write to disk first
if (m_writeList && m_writeList->size() > 0)
if (m_writeList && !m_writeList->empty())
{
if (!bHasReadBlock)
for (CacheMapIt it = m_writeList->begin(); it != m_writeList->end(); it++)
for (auto& it : *m_writeList)
{
curBuf = it->second;
curBuf = it.second;
curBuf->clear();
m_freeList->push_back(curBuf);
}
else
for (CacheMapIt it = m_writeList->begin(); it != m_writeList->end(); it++)
for (auto& it : *m_writeList)
{
curBuf = it->second;
curBuf = it.second;
(*curBuf).block.dirty = false;
processCacheMap(m_lruList, curBuf, INSERT);
}
@ -152,7 +152,7 @@ void Cache::freeMemory()
size_t i;
// free list
if (m_freeList != NULL)
if (m_freeList != nullptr)
{
for (i = 0; i < m_freeList->size(); i++)
{
@ -163,11 +163,11 @@ void Cache::freeMemory()
m_freeList->clear();
delete m_freeList;
m_freeList = NULL;
m_freeList = nullptr;
}
// LRU list
if (m_lruList != NULL)
if (m_lruList != nullptr)
{
for (it = m_lruList->begin(); it != m_lruList->end(); it++)
{
@ -178,11 +178,11 @@ void Cache::freeMemory()
m_lruList->clear();
delete m_lruList;
m_lruList = NULL;
m_lruList = nullptr;
}
// Write list
if (m_writeList != NULL)
if (m_writeList != nullptr)
{
for (it = m_writeList->begin(); it != m_writeList->end(); it++)
{
@ -193,14 +193,14 @@ void Cache::freeMemory()
m_writeList->clear();
delete m_writeList;
m_writeList = NULL;
m_writeList = nullptr;
}
// param
if (m_cacheParam != NULL)
if (m_cacheParam != nullptr)
{
delete m_cacheParam;
m_cacheParam = NULL;
m_cacheParam = nullptr;
}
}
@ -282,7 +282,7 @@ int Cache::insertLRUList(CommBlock& cb, const uint64_t lbid, const uint64_t fbo,
BlockBuffer* buffer;
vector<BlockBuffer*>::iterator it;
if (m_freeList->size() == 0)
if (m_freeList->empty())
return ERR_FREE_LIST_EMPTY;
// make sure flush first if necessary
@ -397,10 +397,10 @@ void Cache::printCacheList()
cout << "\nFree List has " << m_freeList->size() << " elements" << endl;
cout << "LRU List has " << m_lruList->size() << " elements" << endl;
for (CacheMapIt it = m_lruList->begin(); it != m_lruList->end(); it++)
for (const auto& it : *m_lruList)
{
buffer = it->second;
cout << "\t[" << i++ << "] key=" << it->first << " listType=" << buffer->listType
buffer = it.second;
cout << "\t[" << i++ << "] key=" << it.first << " listType=" << buffer->listType
<< " oid=" << (*buffer).cb.file.oid << " fbo=" << (*buffer).block.fbo
<< " dirty=" << (*buffer).block.dirty << " hitCount=" << (*buffer).block.hitCount << endl;
}
@ -408,10 +408,10 @@ void Cache::printCacheList()
i = 0;
cout << "Write List has " << m_writeList->size() << " elements" << endl;
for (CacheMapIt it = m_writeList->begin(); it != m_writeList->end(); it++)
for (const auto& it : *m_writeList)
{
buffer = it->second;
cout << "\t[" << i++ << "] key=" << it->first << " listType=" << buffer->listType
buffer = it.second;
cout << "\t[" << i++ << "] key=" << it.first << " listType=" << buffer->listType
<< " oid=" << (*buffer).cb.file.oid << " fbo=" << (*buffer).block.fbo
<< " dirty=" << (*buffer).block.dirty << " hitCount=" << (*buffer).block.hitCount << endl;
}

View File

@ -23,11 +23,7 @@
#pragma once
#include <iostream>
#if __GNUC__ == 4 && __GNUC_MINOR__ < 2
#include <ext/hash_map>
#else
#include <tr1/unordered_map>
#endif
#include <unordered_map>
#include <map>
#include <we_obj.h>
@ -65,13 +61,7 @@ struct eqCacheKey
}
};
// typedef hash_map<Signature, TokenStruc, signatureHash<Signature>, eqSig> DCTNRYHASHMAP;
#if __GNUC__ == 4 && __GNUC_MINOR__ < 2
typedef __gnu_cxx::hash_map<CacheKey, BlockBuffer*, hashCacheKey<CacheKey>, eqCacheKey> CacheMap;
#else
typedef std::tr1::unordered_map<CacheKey, BlockBuffer*, hashCacheKey<CacheKey>, eqCacheKey> CacheMap;
#endif
// typedef __gnu_cxx::hash_map<CacheKey, BlockBuffer*> CacheMap;
typedef std::unordered_map<CacheKey, BlockBuffer*, hashCacheKey<CacheKey>, eqCacheKey> CacheMap;
typedef CacheMap::iterator CacheMapIt;
// typedef CacheMap LRUBufList; /** @brief Least Recent Used Buffer list */
@ -84,16 +74,12 @@ class Cache
/**
* @brief Constructor
*/
Cache()
{
}
Cache() = default;
/**
* @brief Default Destructor
*/
~Cache()
{
}
~Cache() = default;
/**
* @brief Check whether cache key exists
@ -215,7 +201,7 @@ class Cache
static CacheMap* m_lruList; // LRU buffer list
static CacheMap* m_writeList; // Write buffer list
EXPORT static bool m_useCache; // Use cache flag
EXPORT static bool m_useCache; // Use cache flag
private:
};

View File

@ -35,7 +35,7 @@
#define EXPORT
//#define IDB_COMP_DEBUG
// #define IDB_COMP_DEBUG
#ifdef IDB_COMP_DEBUG
#define WE_COMP_DBG(x) \
{ \
@ -136,7 +136,7 @@ class CompFileData
, fColDataType(colDataType)
, fColWidth(colWidth)
, fDctnryCol(false)
, fFilePtr(NULL)
, fFilePtr(nullptr)
, fCompressionType(1)
, fReadOnly(readOnly)
{

View File

@ -30,7 +30,7 @@
#include "we_obj.h"
//#define SHARED_NOTHING_DEMO_2
// #define SHARED_NOTHING_DEMO_2
#define EXPORT
@ -44,16 +44,12 @@ class Config
/**
* @brief Constructor
*/
Config()
{
}
Config() = default;
/**
* @brief Default Destructor
*/
~Config()
{
}
~Config() = default;
/**
* @brief Get DB root (for local PM)
@ -187,7 +183,7 @@ class Config
static boost::mutex m_bulkRoot_lk; // mutex for m_bulkRoot sync
#endif
static int m_WaitPeriod; // secs to wait for transaction
static unsigned m_FilesPerColumnPartition; //# seg files per partition
static unsigned m_FilesPerColumnPartition; // # seg files per partition
static unsigned m_ExtentsPerSegmentFile; // # extents per segment file
static int m_BulkProcessPriority; // cpimport.bin proc priority
static std::string m_BulkRollbackDir; // bulk rollback meta data dir

View File

@ -201,7 +201,7 @@ struct Convertor::dmFilePathArgs_t
const std::string Convertor::getTimeStr()
{
char buf[sizeof(DATE_TIME_FORMAT) + 10] = {0};
time_t curTime = time(NULL);
time_t curTime = time(nullptr);
struct tm pTime;
localtime_r(&curTime, &pTime);
string timeStr;
@ -250,7 +250,7 @@ const std::string Convertor::int2Str(int val)
long long Convertor::convertDecimalString(const char* field, int fieldLength, int scale)
{
long double dval = strtold(field, NULL);
long double dval = strtold(field, nullptr);
long long ret = 0;
// move scale digits to the left of the decimal point
@ -634,9 +634,9 @@ void Convertor::convertColType(ColStruct* curStruct)
{
CalpontSystemCatalog::ColDataType dataType // This will be updated later,
= CalpontSystemCatalog::CHAR; // CHAR used only for initialization.
ColType* internalType = NULL;
ColType* internalType = nullptr;
bool bTokenFlag = false;
int* width = NULL;
int* width = nullptr;
dataType = curStruct->colDataType;
internalType = &(curStruct->colType);

View File

@ -46,7 +46,7 @@ class DbFileOp : public FileOp
/**
* @brief Default Destructor
*/
EXPORT virtual ~DbFileOp();
EXPORT ~DbFileOp() override;
EXPORT virtual int flushCache();

View File

@ -36,12 +36,10 @@ class WESDHandler; // forward deceleration
class WEBrmUpdater
{
public:
WEBrmUpdater(WESDHandler& Ref) : fRef(Ref), fpBrm(0)
{
}
virtual ~WEBrmUpdater()
WEBrmUpdater(WESDHandler& Ref) : fRef(Ref), fpBrm(nullptr)
{
}
virtual ~WEBrmUpdater() = default;
public:
bool updateCasualPartitionAndHighWaterMarkInBRM();
@ -59,7 +57,7 @@ class WEBrmUpdater
void releaseBrmConnection()
{
delete fpBrm;
fpBrm = 0;
fpBrm = nullptr;
}
public:

View File

@ -34,9 +34,7 @@ class WECmdArgs
{
public:
WECmdArgs(int argc, char** argv);
virtual ~WECmdArgs()
{
}
virtual ~WECmdArgs() = default;
typedef std::vector<unsigned int> VecInts;
typedef std::vector<std::string> VecArgs;

View File

@ -21,7 +21,7 @@
#pragma once
#include <stdlib.h>
#include <cstdlib>
#include "we_dbfileop.h"
#include "brmtypes.h"
@ -54,7 +54,7 @@ class ColumnOp : public DbFileOp
/**
* @brief Default Destructor
*/
EXPORT virtual ~ColumnOp();
EXPORT ~ColumnOp() override;
EXPORT virtual int allocRowId(const TxnID& txnid, bool useStartingExtent, Column& column, uint64_t totalRow,
RID* rowIdArray, HWM& hwm, bool& newExtent, uint64_t& rowsLeft, HWM& newHwm,
@ -145,7 +145,7 @@ class ColumnOp : public DbFileOp
*/
EXPORT int extendColumn(const Column& column, bool leaveFileOpen, HWM hwm, BRM::LBID_t startLbid,
int allocSize, uint16_t dbRoot, uint32_t partition, uint16_t segment,
std::string& segFile, IDBDataFile*& pFile, bool& newFile, char* hdrs = NULL);
std::string& segFile, IDBDataFile*& pFile, bool& newFile, char* hdrs = nullptr);
/**
* @brief Add an extent to the OID specified in the column argument.
@ -165,7 +165,7 @@ class ColumnOp : public DbFileOp
*/
EXPORT int addExtent(const Column& column, uint16_t dbRoot, uint32_t partition, uint16_t segment,
std::string& segFile, BRM::LBID_t& startLbid, bool& newFile, int& allocSize,
char* hdrs = NULL);
char* hdrs = nullptr);
/**
* @brief Get columne data type
@ -216,13 +216,13 @@ class ColumnOp : public DbFileOp
* @brief Write row(s)
*/
EXPORT virtual int writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray, const void* valArray,
void* oldValArray = 0, bool bDelete = false);
void* oldValArray = nullptr, bool bDelete = false);
/**
* @brief Write row(s) for delete @Bug 1886,2870
*/
EXPORT virtual int writeRows(Column& curCol, uint64_t totalRow, const RIDList& ridList,
const void* valArray, void* oldValArray = 0, bool bDelete = false);
const void* valArray, void* oldValArray = nullptr, bool bDelete = false);
/**
* @brief MCOL-5021 Read-only version of the writeRows() function above.
@ -232,13 +232,13 @@ class ColumnOp : public DbFileOp
database files.
*/
EXPORT virtual int writeRowsReadOnly(Column& curCol, uint64_t totalRow, const RIDList& ridList,
void* oldValArray = 0);
void* oldValArray = nullptr);
/**
* @brief Write row(s) for update @Bug 1886,2870
*/
EXPORT virtual int writeRowsValues(Column& curCol, uint64_t totalRow, const RIDList& ridList,
const void* valArray, void* oldValArray = 0);
const void* valArray, void* oldValArray = nullptr);
/**
* @brief Test if the pFile is an abbreviated extent.

View File

@ -21,7 +21,7 @@
#pragma once
#include <stdlib.h>
#include <cstdlib>
#include "we_colop.h"
#include "we_chunkmanager.h"
@ -45,35 +45,35 @@ class ColumnOpCompress0 : public ColumnOp
/**
* @brief Default Destructor
*/
EXPORT virtual ~ColumnOpCompress0();
EXPORT ~ColumnOpCompress0() override;
/**
* @brief virtual method in ColumnOp
*/
IDBDataFile* openFile(const Column& column, uint16_t dbRoot, uint32_t partition, uint16_t segment,
std::string& segFile, bool useTmpSuffix, const char* mode = "r+b",
int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const;
int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const override;
/**
* @brief virtual method in ColumnOp
*/
bool abbreviatedExtent(IDBDataFile* pFile, int colWidth) const;
bool abbreviatedExtent(IDBDataFile* pFile, int colWidth) const override;
/**
* @brief virtual method in ColumnOp
*/
int blocksInFile(IDBDataFile* pFile) const;
int blocksInFile(IDBDataFile* pFile) const override;
protected:
/**
* @brief virtual method in ColumnOp
*/
int readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo);
int readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo) override;
/**
* @brief virtual method in ColumnOp
*/
int saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo);
int saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo) override;
private:
};
@ -85,47 +85,47 @@ class ColumnOpCompress1 : public ColumnOp
/**
* @brief Constructor
*/
EXPORT ColumnOpCompress1(uint32_t compressionType, Log* logger = 0);
EXPORT ColumnOpCompress1(uint32_t compressionType, Log* logger = nullptr);
/**
* @brief Default Destructor
*/
EXPORT virtual ~ColumnOpCompress1();
EXPORT ~ColumnOpCompress1() override;
/**
* @brief virtual method in FileOp
*/
EXPORT int flushFile(int rc, std::map<FID, FID>& columnOids);
EXPORT int flushFile(int rc, std::map<FID, FID>& columnOids) override;
/**
* @brief virtual method in FileOp
*/
int expandAbbrevColumnExtent(IDBDataFile* pFile, uint16_t dbRoot, const uint8_t* emptyVal, int width,
execplan::CalpontSystemCatalog::ColDataType colDataType);
execplan::CalpontSystemCatalog::ColDataType colDataType) override;
/**
* @brief virtual method in ColumnOp
*/
IDBDataFile* openFile(const Column& column, uint16_t dbRoot, uint32_t partition, uint16_t segment,
std::string& segFile, bool useTmpSuffix, const char* mode = "r+b",
int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const;
int ioBuffSize = DEFAULT_BUFSIZ, bool isReadOnly = false) const override;
/**
* @brief virtual method in ColumnOp
*/
bool abbreviatedExtent(IDBDataFile* pFile, int colWidth) const;
bool abbreviatedExtent(IDBDataFile* pFile, int colWidth) const override;
/**
* @brief virtual method in ColumnOp
*/
int blocksInFile(IDBDataFile* pFile) const;
int blocksInFile(IDBDataFile* pFile) const override;
// void chunkManager(ChunkManager* cm);
/**
* @brief virtual method in FileOp
*/
void setTransId(const TxnID& transId)
void setTransId(const TxnID& transId) override
{
ColumnOp::setTransId(transId);
@ -133,12 +133,12 @@ class ColumnOpCompress1 : public ColumnOp
m_chunkManager->setTransId(transId);
}
void setBulkFlag(bool isBulkLoad)
void setBulkFlag(bool isBulkLoad) override
{
m_chunkManager->setBulkFlag(isBulkLoad);
};
void setFixFlag(bool isFix)
void setFixFlag(bool isFix) override
{
m_chunkManager->setFixFlag(isFix);
};
@ -147,22 +147,22 @@ class ColumnOpCompress1 : public ColumnOp
/**
* @brief virtual method in FileOp
*/
int updateColumnExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid);
int updateColumnExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid) override;
/**
* @brief virtual method in ColumnOp
*/
void closeColumnFile(Column& column) const;
void closeColumnFile(Column& column) const override;
/**
* @brief virtual method in ColumnOp
*/
int readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo);
int readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo) override;
/**
* @brief virtual method in ColumnOp
*/
int saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo);
int saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo) override;
/**
* @brief Set the IsInsert flag in the ChunkManager.

View File

@ -21,7 +21,7 @@
#pragma once
#include <stdlib.h>
#include <cstdlib>
#include "../dictionary/we_dctnry.h"
#include "we_chunkmanager.h"
@ -43,7 +43,7 @@ class DctnryCompress0 : public Dctnry
/**
* @brief Default Destructor
*/
EXPORT virtual ~DctnryCompress0();
EXPORT ~DctnryCompress0() override;
};
/** Class DctnryCompress1 */
@ -53,55 +53,56 @@ class DctnryCompress1 : public Dctnry
/**
* @brief Constructor
*/
EXPORT DctnryCompress1(uint32_t compressionType, Log* logger = 0);
EXPORT DctnryCompress1(uint32_t compressionType, Log* logger = nullptr);
/**
* @brief Default Destructor
*/
EXPORT virtual ~DctnryCompress1();
EXPORT ~DctnryCompress1() override;
/**
* @brief virtual method in FileOp
*/
EXPORT int flushFile(int rc, std::map<FID, FID>& columnOids);
EXPORT int flushFile(int rc, std::map<FID, FID>& columnOids) override;
/**
* @brief virtual method in DBFileOp
*/
EXPORT int readDBFile(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t lbid,
const bool isFbo = false);
const bool isFbo = false) override;
/**
* @brief virtual method in DBFileOp
*/
EXPORT int writeDBFile(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t lbid,
const int numOfBlock = 1);
const int numOfBlock = 1) override;
/**
* @brief virtual method in DBFileOp
*/
EXPORT int writeDBFileNoVBCache(IDBDataFile* pFile, const unsigned char* writeBuf, const int fbo,
const int numOfBlock = 1);
const int numOfBlock = 1) override;
/**
* @brief virtual method in Dctnry
*/
IDBDataFile* createDctnryFile(const char* name, int width, const char* mode, int ioBuffSize, int64_t lbid);
IDBDataFile* createDctnryFile(const char* name, int width, const char* mode, int ioBuffSize,
int64_t lbid) override;
/**
* @brief virtual method in Dctnry
*/
IDBDataFile* openDctnryFile(bool useTmpSuffix);
IDBDataFile* openDctnryFile(bool useTmpSuffix) override;
/**
* @brief virtual method in Dctnry
*/
void closeDctnryFile(bool doFlush, std::map<FID, FID>& columnOids);
void closeDctnryFile(bool doFlush, std::map<FID, FID>& columnOids) override;
/**
* @brief virtual method in Dctnry
*/
int numOfBlocksInFile();
int numOfBlocksInFile() override;
/**
* @brief For bulkload to use
@ -110,15 +111,15 @@ class DctnryCompress1 : public Dctnry
{
m_chunkManager->setMaxActiveChunkNum(maxActiveChunkNum);
};
void setBulkFlag(bool isBulkLoad)
void setBulkFlag(bool isBulkLoad) override
{
m_chunkManager->setBulkFlag(isBulkLoad);
};
void setFixFlag(bool isFix)
void setFixFlag(bool isFix) override
{
m_chunkManager->setFixFlag(isFix);
};
int checkFixLastDictChunk()
int checkFixLastDictChunk() override
{
return m_chunkManager->checkFixLastDictChunk(m_dctnryOID, m_dbRoot, m_partition, m_segment);
};
@ -127,7 +128,7 @@ class DctnryCompress1 : public Dctnry
/**
* @brief virtual method in FileOp
*/
void setTransId(const TxnID& transId)
void setTransId(const TxnID& transId) override
{
Dctnry::setTransId(transId);
@ -148,7 +149,7 @@ class DctnryCompress1 : public Dctnry
/**
* @brief virtual method in FileOp
*/
int updateDctnryExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid);
int updateDctnryExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid) override;
/**
* @brief convert lbid to fbo

View File

@ -21,7 +21,7 @@
#pragma once
#include <stdint.h>
#include <cstdint>
#include "we_type.h"
#include "brmtypes.h"
#include <map>
@ -82,7 +82,7 @@ class TableMetaData
private:
/** Constuctors */
explicit TableMetaData();
explicit TableMetaData(const TableMetaData& rhs);
TableMetaData(const TableMetaData& rhs);
~TableMetaData();
static boost::mutex map_mutex;
static TableMetaDataMap fTableMetaDataMap;
@ -93,4 +93,3 @@ class TableMetaData
} // namespace WriteEngine
#undef EXPORT

View File

@ -20,7 +20,7 @@
/** @file */
#pragma once
#include <stdio.h>
#include <cstdio>
#include <string>
// the header file for fd
@ -66,10 +66,8 @@ struct TxnLBIDRec
std::vector<BRM::LBID_t> m_LBIDs;
std::vector<execplan::CalpontSystemCatalog::ColDataType> m_ColDataTypes;
TxnLBIDRec(){};
~TxnLBIDRec()
{
}
TxnLBIDRec() = default;
~TxnLBIDRec() = default;
void AddLBID(BRM::LBID_t lbid, const execplan::CalpontSystemCatalog::ColDataType& colDataType)
{
if (m_LBIDSet.insert(lbid).second)
@ -92,7 +90,7 @@ struct ColSplitMaxMinInfo
ColSplitMaxMinInfo(execplan::CalpontSystemCatalog::ColDataType colDataType, int colWidth)
: fSplitMaxMinInfo{ExtCPInfo(colDataType, colWidth), ExtCPInfo(colDataType, colWidth)}
{
fSplitMaxMinInfoPtrs[0] = fSplitMaxMinInfoPtrs[1] = NULL; // disable by default.
fSplitMaxMinInfoPtrs[0] = fSplitMaxMinInfoPtrs[1] = nullptr; // disable by default.
}
};
@ -246,8 +244,7 @@ class WriteEngineWrapper : public WEObj
*/
EXPORT int deleteRow(const TxnID& txnid, const std::vector<CSCTypesList>& colExtentsColType,
std::vector<ColStructList>& colExtentsStruct, std::vector<void*>& colOldValueList,
std::vector<RIDList>& ridLists, const int32_t tableOid,
bool hasAUXCol = false);
std::vector<RIDList>& ridLists, const int32_t tableOid, bool hasAUXCol = false);
/**
* @brief Delete a list of rows from a table
@ -702,7 +699,7 @@ class WriteEngineWrapper : public WEObj
int writeColumnRec(const TxnID& txnid, const CSCTypesList& cscColTypes, const ColStructList& colStructList,
ColValueList& colValueList, RID* rowIdArray, const ColStructList& newColStructList,
ColValueList& newColValueList, const int32_t tableOid, bool useTmpSuffix,
bool versioning = true, ColSplitMaxMinInfoList* maxMins = NULL);
bool versioning = true, ColSplitMaxMinInfoList* maxMins = nullptr);
int writeColumnRecBinary(const TxnID& txnid, const ColStructList& colStructList,
std::vector<uint64_t>& colValueList, RID* rowIdArray,
@ -714,14 +711,14 @@ class WriteEngineWrapper : public WEObj
const ColStructList& colStructList, const ColValueList& colValueList,
std::vector<void*>& colOldValueList, const RIDList& ridList,
const int32_t tableOid, bool convertStructFlag = true,
ColTupleList::size_type nRows = 0, std::vector<ExtCPInfo*>* cpInfos = NULL,
ColTupleList::size_type nRows = 0, std::vector<ExtCPInfo*>* cpInfos = nullptr,
bool hasAUXCol = false);
// For update column from column to use
int writeColumnRecords(const TxnID& txnid, const CSCTypesList& cscColTypeList,
std::vector<ColStruct>& colStructList, ColValueList& colValueList,
const RIDList& ridLists, const int32_t tableOid, bool versioning = true,
std::vector<ExtCPInfo*>* cpInfos = NULL);
std::vector<ExtCPInfo*>* cpInfos = nullptr);
/**
* @brief util method to convert rowid to a column file
@ -738,7 +735,7 @@ class WriteEngineWrapper : public WEObj
// txn so that we don't waste time marking the same extent as invalid. This
// list should be trimmed if it gets too big.
int AddLBIDtoList(const TxnID txnid, const ColStruct& colStruct, const int fbo,
ExtCPInfo* cpInfo = NULL // provide CPInfo pointer if you want max/min updated.
ExtCPInfo* cpInfo = nullptr // provide CPInfo pointer if you want max/min updated.
);
// Get CPInfo for given starting LBID and column description structure.

View File

@ -48,13 +48,13 @@ class XMLGenData
// Valid parms that can be stored and retrieved from XMLGenData
EXPORT const static std::string DELIMITER;
EXPORT const static std::string DESCRIPTION;
EXPORT const static std::string ENCLOSED_BY_CHAR;
EXPORT const static std::string ESCAPE_CHAR;
EXPORT const static std::string JOBID;
EXPORT const static std::string ENCLOSED_BY_CHAR;
EXPORT const static std::string ESCAPE_CHAR;
EXPORT const static std::string JOBID;
EXPORT const static std::string MAXERROR;
EXPORT const static std::string NAME;
EXPORT const static std::string PATH;
EXPORT const static std::string RPT_DEBUG;
EXPORT const static std::string RPT_DEBUG;
EXPORT const static std::string USER;
EXPORT const static std::string NO_OF_READ_BUFFER;
EXPORT const static std::string READ_BUFFER_CAPACITY;

View File

@ -25,7 +25,7 @@
#include <iostream>
#include <string>
#include <time.h>
#include <ctime>
#include <boost/filesystem/path.hpp>
#include "we_xmlop.h"
@ -54,7 +54,7 @@ class XMLJob : public XMLOp
/**
* @brief Default Destructor
*/
EXPORT ~XMLJob();
EXPORT ~XMLJob() override;
/**
* @brief Utility to generate a full path name for a Job XML file name
@ -115,7 +115,7 @@ class XMLJob : public XMLOp
* @brief Process node
* @param pParentNode Node to be parsed from XML
*/
EXPORT bool processNode(xmlNode* pParentNode);
EXPORT bool processNode(xmlNode* pParentNode) override;
/**
* @brief Set timezone