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

MCOL-498: Fill up the block with NULLs when CS touches for the first time it with INSERT..VALUES.

This commit is contained in:
Roman Nozdrin
2018-03-15 15:50:24 +03:00
committed by Roman Nozdrin
parent 81fe7fa1a9
commit 7cf0d55dd0
3 changed files with 28 additions and 4 deletions

View File

@@ -1879,7 +1879,7 @@ int FileOp::initDctnryExtent(
std::ostringstream oss; std::ostringstream oss;
std::string errnoMsg; std::string errnoMsg;
Convertor::mapErrnoToString(savedErrno, errnoMsg); Convertor::mapErrnoToString(savedErrno, errnoMsg);
oss << "FileOp::initColumnExtent(): fallocate(" << currFileSize << oss << "FileOp::initDctnryExtent(): fallocate(" << currFileSize <<
", " << writeSize << "): errno = " << savedErrno << ", " << writeSize << "): errno = " << savedErrno <<
": " << errnoMsg; ": " << errnoMsg;
logging::Message::Args args; logging::Message::Args args;

View File

@@ -1519,6 +1519,7 @@ void ColumnOp::setColParam(Column& column,
* rowIdArray - the array of row id, for performance purpose, I am assuming the rowIdArray is sorted * rowIdArray - the array of row id, for performance purpose, I am assuming the rowIdArray is sorted
* valArray - the array of row values * valArray - the array of row values
* oldValArray - the array of old value * oldValArray - the array of old value
* bDelete - yet
* RETURN: * RETURN:
* NO_ERROR if success, other number otherwise * NO_ERROR if success, other number otherwise
***********************************************************/ ***********************************************************/
@@ -1533,6 +1534,8 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
char charTmpBuf[8]; char charTmpBuf[8];
uint64_t emptyVal; uint64_t emptyVal;
int rc = NO_ERROR; int rc = NO_ERROR;
bool fillUpWEmptyVals = false;
bool fistRowInBlock = false;
while (!bExit) while (!bExit)
{ {
@@ -1551,8 +1554,18 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
return rc; return rc;
bDataDirty = false; bDataDirty = false;
// MCOL-498 We got into the next block, so the row is first in that block
// - fill the block up with NULLs.
if ( curDataFbo != -1 && !bDelete )
fillUpWEmptyVals = true;
} }
// MCOL-498 CS hasn't touched any block yet,
// but the row fill be the first in the block.
fistRowInBlock = ( !(curRowId % (BYTE_PER_BLOCK / curCol.colWidth)) ) ? true : false;
if( fistRowInBlock && !bDelete )
fillUpWEmptyVals = true;
curDataFbo = dataFbo; curDataFbo = dataFbo;
rc = readBlock(curCol.dataFile.pFile, dataBuf, curDataFbo); rc = readBlock(curCol.dataFile.pFile, dataBuf, curDataFbo);
@@ -1676,8 +1689,19 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
// take care of the cleanup // take care of the cleanup
if (bDataDirty && curDataFbo >= 0) if (bDataDirty && curDataFbo >= 0)
{
if ( fillUpWEmptyVals )
{
emptyVal = getEmptyRowValue(curCol.colDataType, curCol.colWidth);
int writeSize = BYTE_PER_BLOCK - ( dataBio + curCol.colWidth );
// MCOL-498 Add the check though this is unlikely at the moment of writing.
if ( writeSize )
setEmptyBuf( dataBuf + dataBio + curCol.colWidth, writeSize, emptyVal, curCol.colWidth );
fillUpWEmptyVals = false;
fistRowInBlock = false;
}
rc = saveBlock(curCol.dataFile.pFile, dataBuf, curDataFbo); rc = saveBlock(curCol.dataFile.pFile, dataBuf, curDataFbo);
}
return rc; return rc;
} }

View File

@@ -267,7 +267,7 @@ public:
bool bDelete = false); bool bDelete = false);
/** /**
* @brief Write row(s) for update and delete @Bug 1886,2870 * @brief Write row(s) for delete @Bug 1886,2870
*/ */
EXPORT virtual int writeRows(Column& curCol, EXPORT virtual int writeRows(Column& curCol,
uint64_t totalRow, uint64_t totalRow,
@@ -277,7 +277,7 @@ public:
bool bDelete = false); bool bDelete = false);
/** /**
* @brief Write row(s) for update and delete @Bug 1886,2870 * @brief Write row(s) for update @Bug 1886,2870
*/ */
EXPORT virtual int writeRowsValues(Column& curCol, EXPORT virtual int writeRowsValues(Column& curCol,
uint64_t totalRow, uint64_t totalRow,