1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +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 6001db44ab
commit 5556d818f8
303 changed files with 4091 additions and 4894 deletions

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();