From: | Daniil Davydov <3danissimo(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Improve consistency checks in tbm_prepare_shared_iterate |
Date: | 2024-12-25 12:44:03 |
Message-ID: | CAJDiXgh4CX7u95TvJH7LXShtuJ3Fu0-gYdLHfGwt8RZ5k27Hmg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Currently, iterating through TIDBitmap contains this code (REL_16_STABLE) :
***
while ((page = pagetable_iterate(tbm->pagetable, &i)) != NULL)
{
idx = page - ptbase->ptentry;
if (page->ischunk)
ptchunks->index[nchunks++] = idx;
else
ptpages->index[npages++] = idx;
}
Assert(npages == tbm->npages);
Assert(nchunks == tbm->nchunks);
***
Two asserts in the end seem to be overdue to me, because if (for
example) nchunks > tbm->nchunks (due to another error),
we have already accessed to invalid memory chunk and overwritten it.
If we want to monitor the correctness of these variables, it might be
better to add a few checks, as in the attached patch.
I'm not sure if the comment in the error message is written correctly,
but first I would like to hear your opinion.
--
Best regards,
Daniil Davydov
Attachment | Content-Type | Size |
---|---|---|
0001-Add-new-checks-for-tidbitmap-scan.patch | text/x-patch | 1.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Nazir Bilal Yavuz | 2024-12-25 12:57:34 | Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions |
Previous Message | Alena Rybakina | 2024-12-25 11:20:42 | Re: Exists pull-up application with JoinExpr |