1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-498 Changes made according with review suggestions.

Add more comments.
    Changed return value for HDFS'es fallocate.
    Removed unnecessary code in ColumnBufferCompressed::writeToFile
    Replaced Nulls with Empties in variable names.
This commit is contained in:
Roman Nozdrin
2019-01-20 21:12:23 +03:00
parent cbdcdb9f10
commit abf7ef80c2
13 changed files with 96 additions and 55 deletions

View File

@ -521,7 +521,9 @@ int ColumnBufferManager::writeToFile(int endOffset)
// and the remaining buffer data will be written to the next segment file in
// the DBRoot, partition, segement number sequence.
// This function also catches and handles the case where an abbreviated
// extent needs to be expanded to a full extent on disk.
// extent needs to be expanded to a full extent on disk. When fillUpWEmpties is
// set then CS finishes with writing and has to fill with magics this block
// up to its boundary.
//
// WARNING: This means this function may change the information in the
// ColumnInfo struct that owns this ColumnBufferManager, if a
@ -529,7 +531,7 @@ int ColumnBufferManager::writeToFile(int endOffset)
// internal buffer, or if an abbreviated extent is expanded.
//------------------------------------------------------------------------------
int ColumnBufferManager::writeToFileExtentCheck(
uint32_t startOffset, uint32_t writeSize, bool fillUpWNulls)
uint32_t startOffset, uint32_t writeSize, bool fillUpWEmpties)
{
if (fLog->isDebug( DEBUG_3 ))
@ -571,7 +573,7 @@ int ColumnBufferManager::writeToFileExtentCheck(
if (availableFileSize >= writeSize)
{
int rc = fCBuf->writeToFile(startOffset, writeSize, fillUpWNulls);
int rc = fCBuf->writeToFile(startOffset, writeSize);
if (rc != NO_ERROR)
{
@ -583,9 +585,11 @@ int ColumnBufferManager::writeToFileExtentCheck(
return rc;
}
// MCOL-498 Fill it up to the block size boundary.
if ( fillUpWNulls )
// MCOL-498 Fill this block up to its boundary.
if ( fillUpWEmpties )
{
writeSize = BLOCK_SIZE;
}
fColInfo->updateBytesWrittenCounts( writeSize );
}
@ -628,7 +632,7 @@ int ColumnBufferManager::writeToFileExtentCheck(
}
int writeSize2 = writeSize - writeSize1;
rc = fCBuf->writeToFile(startOffset + writeSize1, writeSize2, fillUpWNulls);
rc = fCBuf->writeToFile(startOffset + writeSize1, writeSize2);
if (rc != NO_ERROR)
{
@ -640,9 +644,11 @@ int ColumnBufferManager::writeToFileExtentCheck(
return rc;
}
// MCOL-498 Fill it up to the block size boundary.
if ( fillUpWNulls )
// MCOL-498 Fill this block up to its boundary.
if ( fillUpWEmpties )
{
writeSize2 = BLOCK_SIZE;
}
fColInfo->updateBytesWrittenCounts( writeSize2 );
}
@ -651,7 +657,8 @@ int ColumnBufferManager::writeToFileExtentCheck(
}
//------------------------------------------------------------------------------
// Flush the contents of internal fCBuf (column buffer) to disk.
// Flush the contents of internal fCBuf (column buffer) to disk. If CS flushes
// less then BLOCK_SIZE bytes then it propagates this event down the stack.
//------------------------------------------------------------------------------
int ColumnBufferManager::flush( )
{
@ -676,19 +683,20 @@ int ColumnBufferManager::flush( )
int bufferSize = fCBuf->getSize();
// MCOL-498 There are less the BLOCK_SIZE bytes in the buffer left, so
// MCOL-498 There are less the BLOCK_SIZE bytes in the buffer left
// so propagate this info down the stack to fill the buffer up
// with empty magics.
// Account for circular buffer by making 2 calls to write the data,
// if we are wrapping around at the end of the buffer.
if (fBufFreeOffset < fBufWriteOffset)
{
// The check could be redundant.
bool fillUpWEmpty = ( static_cast<unsigned int>(bufferSize - fBufWriteOffset) >= BLOCK_SIZE )
bool fillUpWEmpties = ( static_cast<unsigned int>(bufferSize - fBufWriteOffset) >= BLOCK_SIZE )
? false : true;
RETURN_ON_ERROR( writeToFileExtentCheck( fBufWriteOffset,
bufferSize - fBufWriteOffset, fillUpWEmpty) );
bufferSize - fBufWriteOffset, fillUpWEmpties) );
fBufWriteOffset = 0;
}
// fill the buffer up with NULLs.
// MCOL-498 fill the buffer up with empty magics.
RETURN_ON_ERROR( writeToFileExtentCheck(
fBufWriteOffset, fBufFreeOffset - fBufWriteOffset, true) );
fBufWriteOffset = fBufFreeOffset;