Merge pull request #18929 from taosdata/fix/percentile_crash

fix: fix invalid retrieved buffer page causing crash
This commit is contained in:
dapan1121 2022-12-14 08:52:15 +08:00 committed by GitHub
commit 473338cf86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -364,6 +364,7 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
assert(pSlot->info.data->num >= pBucket->elemPerPage && pSlot->info.size > 0);
// keep the pointer in memory
setBufPageDirty(pSlot->info.data, true);
releaseBufPage(pBucket->pBuffer, pSlot->info.data);
pSlot->info.data = NULL;
}
@ -505,6 +506,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
SFilePage *pg = getBufPage(pMemBucket->pBuffer, *pageId);
tMemBucketPut(pMemBucket, pg->data, (int32_t)pg->num);
setBufPageDirty(pg, true);
releaseBufPage(pMemBucket->pBuffer, pg);
}