*** ./src/backend/nodes/tidbitmap.c.orig Sat Jul 23 12:38:58 2005 --- ./src/backend/nodes/tidbitmap.c Sat Jul 23 12:41:16 2005 *************** *** 135,141 **** /* Local function prototypes */ static void tbm_union_page(TIDBitmap *a, const PagetableEntry *bpage); ! static bool tbm_intersect_page(PagetableEntry *apage, const TIDBitmap *b); static const PagetableEntry *tbm_find_pageentry(const TIDBitmap *tbm, BlockNumber pageno); static PagetableEntry *tbm_get_pageentry(TIDBitmap *tbm, BlockNumber pageno); --- 135,141 ---- /* Local function prototypes */ static void tbm_union_page(TIDBitmap *a, const PagetableEntry *bpage); ! static bool tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage, const TIDBitmap *b); static const PagetableEntry *tbm_find_pageentry(const TIDBitmap *tbm, BlockNumber pageno); static PagetableEntry *tbm_get_pageentry(TIDBitmap *tbm, BlockNumber pageno); *************** *** 382,388 **** /* Scan through chunks and pages in a, try to match to b */ if (a->status == TBM_ONE_PAGE) { ! if (tbm_intersect_page(&a->entry1, b)) { /* Page is now empty, remove it from a */ Assert(!a->entry1.ischunk); --- 382,388 ---- /* Scan through chunks and pages in a, try to match to b */ if (a->status == TBM_ONE_PAGE) { ! if (tbm_intersect_page(a, &a->entry1, b)) { /* Page is now empty, remove it from a */ Assert(!a->entry1.ischunk); *************** *** 401,407 **** hash_seq_init(&status, a->pagetable); while ((apage = (PagetableEntry *) hash_seq_search(&status)) != NULL) { ! if (tbm_intersect_page(apage, b)) { /* Page or chunk is now empty, remove it from a */ if (apage->ischunk) --- 401,407 ---- hash_seq_init(&status, a->pagetable); while ((apage = (PagetableEntry *) hash_seq_search(&status)) != NULL) { ! if (tbm_intersect_page(a, apage, b)) { /* Page or chunk is now empty, remove it from a */ if (apage->ischunk) *************** *** 424,430 **** * Returns TRUE if apage is now empty and should be deleted from a */ static bool ! tbm_intersect_page(PagetableEntry *apage, const TIDBitmap *b) { const PagetableEntry *bpage; int wordnum; --- 424,430 ---- * Returns TRUE if apage is now empty and should be deleted from a */ static bool ! tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage, const TIDBitmap *b) { const PagetableEntry *bpage; int wordnum; *************** *** 470,475 **** --- 470,478 ---- } else if (tbm_page_is_lossy(b, apage->blockno)) { + // The apage should be marked as lossy here. + tbm_mark_page_lossy (a, apage->blockno) ; + /* page is lossy in b, cannot clear any bits */ return false; }