1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-498: Fill up the last used block with empty values, whilst doing bulk insertion with uncompressed files.

This commit is contained in:
Roman Nozdrin
2018-03-20 17:39:26 +03:00
committed by Roman Nozdrin
parent 7cf0d55dd0
commit 6db8b1f432
7 changed files with 57 additions and 14 deletions

View File

@ -529,7 +529,7 @@ int ColumnBufferManager::writeToFile(int endOffset)
// internal buffer, or if an abbreviated extent is expanded.
//------------------------------------------------------------------------------
int ColumnBufferManager::writeToFileExtentCheck(
uint32_t startOffset, uint32_t writeSize)
uint32_t startOffset, uint32_t writeSize, bool fillUpWNulls)
{
if (fLog->isDebug( DEBUG_3 ))
@ -571,7 +571,7 @@ int ColumnBufferManager::writeToFileExtentCheck(
if (availableFileSize >= writeSize)
{
int rc = fCBuf->writeToFile(startOffset, writeSize);
int rc = fCBuf->writeToFile(startOffset, writeSize, fillUpWNulls);
if (rc != NO_ERROR)
{
@ -583,6 +583,10 @@ int ColumnBufferManager::writeToFileExtentCheck(
return rc;
}
// MCOL-498 Fill it up to the block size boundary.
if ( fillUpWNulls )
writeSize = BLOCK_SIZE;
fColInfo->updateBytesWrittenCounts( writeSize );
}
else
@ -624,7 +628,7 @@ int ColumnBufferManager::writeToFileExtentCheck(
}
int writeSize2 = writeSize - writeSize1;
fCBuf->writeToFile(startOffset + writeSize1, writeSize2);
rc = fCBuf->writeToFile(startOffset + writeSize1, writeSize2, fillUpWNulls);
if (rc != NO_ERROR)
{
@ -636,6 +640,10 @@ int ColumnBufferManager::writeToFileExtentCheck(
return rc;
}
// MCOL-498 Fill it up to the block size boundary.
if ( fillUpWNulls )
writeSize2 = BLOCK_SIZE;
fColInfo->updateBytesWrittenCounts( writeSize2 );
}
@ -668,17 +676,21 @@ int ColumnBufferManager::flush( )
int bufferSize = fCBuf->getSize();
// MCOL-498 There are less the BLOCK_SIZE bytes in the buffer left, so
// 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)
{
RETURN_ON_ERROR( writeToFileExtentCheck(
fBufWriteOffset, bufferSize - fBufWriteOffset) );
// The check could be redundant.
bool fillUpWEmpty = ( static_cast<unsigned int>(bufferSize - fBufWriteOffset) >= BLOCK_SIZE )
? false : true;
RETURN_ON_ERROR( writeToFileExtentCheck( fBufWriteOffset,
bufferSize - fBufWriteOffset, fillUpWEmpty) );
fBufWriteOffset = 0;
}
// fill the buffer up with NULLs.
RETURN_ON_ERROR( writeToFileExtentCheck(
fBufWriteOffset, fBufFreeOffset - fBufWriteOffset) );
fBufWriteOffset, fBufFreeOffset - fBufWriteOffset, true) );
fBufWriteOffset = fBufFreeOffset;
return NO_ERROR;