mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Fix incorrect loop counts in tidbitmap.c.
A couple of places that should have been iterating over WORDS_PER_CHUNK words were iterating over WORDS_PER_PAGE words instead. This thinko accidentally failed to fail, because (at least on common architectures with default BLCKSZ) WORDS_PER_CHUNK is a bit less than WORDS_PER_PAGE, and the extra words being looked at were always zero so nothing happened. Still, it's a bug waiting to happen if anybody ever fools with the parameters affecting TIDBitmap sizes, and it's a small waste of cycles too. So back-patch to all active branches. Etsuro Fujita
This commit is contained in:
parent
1c0dfaa68f
commit
4b61f67837
@ -361,7 +361,7 @@ tbm_union_page(TIDBitmap *a, const PagetableEntry *bpage)
|
||||
if (bpage->ischunk)
|
||||
{
|
||||
/* Scan b's chunk, mark each indicated page lossy in a */
|
||||
for (wordnum = 0; wordnum < WORDS_PER_PAGE; wordnum++)
|
||||
for (wordnum = 0; wordnum < WORDS_PER_CHUNK; wordnum++)
|
||||
{
|
||||
bitmapword w = bpage->words[wordnum];
|
||||
|
||||
@ -473,7 +473,7 @@ tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage, const TIDBitmap *b)
|
||||
/* Scan each bit in chunk, try to clear */
|
||||
bool candelete = true;
|
||||
|
||||
for (wordnum = 0; wordnum < WORDS_PER_PAGE; wordnum++)
|
||||
for (wordnum = 0; wordnum < WORDS_PER_CHUNK; wordnum++)
|
||||
{
|
||||
bitmapword w = apage->words[wordnum];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user