Improve memset calls made to reset bool arrays (#5262)

pull/5266/head
Onur Tirtir 2021-09-09 17:56:03 +03:00 committed by GitHub
parent f4428412a0
commit be74518965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -349,7 +349,7 @@ ColumnarGetRelationInfoHook(PlannerInfo *root, Oid relationObjectId,
IndexOptInfo *indexOptInfo = NULL;
foreach_ptr(indexOptInfo, rel->indexlist)
{
memset(indexOptInfo->canreturn, false, indexOptInfo->ncolumns);
memset(indexOptInfo->canreturn, false, indexOptInfo->ncolumns * sizeof(bool));
}
}
}

View File

@ -585,7 +585,7 @@ columnar_index_fetch_tuple(struct IndexFetchTableData *sscan,
* writer transaction commits or aborts, without requiring us to fill
* the tupleslot properly.
*/
memset(slot->tts_isnull, true, slot->tts_nvalid);
memset(slot->tts_isnull, true, slot->tts_nvalid * sizeof(bool));
}
else
{

View File

@ -118,7 +118,7 @@ ColumnarBeginWrite(RelFileNode relfilenode,
ALLOCSET_DEFAULT_SIZES);
bool *columnMaskArray = palloc(columnCount * sizeof(bool));
memset(columnMaskArray, true, columnCount);
memset(columnMaskArray, true, columnCount * sizeof(bool));
ChunkData *chunkData = CreateEmptyChunkData(columnCount, columnMaskArray,
options.chunkRowCount);
@ -507,7 +507,7 @@ static StringInfo
SerializeBoolArray(bool *boolArray, uint32 boolArrayLength)
{
uint32 boolArrayIndex = 0;
uint32 byteCount = (boolArrayLength + 7) / 8;
uint32 byteCount = ((boolArrayLength * sizeof(bool)) + (8 - sizeof(bool))) / 8;
StringInfo boolArrayBuffer = makeStringInfo();
enlargeStringInfo(boolArrayBuffer, byteCount);