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

MCOL-5021 For the DELETE operation, empty magic values are only

written to database files for AUX column. Perform read-only operation
for other columns in the table to update the Casual Partitioning information.
This commit is contained in:
Gagan Goel
2022-04-20 13:42:53 -04:00
parent 86df9a972c
commit 35a3a93964
10 changed files with 128 additions and 84 deletions

View File

@ -271,7 +271,8 @@ IDBDataFile* ChunkManager::getFilePtr(const Column& column, uint16_t root, uint3
//------------------------------------------------------------------------------
// @bug 5572 - HDFS usage: add *.tmp file backup flag
IDBDataFile* ChunkManager::getFilePtr(const FID& fid, uint16_t root, uint32_t partition, uint16_t segment,
string& filename, const char* mode, int size, bool useTmpSuffix) const
string& filename, const char* mode, int size,
bool useTmpSuffix) const
{
CompFileData* fileData =
getFileData(fid, root, partition, segment, filename, mode, size, CalpontSystemCatalog::VARCHAR, 8,
@ -370,13 +371,6 @@ CompFileData* ChunkManager::getFileData_(const FileID& fileID, const string& fil
return NULL;
}
fileData->fIoBuffer.reset(new char[size]);
fileData->fIoBSize = size;
// TODO-There is no current way to make this setvbuf call as IDBDataFile only
// accepts the USE_VBUF at construction time and then uses a buffer that it manages
// Can either propagate an option through the openFile() call above and let
// IDBDataFile manage it internally or expose a new setBuffer() option.
// setvbuf(fileData->fFilePtr, fileData->fIoBuffer.get(), _IOFBF, size);
fileData->fDctnryCol = dctnry;
WE_COMP_DBG(cout << "open file* " << name << endl;)
@ -450,10 +444,6 @@ IDBDataFile* ChunkManager::createDctnryFile(const FID& fid, int64_t width, uint1
return NULL;
}
fileData->fIoBuffer.reset(new char[size]);
fileData->fIoBSize = size;
// see TODO- comment above
// setvbuf(fileData->fFilePtr, fileData->fIoBuffer.get(), _IOFBF, size);
fileData->fDctnryCol = true;
WE_COMP_DBG(cout << "create file* " << filename << endl;)
int hdrSize = calculateHeaderSize(width);
@ -493,7 +483,7 @@ IDBDataFile* ChunkManager::createDctnryFile(const FID& fid, int64_t width, uint1
// Read the block for the specified fbo, from pFile's applicable chunk, and
// into readBuf.
//------------------------------------------------------------------------------
int ChunkManager::readBlock(IDBDataFile* pFile, unsigned char* readBuf, uint64_t fbo)
int ChunkManager::readBlock(IDBDataFile* pFile, unsigned char* readBuf, uint64_t fbo, bool isReadOnly)
{
map<IDBDataFile*, CompFileData*>::iterator fpIt = fFilePtrMap.find(pFile);
@ -514,7 +504,7 @@ int ChunkManager::readBlock(IDBDataFile* pFile, unsigned char* readBuf, uint64_t
// chunk is not already uncompressed
if (chunkData == NULL)
rc = fetchChunkFromFile(pFile, offset.quot, chunkData);
rc = fetchChunkFromFile(pFile, offset.quot, chunkData, isReadOnly);
if (rc == NO_ERROR)
{
@ -688,7 +678,8 @@ int ChunkManager::flushChunks(int rc, const std::map<FID, FID>& columOids)
// If the header ptr for the requested chunk is 0 (or has length 0), then
// chunkData is initialized with a new empty chunk.
//------------------------------------------------------------------------------
int ChunkManager::fetchChunkFromFile(IDBDataFile* pFile, int64_t id, ChunkData*& chunkData)
int ChunkManager::fetchChunkFromFile(IDBDataFile* pFile, int64_t id, ChunkData*& chunkData,
bool isReadOnly)
{
// return value
int rc = NO_ERROR;
@ -734,7 +725,7 @@ int ChunkManager::fetchChunkFromFile(IDBDataFile* pFile, int64_t id, ChunkData*&
return rc;
}
if ((rc = writeHeader(fIt->second, __LINE__)) != NO_ERROR)
if (!isReadOnly && (rc = writeHeader(fIt->second, __LINE__)) != NO_ERROR)
{
// logged by writeHeader
return rc;
@ -1138,6 +1129,7 @@ int ChunkManager::openFile(CompFileData* fileData, const char* mode, int colWidt
{
int rc = NO_ERROR;
unsigned opts = IDBDataFile::USE_VBUF;
IDBPolicy::Contexts ctxt = IDBPolicy::WRITEENG;
if (fIsHdfs)
{
@ -1162,7 +1154,7 @@ int ChunkManager::openFile(CompFileData* fileData, const char* mode, int colWidt
}
}
fileData->fFilePtr = IDBDataFile::open(IDBPolicy::getType(fileData->fFileName.c_str(), IDBPolicy::WRITEENG),
fileData->fFilePtr = IDBDataFile::open(IDBPolicy::getType(fileData->fFileName.c_str(), ctxt),
fileData->fFileName.c_str(), mode, opts, colWidth);
if (fileData->fFilePtr == NULL)
@ -2064,8 +2056,6 @@ int ChunkManager::reallocateChunks(CompFileData* fileData)
if ((rc == NO_ERROR) && (rc = openFile(fileData, "r+b", fileData->fColWidth, true, __LINE__)) ==
NO_ERROR) // @bug 5572 HDFS tmp file
{
// see TODO- above regarding setvbuf
// setvbuf(fileData->fFilePtr, fileData->fIoBuffer.get(), _IOFBF, fileData->fIoBSize);
fileSize = fileData->fFilePtr->size();
if (fileSize == ptrs[k])

View File

@ -146,7 +146,6 @@ class CompFileData
, fColWidth(colWidth)
, fDctnryCol(false)
, fFilePtr(NULL)
, fIoBSize(0)
, fCompressionType(1)
{
}
@ -163,8 +162,6 @@ class CompFileData
std::string fFileName;
CompFileHeader fFileHeader;
std::list<ChunkData*> fChunkList;
boost::scoped_array<char> fIoBuffer;
size_t fIoBSize;
uint32_t fCompressionType;
friend class ChunkManager;
@ -203,7 +200,7 @@ class ChunkManager
// @brief Read a block from pFile at offset fbo.
// The data may copied from memory if the chunk it belongs to is already available.
int readBlock(IDBDataFile* pFile, unsigned char* readBuf, uint64_t fbo);
int readBlock(IDBDataFile* pFile, unsigned char* readBuf, uint64_t fbo, bool isReadOnly = false);
// @brief Save a block to a chunk in pFile.
// The block is not written to disk immediately, will be delayed until flush.
@ -290,7 +287,7 @@ class ChunkManager
bool useTmpSuffix, bool dctnry) const;
// @brief Retrieve a chunk of pFile from disk.
int fetchChunkFromFile(IDBDataFile* pFile, int64_t id, ChunkData*& chunkData);
int fetchChunkFromFile(IDBDataFile* pFile, int64_t id, ChunkData*& chunkData, bool isReadOnly = false);
// @brief Compress a chunk and write it to file.
int writeChunkToFile(CompFileData* fileData, int64_t id);