You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
clang format apply
This commit is contained in:
@ -17,7 +17,6 @@
|
||||
|
||||
// $Id: we_colopcompress.cpp 4726 2013-08-07 03:38:36Z bwilkinson $
|
||||
|
||||
|
||||
/** @file */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -32,7 +31,6 @@
|
||||
|
||||
namespace WriteEngine
|
||||
{
|
||||
|
||||
class ChunkManager;
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
@ -44,74 +42,69 @@ class ChunkManager;
|
||||
*/
|
||||
ColumnOpCompress0::ColumnOpCompress0()
|
||||
{
|
||||
m_compressionType = 0;
|
||||
m_compressionType = 0;
|
||||
}
|
||||
|
||||
|
||||
ColumnOpCompress0::ColumnOpCompress0(Log* logger)
|
||||
{
|
||||
m_compressionType = 0;
|
||||
setDebugLevel( logger->getDebugLevel() );
|
||||
setLogger ( logger );
|
||||
m_compressionType = 0;
|
||||
setDebugLevel(logger->getDebugLevel());
|
||||
setLogger(logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
ColumnOpCompress0::~ColumnOpCompress0()
|
||||
{}
|
||||
|
||||
|
||||
// @bug 5572 - HDFS usage: add *.tmp file backup flag
|
||||
IDBDataFile* ColumnOpCompress0::openFile(
|
||||
const Column& column, const uint16_t dbRoot, const uint32_t partition, const uint16_t segment,
|
||||
std::string& segFile, bool useTmpSuffix, const char* mode, const int ioBuffSize) const
|
||||
{
|
||||
return FileOp::openFile(column.dataFile.fid, dbRoot, partition, segment, segFile,
|
||||
mode, column.colWidth, useTmpSuffix);
|
||||
}
|
||||
|
||||
// @bug 5572 - HDFS usage: add *.tmp file backup flag
|
||||
IDBDataFile* ColumnOpCompress0::openFile(const Column& column, const uint16_t dbRoot,
|
||||
const uint32_t partition, const uint16_t segment,
|
||||
std::string& segFile, bool useTmpSuffix, const char* mode,
|
||||
const int ioBuffSize) const
|
||||
{
|
||||
return FileOp::openFile(column.dataFile.fid, dbRoot, partition, segment, segFile, mode, column.colWidth,
|
||||
useTmpSuffix);
|
||||
}
|
||||
|
||||
bool ColumnOpCompress0::abbreviatedExtent(IDBDataFile* pFile, int colWidth) const
|
||||
{
|
||||
long long fsize;
|
||||
long long fsize;
|
||||
|
||||
if (getFileSize(pFile, fsize) == NO_ERROR)
|
||||
{
|
||||
return (fsize == INITIAL_EXTENT_ROWS_TO_DISK * colWidth);
|
||||
}
|
||||
if (getFileSize(pFile, fsize) == NO_ERROR)
|
||||
{
|
||||
return (fsize == INITIAL_EXTENT_ROWS_TO_DISK * colWidth);
|
||||
}
|
||||
|
||||
// TODO: Log error
|
||||
return false;
|
||||
// TODO: Log error
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress0::blocksInFile(IDBDataFile* pFile) const
|
||||
{
|
||||
long long fsize;
|
||||
long long fsize;
|
||||
|
||||
if (getFileSize(pFile, fsize) == NO_ERROR)
|
||||
{
|
||||
return (fsize / BYTE_PER_BLOCK);
|
||||
}
|
||||
if (getFileSize(pFile, fsize) == NO_ERROR)
|
||||
{
|
||||
return (fsize / BYTE_PER_BLOCK);
|
||||
}
|
||||
|
||||
// TODO: Log error
|
||||
return 0;
|
||||
// TODO: Log error
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress0::readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo)
|
||||
{
|
||||
return readDBFile(pFile, readBuf, fbo, true);
|
||||
return readDBFile(pFile, readBuf, fbo, true);
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress0::saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo)
|
||||
{
|
||||
return writeDBFileFbo(pFile, writeBuf, fbo, 1);
|
||||
return writeDBFileFbo(pFile, writeBuf, fbo, 1);
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// ColumnOp with compression type 1
|
||||
// --------------------------------------------------------------------------------------------
|
||||
@ -123,16 +116,16 @@ int ColumnOpCompress0::saveBlock(IDBDataFile* pFile, const unsigned char* writeB
|
||||
|
||||
ColumnOpCompress1::ColumnOpCompress1(uint32_t compressionType, Log* logger)
|
||||
{
|
||||
m_compressionType = compressionType;
|
||||
m_chunkManager = new ChunkManager();
|
||||
m_compressionType = compressionType;
|
||||
m_chunkManager = new ChunkManager();
|
||||
|
||||
if (logger)
|
||||
{
|
||||
setDebugLevel( logger->getDebugLevel() );
|
||||
setLogger ( logger );
|
||||
}
|
||||
if (logger)
|
||||
{
|
||||
setDebugLevel(logger->getDebugLevel());
|
||||
setLogger(logger);
|
||||
}
|
||||
|
||||
m_chunkManager->fileOp(this);
|
||||
m_chunkManager->fileOp(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,83 +133,74 @@ ColumnOpCompress1::ColumnOpCompress1(uint32_t compressionType, Log* logger)
|
||||
*/
|
||||
ColumnOpCompress1::~ColumnOpCompress1()
|
||||
{
|
||||
if (m_chunkManager)
|
||||
{
|
||||
delete m_chunkManager;
|
||||
}
|
||||
if (m_chunkManager)
|
||||
{
|
||||
delete m_chunkManager;
|
||||
}
|
||||
}
|
||||
|
||||
// @bug 5572 - HDFS usage: add *.tmp file backup flag
|
||||
IDBDataFile* ColumnOpCompress1::openFile(
|
||||
const Column& column, const uint16_t dbRoot, const uint32_t partition, const uint16_t segment,
|
||||
std::string& segFile, bool useTmpSuffix, const char* mode, const int ioBuffSize) const
|
||||
IDBDataFile* ColumnOpCompress1::openFile(const Column& column, const uint16_t dbRoot,
|
||||
const uint32_t partition, const uint16_t segment,
|
||||
std::string& segFile, bool useTmpSuffix, const char* mode,
|
||||
const int ioBuffSize) const
|
||||
{
|
||||
return m_chunkManager->getFilePtr(column, dbRoot, partition, segment, segFile,
|
||||
mode, ioBuffSize, useTmpSuffix);
|
||||
return m_chunkManager->getFilePtr(column, dbRoot, partition, segment, segFile, mode, ioBuffSize,
|
||||
useTmpSuffix);
|
||||
}
|
||||
|
||||
|
||||
bool ColumnOpCompress1::abbreviatedExtent(IDBDataFile* pFile, int colWidth) const
|
||||
{
|
||||
return (blocksInFile(pFile) == INITIAL_EXTENT_ROWS_TO_DISK * colWidth / BYTE_PER_BLOCK);
|
||||
return (blocksInFile(pFile) == INITIAL_EXTENT_ROWS_TO_DISK * colWidth / BYTE_PER_BLOCK);
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress1::blocksInFile(IDBDataFile* pFile) const
|
||||
{
|
||||
return m_chunkManager->getBlockCount(pFile);
|
||||
return m_chunkManager->getBlockCount(pFile);
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress1::readBlock(IDBDataFile* pFile, unsigned char* readBuf, const uint64_t fbo)
|
||||
{
|
||||
return m_chunkManager->readBlock(pFile, readBuf, fbo);
|
||||
return m_chunkManager->readBlock(pFile, readBuf, fbo);
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress1::saveBlock(IDBDataFile* pFile, const unsigned char* writeBuf, const uint64_t fbo)
|
||||
{
|
||||
return m_chunkManager->saveBlock(pFile, writeBuf, fbo);
|
||||
return m_chunkManager->saveBlock(pFile, writeBuf, fbo);
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress1::flushFile(int rc, std::map<FID, FID>& columnOids)
|
||||
{
|
||||
return m_chunkManager->flushChunks(rc, columnOids);
|
||||
return m_chunkManager->flushChunks(rc, columnOids);
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress1::expandAbbrevColumnExtent(
|
||||
IDBDataFile* pFile, uint16_t dbRoot, const uint8_t* emptyVal, int width,
|
||||
execplan::CalpontSystemCatalog::ColDataType colDataType )
|
||||
int ColumnOpCompress1::expandAbbrevColumnExtent(IDBDataFile* pFile, uint16_t dbRoot, const uint8_t* emptyVal,
|
||||
int width,
|
||||
execplan::CalpontSystemCatalog::ColDataType colDataType)
|
||||
{
|
||||
// update the uncompressed initial chunk to full chunk
|
||||
int rc = m_chunkManager->expandAbbrevColumnExtent(pFile, emptyVal, width);
|
||||
// update the uncompressed initial chunk to full chunk
|
||||
int rc = m_chunkManager->expandAbbrevColumnExtent(pFile, emptyVal, width);
|
||||
|
||||
// ERR_COMP_FILE_NOT_FOUND is acceptable here. It just means that the
|
||||
// file hasn't been loaded into the chunk manager yet. No big deal.
|
||||
if (rc != NO_ERROR && rc != ERR_COMP_FILE_NOT_FOUND)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
// ERR_COMP_FILE_NOT_FOUND is acceptable here. It just means that the
|
||||
// file hasn't been loaded into the chunk manager yet. No big deal.
|
||||
if (rc != NO_ERROR && rc != ERR_COMP_FILE_NOT_FOUND)
|
||||
{
|
||||
return rc;
|
||||
}
|
||||
|
||||
// let the base to physically expand extent.
|
||||
return FileOp::expandAbbrevColumnExtent(pFile, dbRoot, emptyVal, width,
|
||||
colDataType);
|
||||
// let the base to physically expand extent.
|
||||
return FileOp::expandAbbrevColumnExtent(pFile, dbRoot, emptyVal, width, colDataType);
|
||||
}
|
||||
|
||||
|
||||
int ColumnOpCompress1::updateColumnExtent(IDBDataFile* pFile, int nBlocks, int64_t lbid)
|
||||
{
|
||||
return m_chunkManager->updateColumnExtent(pFile, nBlocks, lbid);
|
||||
return m_chunkManager->updateColumnExtent(pFile, nBlocks, lbid);
|
||||
}
|
||||
|
||||
|
||||
void ColumnOpCompress1::closeColumnFile(Column& column) const
|
||||
{
|
||||
// Leave file closing to chunk manager.
|
||||
column.dataFile.pFile = NULL;
|
||||
// Leave file closing to chunk manager.
|
||||
column.dataFile.pFile = NULL;
|
||||
}
|
||||
|
||||
} //end of namespace
|
||||
|
||||
} // namespace WriteEngine
|
||||
|
Reference in New Issue
Block a user