Skip to content

Commit 4c3b59a

Browse files
committed
Fix failure when a shared tidbitmap has only one page.
Commit 98e6e89 made inadequate provision for the case of a single-page shared tidbitmap. It allocate space for a shared PagetableEntry, but failed to initialize it. Report by Thomas Munro. Patch by Dilip Kumar, with some comment changes by me. Discussion: http://postgr.es/m/CAEepm=19Cmnfbi-j2Bw-a6yGPeHE1OVhKvvKz9bRBTJGKfGHMA@mail.gmail.com
1 parent 28b0478 commit 4c3b59a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/nodes/tidbitmap.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,12 +866,14 @@ tbm_prepare_shared_iterate(TIDBitmap *tbm)
866866
else if (tbm->status == TBM_ONE_PAGE)
867867
{
868868
/*
869-
* In one page mode allocate the space for one pagetable entry and
870-
* directly store its index i.e. 0 in page array
869+
* In one page mode allocate the space for one pagetable entry,
870+
* initialize it, and directly store its index (i.e. 0) in the
871+
* page array.
871872
*/
872873
tbm->dsapagetable = dsa_allocate(tbm->dsa, sizeof(PTEntryArray) +
873874
sizeof(PagetableEntry));
874875
ptbase = dsa_get_address(tbm->dsa, tbm->dsapagetable);
876+
memcpy(ptbase->ptentry, &tbm->entry1, sizeof(PagetableEntry));
875877
ptpages->index[0] = 0;
876878
}
877879

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy