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
MCOL-4566: Extend CompressedDBFileHeader struct with new fields.
* This patch extends CompressedDBFileHeader struct with new fields: `fColumWidth`, `fColDataType`, which are necessary to rebuild extent map from the given file. Note: new fields do not change the memory layout of the struct, because the size is calculated as max(sizeof(CompressedDBFileHeader), HDR_BUF_LEN)). * This patch changes API of some functions, by adding new function argument `colDataType` when needed, to be able to call `initHdr` function with colDataType value.
This commit is contained in:
@ -69,6 +69,8 @@ struct CompressedDBFileHeader
|
||||
uint64_t fCompressionType;
|
||||
uint64_t fHeaderSize;
|
||||
uint64_t fBlockCount;
|
||||
uint64_t fColumnWidth;
|
||||
execplan::CalpontSystemCatalog::ColDataType fColDataType;
|
||||
};
|
||||
|
||||
// Make the header to be 4K, regardless number of fields being defined/used in header.
|
||||
@ -86,6 +88,23 @@ void initCompressedDBFileHeader(void* hdrBuf, int compressionType, int hdrSize)
|
||||
hdr->fHeader.fCompressionType = compressionType;
|
||||
hdr->fHeader.fBlockCount = 0;
|
||||
hdr->fHeader.fHeaderSize = hdrSize;
|
||||
hdr->fHeader.fColumnWidth = 0;
|
||||
hdr->fHeader.fColDataType = execplan::CalpontSystemCatalog::ColDataType::UNDEFINED;
|
||||
}
|
||||
|
||||
void initCompressedDBFileHeader(
|
||||
void* hdrBuf, uint32_t columnWidth,
|
||||
execplan::CalpontSystemCatalog::ColDataType colDataType,
|
||||
int compressionType, int hdrSize)
|
||||
{
|
||||
CompressedDBFileHeaderBlock* hdr = reinterpret_cast<CompressedDBFileHeaderBlock*>(hdrBuf);
|
||||
hdr->fHeader.fMagicNumber = MAGIC_NUMBER;
|
||||
hdr->fHeader.fVersionNum = VERSION_NUM2;
|
||||
hdr->fHeader.fCompressionType = compressionType;
|
||||
hdr->fHeader.fBlockCount = 0;
|
||||
hdr->fHeader.fHeaderSize = hdrSize;
|
||||
hdr->fHeader.fColumnWidth = columnWidth;
|
||||
hdr->fHeader.fColDataType = colDataType;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -351,6 +370,19 @@ void IDBCompressInterface::initHdr(void* hdrBuf, void* ptrBuf, int compressionTy
|
||||
initCompressedDBFileHeader(hdrBuf, compressionType, hdrSize);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Initialize the header blocks to be written at the start of a column file.
|
||||
//------------------------------------------------------------------------------
|
||||
void IDBCompressInterface::initHdr(
|
||||
void* hdrBuf, uint32_t columnWidth,
|
||||
execplan::CalpontSystemCatalog::ColDataType columnType,
|
||||
int compressionType) const
|
||||
{
|
||||
memset(hdrBuf, 0, HDR_BUF_LEN * 2);
|
||||
initCompressedDBFileHeader(hdrBuf, columnWidth, columnType,
|
||||
compressionType, HDR_BUF_LEN * 2);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Set the file's block count
|
||||
//------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user