Content-Length: 277195 | pFad | http://github.com/postgrespro/postgres/commit/f1f21b2d6fd170faf9824306ef4f4950c32ce49d

50 Fix incorrect loop counts in tidbitmap.c. · postgrespro/postgres@f1f21b2 · GitHub
Skip to content

Commit f1f21b2

Browse files
committed
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
1 parent 97e1ec4 commit f1f21b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/nodes/tidbitmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ tbm_union_page(TIDBitmap *a, const PagetableEntry *bpage)
361361
if (bpage->ischunk)
362362
{
363363
/* Scan b's chunk, mark each indicated page lossy in a */
364-
for (wordnum = 0; wordnum < WORDS_PER_PAGE; wordnum++)
364+
for (wordnum = 0; wordnum < WORDS_PER_CHUNK; wordnum++)
365365
{
366366
bitmapword w = bpage->words[wordnum];
367367

@@ -473,7 +473,7 @@ tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage, const TIDBitmap *b)
473473
/* Scan each bit in chunk, try to clear */
474474
bool candelete = true;
475475

476-
for (wordnum = 0; wordnum < WORDS_PER_PAGE; wordnum++)
476+
for (wordnum = 0; wordnum < WORDS_PER_CHUNK; wordnum++)
477477
{
478478
bitmapword w = apage->words[wordnum];
479479

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/f1f21b2d6fd170faf9824306ef4f4950c32ce49d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy